Skip to content

Commit

Permalink
Fix all warnings in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
usbalbin committed Jun 5, 2023
1 parent 5d847d9 commit cbed4ed
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/can-echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fn main() -> ! {

loop {
if let Ok(rxheader) = block!(can.receive0(&mut buffer)) {
block!(can.transmit(rxheader.unwrap().to_tx_header(None), &mut buffer)).unwrap();
block!(can.transmit(rxheader.unwrap().to_tx_header(None), &buffer)).unwrap();
}
}
}
6 changes: 3 additions & 3 deletions examples/i2c-bme680.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ fn main() -> ! {
.with_run_gas(true)
.build();

let profile_dur = dev.get_profile_dur(&settings.0).unwrap();
let _profile_dur = dev.get_profile_dur(&settings.0).unwrap();
dev.set_sensor_settings(&mut delayer, settings).unwrap();
dev.set_sensor_mode(&mut delayer, PowerMode::ForcedMode)
.unwrap();
let sensor_settings = dev.get_sensor_settings(settings.1);
let _sensor_settings = dev.get_sensor_settings(settings.1);

loop {
delay.delay_ms(500u32);
let power_mode = dev.get_sensor_mode();
let _power_mode = dev.get_sensor_mode();
dev.set_sensor_mode(&mut delayer, PowerMode::ForcedMode)
.unwrap();
let (data, _state) = dev.get_sensor_data(&mut delayer).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use panic_probe as _;

use stm32g4 as _;

use defmt::Format;


#[defmt::panic_handler]
fn panic() -> ! {
Expand Down
6 changes: 5 additions & 1 deletion examples/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ use hal::gpio::AF6;
use hal::prelude::*;
use hal::stm32;
use stm32g4xx_hal as hal;
mod utils;
extern crate cortex_m_rt as rt;

#[macro_use]
mod utils;

#[entry]
fn main() -> ! {
utils::logger::init();

let dp = stm32::Peripherals::take().expect("cannot take peripherals");
let mut rcc = dp.RCC.constrain();
let gpioa = dp.GPIOA.split(&mut rcc);
Expand Down
18 changes: 10 additions & 8 deletions examples/spi-sd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ extern crate embedded_sdmmc;

use hal::gpio::gpiob::PB14;
use hal::gpio::gpiob::PB15;
use hal::gpio::gpiof::PF8;
use hal::gpio::gpiof::PF9;
use hal::gpio::Alternate;
use hal::gpio::AF5;
use hal::prelude::*;
use hal::rcc::Config;
use hal::spi;
use hal::stm32;

use hal::stm32::Peripherals;
use hal::timer::Timer;

use stm32g4xx_hal as hal;

use embedded_sdmmc::{
Block, BlockCount, BlockDevice, BlockIdx, Controller, Error, Mode, TimeSource, Timestamp,
VolumeIdx,
TimeSource, Timestamp,
};

use cortex_m_rt::entry;
use log::info;


#[macro_use]
mod utils;

#[entry]
fn main() -> ! {
utils::logger::init();

let dp = Peripherals::take().unwrap();
let rcc = dp.RCC.constrain();
let mut rcc = rcc.freeze(Config::hsi());
Expand All @@ -48,7 +48,7 @@ fn main() -> ! {
let miso: PB14<Alternate<AF5>> = gpiob.pb14.into_alternate();
let mosi: PB15<Alternate<AF5>> = gpiob.pb15.into_alternate();

let mut spi = dp
let spi = dp
.SPI2
.spi((sck, miso, mosi), spi::MODE_0, 400.khz(), &mut rcc);

Expand All @@ -69,6 +69,8 @@ fn main() -> ! {

let mut cont = embedded_sdmmc::Controller::new(embedded_sdmmc::SdMmcSpi::new(spi, cs), Clock);

cont.device().init();
cont.device().init().unwrap();

#[allow(clippy::empty_loop)]
loop {}
}
1 change: 0 additions & 1 deletion examples/utils/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ cfg_if::cfg_if! {
impl log::Log for Logger {
fn enabled(&self, metadata: &Metadata) -> bool {
metadata.level() <= self.level

}

fn log(&self, record: &Record) {
Expand Down

0 comments on commit cbed4ed

Please sign in to comment.