summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 997e5328dbefff45e01ccaf9ea806f7e78f6e17b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#![no_main]
#![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: 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]
fn panic(_info: &PanicInfo) -> ! {
    loop {}
}