-
Notifications
You must be signed in to change notification settings - Fork 14
/
blinky.rs
42 lines (32 loc) · 1.14 KB
/
blinky.rs
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
42
#![no_main]
#![no_std]
use cortex_m_rt::entry;
use panic_semihosting as _;
use daisy::hal::prelude::*;
use daisy::led::Led;
use daisy_bsp as daisy;
#[entry]
fn main() -> ! {
// - board setup ----------------------------------------------------------
let board = daisy::Board::take().unwrap();
let dp = daisy::pac::Peripherals::take().unwrap();
let ccdr = board.freeze_clocks(dp.PWR.constrain(), dp.RCC.constrain(), &dp.SYSCFG);
let pins = board.split_gpios(
dp.GPIOA.split(ccdr.peripheral.GPIOA),
dp.GPIOB.split(ccdr.peripheral.GPIOB),
dp.GPIOC.split(ccdr.peripheral.GPIOC),
dp.GPIOD.split(ccdr.peripheral.GPIOD),
dp.GPIOE.split(ccdr.peripheral.GPIOE),
dp.GPIOF.split(ccdr.peripheral.GPIOF),
dp.GPIOG.split(ccdr.peripheral.GPIOG),
);
let mut led_user = daisy::led::UserLed::new(pins.LED_USER);
// - main loop ------------------------------------------------------------
let one_second = ccdr.clocks.sys_ck().raw();
loop {
led_user.on();
cortex_m::asm::delay(one_second);
led_user.off();
cortex_m::asm::delay(one_second);
}
}