Skip to content
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

STM32F3DISCOVERY: Working blinky #379

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/stmicro/stm32/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ pub fn build(b: *std.Build) void {

const mz_dep = b.dependency("microzig", .{});
const mb = MicroBuild.init(b, mz_dep) orelse return;
const stm32 = mb.ports.stm32;

const available_examples = [_]Example{
.{ .target = mb.ports.stm32.chips.STM32F103C8, .name = "STM32F103C8", .file = "src/blinky.zig" },
.{ .target = stm32.chips.STM32F103C8, .name = "STM32F103C8", .file = "src/blinky.zig" },
.{ .target = stm32.boards.stm32f3discovery, .name = "stm32f3discovery", .file = "src/blinky.zig" },
// TODO: stm32.pins.GlobalConfiguration is not available on those targets
// .{ .target = stm32.chips.stm32f303vc, .name = "stm32f303vc", .file = "src/blinky.zig" },
// .{ .target = stm32.chips.stm32f407vg, .name = "stm32f407vg", .file = "src/blinky.zig" },
// .{ .target = stm32.chips.stm32f429zit6u, .name = "stm32f429zit6u", .file = "src/blinky.zig" },
// .{ .target = stm32.boards.stm32f3discovery, .name = "stm32f3discovery", .file = "src/blinky.zig" },
// .{ .target = stm32.boards.stm32f4discovery, .name = "stm32f4discovery", .file = "src/blinky.zig" },
// .{ .target = stm32.boards.stm3240geval, .name = "stm3240geval", .file = "src/blinky.zig" },
// .{ .target = stm32.boards.stm32f429idiscovery, .name = "stm32f429idiscovery", .file = "src/blinky.zig" },
Expand Down
22 changes: 22 additions & 0 deletions examples/stmicro/stm32/src/blinky.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@ pub fn main() !void {
pins.led,
};
break :res .{ pins, all_leds };
} else if (comptime microzig.config.board_name != null and std.mem.eql(u8, microzig.config.board_name.?, "STM32F3DISCOVERY")) {
const pins = (stm32.pins.GlobalConfiguration{ .GPIOE = .{
.PE8 = .{ .mode = .{ .output = .push_pull } },
.PE9 = .{ .mode = .{ .output = .push_pull } },
.PE10 = .{ .mode = .{ .output = .push_pull } },
.PE11 = .{ .mode = .{ .output = .push_pull } },
.PE12 = .{ .mode = .{ .output = .push_pull } },
.PE13 = .{ .mode = .{ .output = .push_pull } },
.PE14 = .{ .mode = .{ .output = .push_pull } },
.PE15 = .{ .mode = .{ .output = .push_pull } },
} }).apply();
const all_leds = .{
pins.PE8,
pins.PE9,
pins.PE10,
pins.PE11,
pins.PE12,
pins.PE13,
pins.PE14,
pins.PE15,
};
break :res .{ pins, all_leds };
} else {
@compileError("blinky is not (yet?) implemented for this target");
}
Expand Down
Loading