blob: 3891e527c542a62accc162c06d0ed17905d86c01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
const cpu = @import("cpu.zig");
const gpio = @import("gpio.zig");
const rcc: *[39]u32 = @ptrFromInt(0x40021000);
const gpioa = gpio.gpioa;
const gpioc = gpio.gpioc;
export fn _start() callconv(.C) noreturn {
cpu.interrupt_disable();
rcc[19] |= 5; // gpio a and c
gpioa.set_mode(5, .output);
gpioc.set_mode(13, .input);
while (true) {
const state = gpioc.read(13);
gpioa.write(5, state);
}
}
export fn fault_handler() callconv(.C) void {
while (true) {}
}
|