Browse Source

fix check errors

crude-e-h-1.0.0-alpha.1
Torkel Danielsson 3 years ago committed by Daniel Egger
parent
commit
26d2148ee9
  1. 10
      examples/blinky.rs
  2. 4
      examples/blinky_delay.rs
  3. 8
      examples/dac.rs
  4. 4
      examples/serial_spi_bridge.rs

10
examples/blinky.rs

@ -12,14 +12,12 @@ use cortex_m_rt::entry;
#[entry]
fn main() -> ! {
if let Some(mut p) = pac::Peripherals::take() {
let mut led = cortex_m::interrupt::free(|cs| {
let mut rcc = p.RCC.configure().sysclk(8.mhz()).freeze(&mut p.FLASH);
let mut rcc = p.RCC.configure().sysclk(8.mhz()).freeze(&mut p.FLASH);
let gpioa = p.GPIOA.split(&mut rcc);
let gpioa = p.GPIOA.split(&mut rcc);
// (Re-)configure PA1 as output
gpioa.pa1.into_push_pull_output(cs)
});
// (Re-)configure PA1 as output
let mut led = cortex_m::interrupt::free(|cs| gpioa.pa1.into_push_pull_output(cs));
loop {
// Turn PA1 on a million times in a row

4
examples/blinky_delay.rs

@ -18,9 +18,7 @@ fn main() -> ! {
let gpioa = p.GPIOA.split(&mut rcc);
// (Re-)configure PA1 as output
let mut led = cortex_m::interrupt::free(move |cs| {
gpioa.pa1.into_push_pull_output(cs);
});
let mut led = cortex_m::interrupt::free(move |cs| gpioa.pa1.into_push_pull_output(cs));
// Get delay provider
let mut delay = Delay::new(cp.SYST, &rcc);

8
examples/dac.rs

@ -23,11 +23,11 @@ enum Direction {
fn main() -> ! {
if let (Some(mut dp), Some(_cp)) = (pac::Peripherals::take(), cortex_m::Peripherals::take()) {
let mut rcc = dp.RCC.configure().sysclk(8.mhz()).freeze(&mut dp.FLASH);
let gpioa = dp.GPIOA.split(&mut rcc);
let mut dac = cortex_m::interrupt::free(move |cs| {
let gpioa = dp.GPIOA.split(&mut rcc);
dac(dp.DAC, gpioa.pa4.into_analog(cs), &mut rcc)
});
let pa4 = cortex_m::interrupt::free(move |cs| gpioa.pa4.into_analog(cs));
let mut dac = dac(dp.DAC, pa4, &mut rcc);
dac.enable();

4
examples/serial_spi_bridge.rs

@ -34,9 +34,9 @@ fn main() -> ! {
let mut flash = p.FLASH;
let mut rcc = p.RCC.configure().freeze(&mut flash);
let (sck, miso, mosi, tx, rx) = cortex_m::interrupt::free(move |cs| {
let gpioa = p.GPIOA.split(&mut rcc);
let gpioa = p.GPIOA.split(&mut rcc);
let (sck, miso, mosi, tx, rx) = cortex_m::interrupt::free(move |cs| {
(
// SPI pins
gpioa.pa5.into_alternate_af0(cs),

Loading…
Cancel
Save