Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leveraging shared_bus over custom mutex #228

Merged
merged 2 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Settings are backwards compatible with previous Booster releases.
* Fan speed is now stored in EEPROM and configurable via the serial interface.

### Changed
* Removed custom `mutex` implementation in favor of leveraging `shared-bus`

### Fixed
* A few dependencies were deprecated because changes landed upstream. These dependencies were
corrected to point upstream.
Expand Down
5 changes: 2 additions & 3 deletions src/hardware/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pub mod chassis_fans;
pub mod delay;
pub mod external_mac;
pub mod metadata;
mod mutex;
pub mod net_interface;
pub mod platform;
pub mod rf_channel;
Expand Down Expand Up @@ -69,8 +68,8 @@ pub type NetworkManager = external_mac::Manager<'static, ExternalMac>;
pub type NetworkStack =
smoltcp_nal::NetworkStack<'static, external_mac::SmoltcpDevice<'static>, SystemTimer>;

pub type I2cBusManager = mutex::AtomicCheckManager<I2C>;
pub type I2cProxy = shared_bus::I2cProxy<'static, mutex::AtomicCheckMutex<I2C>>;
pub type I2cBusManager = shared_bus::BusManagerAtomicCheck<I2C>;
pub type I2cProxy = shared_bus::I2cProxy<'static, shared_bus::AtomicCheckMutex<I2C>>;
pub type I2cError = hal::i2c::Error;

pub type UsbBus = hal::otg_fs::UsbBus<hal::otg_fs::USB>;
Expand Down
52 changes: 0 additions & 52 deletions src/hardware/mutex.rs

This file was deleted.

4 changes: 2 additions & 2 deletions src/hardware/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use super::{
HardwareVersion, NetworkManager, NetworkStack, SystemTimer, Systick, UsbBus, CPU_FREQ, I2C,
};

use crate::{new_atomic_check_manager, settings::BoosterSettings};
use crate::settings::BoosterSettings;

use stm32f4xx_hal as hal;

Expand Down Expand Up @@ -189,7 +189,7 @@ pub fn setup(
hal::i2c::I2c::i2c1(i2c_peripheral, (scl, sda), 100.khz(), clocks)
};

new_atomic_check_manager!(I2C = i2c).unwrap()
shared_bus::new_atomic_check!(I2C = i2c).unwrap()
};

// Instantiate the I2C interface to the I2C mux. Use a shared-bus so we can share the I2C
Expand Down