Skip to content

Commit

Permalink
Fix CLRF line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbeechey committed Oct 13, 2024
1 parent 8080207 commit 5df95b9
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 68 deletions.
10 changes: 5 additions & 5 deletions boards/stm32l476rg/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
println!("cargo:rustc-link-arg-bins=--nmagic");
println!("cargo:rustc-link-arg-bins=-Tlink.x");
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
}
fn main() {
println!("cargo:rustc-link-arg-bins=--nmagic");
println!("cargo:rustc-link-arg-bins=-Tlink.x");
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
}
32 changes: 16 additions & 16 deletions boards/stm32l476rg/src/bin/temp_test.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#![no_std]
#![no_main]

use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use hyped_boards_stm32l476rg::tasks::temperature::read_temp;
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::main]
async fn main(spawner: Spawner) -> ! {
spawner.spawn(read_temp()).unwrap();

loop {
Timer::after(Duration::from_secs(1)).await;
}
}
#![no_std]
#![no_main]

use embassy_executor::Spawner;
use embassy_time::{Duration, Timer};
use hyped_boards_stm32l476rg::tasks::temperature::read_temp;
use {defmt_rtt as _, panic_probe as _};

#[embassy_executor::main]
async fn main(spawner: Spawner) -> ! {
spawner.spawn(read_temp()).unwrap();

loop {
Timer::after(Duration::from_secs(1)).await;
}
}
2 changes: 1 addition & 1 deletion boards/stm32l476rg/src/io.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod i2c;
pub mod i2c;
2 changes: 1 addition & 1 deletion boards/stm32l476rg/src/tasks.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod temperature;
pub mod temperature;
90 changes: 45 additions & 45 deletions boards/stm32l476rg/src/tasks/temperature.rs
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
use crate::io::i2c::Stm32l476rgI2c;
use defmt_rtt as _;
use embassy_stm32::i2c::I2c;
use embassy_stm32::time::Hertz;
use hyped_sensors::temperature::{Status, Temperature, TemperatureAddresses};

/// Test task that just reads the temperature from the sensor and prints it to the console
#[embassy_executor::task]
pub async fn read_temp() -> ! {
let p = embassy_stm32::init(Default::default());
let i2c = I2c::new_blocking(p.I2C1, p.PB8, p.PB9, Hertz(100_000), Default::default());
let hyped_i2c = Stm32l476rgI2c::new(i2c);

let mut temperature_sensor = Temperature::new(hyped_i2c, TemperatureAddresses::Address3f)
.expect(
"Failed to create temperature sensor. Check the wiring and the I2C address of the sensor.",
);

loop {
match temperature_sensor.check_status() {
Status::TempOverUpperLimit => {
defmt::error!("Temperature is over the upper limit.");
}
Status::TempUnderLowerLimit => {
defmt::error!("Temperature is under the lower limit.");
}
Status::Busy => {
defmt::warn!("Temperature sensor is busy.");
}
Status::Unknown => {
panic!("Could not get the status of the temperature sensor.")
}
Status::Ok => {}
}

match temperature_sensor.read() {
Some(temperature) => {
defmt::info!("Temperature: {:?}", temperature);
}
None => {
defmt::info!("Failed to read temperature.");
}
}
}
}
use crate::io::i2c::Stm32l476rgI2c;
use defmt_rtt as _;
use embassy_stm32::i2c::I2c;
use embassy_stm32::time::Hertz;
use hyped_sensors::temperature::{Status, Temperature, TemperatureAddresses};

/// Test task that just reads the temperature from the sensor and prints it to the console
#[embassy_executor::task]
pub async fn read_temp() -> ! {
let p = embassy_stm32::init(Default::default());
let i2c = I2c::new_blocking(p.I2C1, p.PB8, p.PB9, Hertz(100_000), Default::default());
let hyped_i2c = Stm32l476rgI2c::new(i2c);

let mut temperature_sensor = Temperature::new(hyped_i2c, TemperatureAddresses::Address3f)
.expect(
"Failed to create temperature sensor. Check the wiring and the I2C address of the sensor.",
);

loop {
match temperature_sensor.check_status() {
Status::TempOverUpperLimit => {
defmt::error!("Temperature is over the upper limit.");
}
Status::TempUnderLowerLimit => {
defmt::error!("Temperature is under the lower limit.");
}
Status::Busy => {
defmt::warn!("Temperature sensor is busy.");
}
Status::Unknown => {
panic!("Could not get the status of the temperature sensor.")
}
Status::Ok => {}
}

match temperature_sensor.read() {
Some(temperature) => {
defmt::info!("Temperature: {:?}", temperature);
}
None => {
defmt::info!("Failed to read temperature.");
}
}
}
}

0 comments on commit 5df95b9

Please sign in to comment.