-
Notifications
You must be signed in to change notification settings - Fork 155
rp2xxx: ssd1306 oled display example #646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ymore - Removed all Enabled enum usage in schmitt trigger and turned them to be bool only - Only GPIO confing uses now the Enabled enum for user-friendly readability
- Remove switch and use logical eval
mattnite
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important that examples are compiled so that CI catches breaks. It's okay to add a dependency to the example as it is separate from the actual package. I also see that it is your package, and that is fine, but it needs to have a compatible LICENSE, and the dependency must link to a commit with that license. If you fail to maintain that package in the future and it blocks our CI, this example can be removed.
debe194 to
a4cac98
Compare
|
You should also add the example to build.zig as well adding the module import. These are the changes you need to make: diff --git a/examples/raspberrypi/rp2xxx/build.zig b/examples/raspberrypi/rp2xxx/build.zig
index 1add360d..8a4382ed 100644
--- a/examples/raspberrypi/rp2xxx/build.zig
+++ b/examples/raspberrypi/rp2xxx/build.zig
@@ -9,6 +9,8 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const maybe_example = b.option([]const u8, "example", "only build matching examples");
+ const font8x8_dep = b.dependency("font8x8", .{});
+
const mz_dep = b.dependency("microzig", .{});
const mb = MicroBuild.init(b, mz_dep) orelse return;
@@ -68,6 +70,9 @@ pub fn build(b: *std.Build) void {
.{ .name = "dma", .file = "src/dma.zig" },
.{ .name = "cyw43", .file = "src/cyw43.zig" },
.{ .name = "mlx90640", .file = "src/mlx90640.zig" },
+ .{ .name = "ssd1306-oled", .file = "src/ssd1306_oled.zig", .imports = &.{
+ .{ .name = "font8x8", .module = font8x8_dep.module("font8x8") },
+ } },
};
var available_examples = std.ArrayList(Example).init(b.allocator);
@@ -77,12 +82,14 @@ pub fn build(b: *std.Build) void {
.target = mb.ports.rp2xxx.boards.raspberrypi.pico,
.name = b.fmt("pico_{s}", .{example.name}),
.file = example.file,
+ .imports = example.imports,
}) catch @panic("out of memory");
available_examples.append(.{
.target = mb.ports.rp2xxx.boards.raspberrypi.pico2_arm,
.name = b.fmt("pico2_arm_{s}", .{example.name}),
.file = example.file,
+ .imports = example.imports,
}) catch @panic("out of memory");
if (example.works_with_riscv) {
@@ -90,6 +97,7 @@ pub fn build(b: *std.Build) void {
.target = mb.ports.rp2xxx.boards.raspberrypi.pico2_riscv,
.name = b.fmt("pico2_riscv_{s}", .{example.name}),
.file = example.file,
+ .imports = example.imports,
}) catch @panic("out of memory");
}
}
@@ -110,6 +118,7 @@ pub fn build(b: *std.Build) void {
.target = example.target,
.optimize = optimize,
.root_source_file = b.path(example.file),
+ .imports = example.imports,
});
// `install_firmware()` is the MicroZig pendant to `Build.installArtifact()`
@@ -127,10 +136,12 @@ const Example = struct {
target: *const microzig.Target,
name: []const u8,
file: []const u8,
+ imports: []const std.Build.Module.Import = &.{},
};
const ChipAgnosticExample = struct {
name: []const u8,
file: []const u8,
works_with_riscv: bool = true,
+ imports: []const std.Build.Module.Import = &.{},
};To test that your example is building you should run |
Co-authored-by: Grazfather <[email protected]>
|
I made the most changes but I was having some errors and couldn't find time since then to look into it. Maybe this week I can have sometime to look. |
Co-authored-by: Grazfather <[email protected]>
|
Were you able to test this after your changes? Looks good to me. Thanks for your patience with my review! |
No worries, all required... Yeah I tested it on every bit of changes we were doing. Just one thing; on my RP2040 it worked with pins 8 and 9 not 4 and 5 but I guess there might be a problem with mine specific MCU: |
|
It should work on either, but maybe you wired it wrong. Thanks for testing it. |

No description provided.