Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ fn main() -> ! {
loop {
info!("Set Led low");
for _ in 0..10_000_000 {
led.set_low().unwrap();
led.set_low();
}

info!("Set Led High");
for _ in 0..10_000_000 {
led.set_high().unwrap();
led.set_high();
}
}
}
4 changes: 2 additions & 2 deletions examples/blinky_delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ fn main() -> ! {

loop {
info!("Toggle");
led.toggle().unwrap();
led.toggle();
info!("SYST delay");
delay_syst.delay(1000.millis());
info!("Toggle");
led.toggle().unwrap();
led.toggle();
info!("TIM2 delay");
delay_tim2.delay_ms(1000);
}
Expand Down
5 changes: 2 additions & 3 deletions examples/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use core::cell::RefCell;
use core::sync::atomic::{AtomicBool, Ordering};
use cortex_m::{asm::wfi, interrupt::Mutex};
use cortex_m_rt::entry;
use embedded_hal::digital::OutputPin;

type ButtonPin = gpio::PC13<Input<PullDown>>;

Expand Down Expand Up @@ -86,10 +85,10 @@ fn main() -> ! {

if G_LED_ON.load(Ordering::Relaxed) {
println!("Turn Led On!");
led.set_high().unwrap();
led.set_high();
} else {
println!("Turn Led Off!");
led.set_low().unwrap();
led.set_low();
}
}
}
8 changes: 4 additions & 4 deletions examples/can-echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ fn main() -> ! {

let can1 = {
info!("Init CAN 1");
let rx = gpiob.pb8.into_alternate().set_speed(Speed::VeryHigh);
let tx = gpiob.pb9.into_alternate().set_speed(Speed::VeryHigh);
let rx = gpiob.pb8.into_alternate().speed(Speed::VeryHigh);
let tx = gpiob.pb9.into_alternate().speed(Speed::VeryHigh);

info!("-- Create CAN 1 instance");
let mut can = dp.FDCAN1.fdcan(tx, rx, &rcc);
Expand All @@ -82,8 +82,8 @@ fn main() -> ! {

// let can2 = {
// info!("Init CAN 2");
// let rx = gpiob.pb5.into_alternate().set_speed(Speed::VeryHigh);
// let tx = gpiob.pb13.into_alternate().set_speed(Speed::VeryHigh);
// let rx = gpiob.pb5.into_alternate().speed(Speed::VeryHigh);
// let tx = gpiob.pb13.into_alternate().speed(Speed::VeryHigh);

// info!("-- Create CAN 2 instance");
// let mut can = dp.FDCAN2.fdcan(tx, rx, &rcc);
Expand Down
5 changes: 2 additions & 3 deletions examples/comp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use rt::entry;
fn main() -> ! {
use hal::comparator::{refint_input, ComparatorExt, ComparatorSplit, Config, Hysteresis};
use hal::gpio::GpioExt;
use hal::prelude::OutputPin;
use hal::rcc::RccExt;
use hal::stm32;
use stm32g4xx_hal as hal;
Expand Down Expand Up @@ -55,8 +54,8 @@ fn main() -> ! {
loop {
// Read comp1 output and update led1 accordingly
match comp1.output() {
true => led1.set_high().unwrap(),
false => led1.set_low().unwrap(),
true => led1.set_high(),
false => led1.set_low(),
}
}
}
6 changes: 3 additions & 3 deletions examples/spi-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ fn main() -> ! {
.SPI1
.spi((sclk, miso, mosi), spi::MODE_0, 400.kHz(), &mut rcc);
let mut cs = gpioa.pa8.into_push_pull_output();
cs.set_high().unwrap();
cs.set_high();

// "Hello world!"
let message = b"Hello world!";
let mut received_byte: u8;

loop {
for &byte in message {
cs.set_low().unwrap();
cs.set_low();
spi.send(byte).unwrap();
received_byte = nb::block!(FullDuplex::read(&mut spi)).unwrap();
cs.set_high().unwrap();
cs.set_high();

info!("{}", received_byte as char);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/spi-sd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() -> ! {

let cs = {
let mut cs = gpiof.pf8.into_push_pull_output();
cs.set_high().unwrap();
cs.set_high();
cs
};

Expand Down
2 changes: 1 addition & 1 deletion examples/uart-dma-tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn main() -> ! {
while !transfer.get_transfer_complete_flag() {}

delay_syst.delay(1000.millis());
led.toggle().unwrap();
led.toggle();
transfer.restart(|_tx| {});
}
}
6 changes: 3 additions & 3 deletions examples/usb_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn main() -> ! {
let gpioa = dp.GPIOA.split(&mut rcc);

let mut led = gpioa.pa5.into_push_pull_output();
led.set_low().ok();
led.set_low();

let usb_dm = gpioa.pa11.into_alternate();
let usb_dp = gpioa.pa12.into_alternate();
Expand Down Expand Up @@ -63,7 +63,7 @@ fn main() -> ! {

match serial.read(&mut buf) {
Ok(count) if count > 0 => {
led.set_high().ok();
led.set_high();

// Echo back in upper case
for c in buf[0..count].iter_mut() {
Expand All @@ -85,6 +85,6 @@ fn main() -> ! {
_ => {}
}

led.set_low().ok();
led.set_low();
}
}
Loading
Loading