diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index 146f601..997e532 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,14 +2,37 @@ #![no_std] use core::panic::PanicInfo; +use hal::gpio::get_gpio_port_b; +use crate::hal::gpio; + +mod hal; mod init; #[link_section = ".inits.999"] #[no_mangle] -pub static __MAIN: fn() -> () = main; -pub fn main() -> () { - loop {}; +pub static __MAIN: unsafe fn() -> () = main; +pub unsafe fn main() -> () { + let mut pin = get_gpio_port_b().pin(3); + pin.set_mode(gpio::GpioMode::Output); + pin.set_output_type(gpio::GpioOutputType::PushPull); + pin.set_output_speed(gpio::GpioSpeed::Medium); + pin.set_pull_dir(gpio::GpioPullDir::Down); + + pin.set_high(); + loop { + delay(); + pin.set_low(); + delay(); + pin.set_high(); + } +} + +fn delay() { + let mut cnt = 0; + while cnt < 10000 { + cnt += 1; + } } #[panic_handler] |