5 releases
0.2.0 | May 29, 2020 |
---|---|
0.1.3 | May 6, 2020 |
0.1.2 | May 6, 2020 |
0.1.1 | May 6, 2020 |
0.1.0 | May 6, 2020 |
#101 in #stm32
10KB
177 lines
1bitsy Board Support Crate
This crate is relatively untested
It wraps up and makes more obvious how to use:
- the set of
Pins
supported by the board - the onboard LED on
PA8
- the onboard button on
PC1
- the onboard 25MHz high-speed oscillator crystal
lib.rs
:
Board support crate for the 1Bitsy
Usage
use onebitsy::{self, stm32, Led, Button};
use cortex_m_rt::{entry, exception};
#![entry]
fn main() -> ! {
if let (Some(dp), Some(_cp)) = (
stm32::Peripherals::take(),
cortex_m::peripheral::Peripherals::take(),
) {
let _clocks = onebitsy::configure_clocks(dp.RCC.constrain());
let pins = onebitsy::Pins::new(
dp.GPIOA.split(),
dp.GPIOB.split(),
dp.GPIOC.split(),
dp.GPIOD.split(),
);
let mut led = onebitsy::led(pins.pa8);
let button = onebitsy::button(pins.pc1);
loop {
if button.is_pressed() {
led.on();
} else {
led.off();
}
}
}
loop {}
}
Dependencies
~53MB
~1.5M SLoC