You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.1 KiB
45 lines
1.1 KiB
#![no_std]
|
|
#![no_main]
|
|
|
|
use cortex_m_rt::entry;
|
|
use embedded_hal::digital::v2::OutputPin;
|
|
use stm32f1xx_hal::{delay::Delay, pac, prelude::*};
|
|
|
|
// Halt the MCU when panic
|
|
#[allow(unused_imports)]
|
|
use panic_halt;
|
|
|
|
mod seq;
|
|
pub use seq::{LayerSelect, SeqLayer, Sequencer};
|
|
|
|
#[entry]
|
|
fn main() -> ! {
|
|
// Grab handles for the underlying hardware objects
|
|
let dp = pac::Peripherals::take().unwrap();
|
|
let cp = cortex_m::Peripherals::take().unwrap();
|
|
|
|
// Initialise GPIOC via the HAL
|
|
let mut rcc = dp.RCC.constrain();
|
|
let mut gpioc = dp.GPIOC.split(&mut rcc.apb2);
|
|
|
|
// Make it into an output
|
|
let mut led = gpioc.pc13.into_push_pull_output(&mut gpioc.crh);
|
|
|
|
// Initialize the delay object with the MCU frequency
|
|
let mut flash = dp.FLASH.constrain();
|
|
let clocks = rcc
|
|
.cfgr
|
|
.use_hse(8.mhz())
|
|
.sysclk(48.mhz())
|
|
.pclk1(24.mhz())
|
|
.freeze(&mut flash.acr);
|
|
let mut delay = Delay::new(cp.SYST, clocks);
|
|
|
|
// Now go blinkenlights
|
|
loop {
|
|
led.set_high().ok();
|
|
delay.delay_ms(1000_u16);
|
|
led.set_low().ok();
|
|
delay.delay_ms(1000_u16);
|
|
}
|
|
}
|
|
|