1
0
Fork 0

Cleaner code to write liveness bit into process image

This commit is contained in:
rahix 2024-11-03 14:27:36 +01:00
parent 1ef275a520
commit f603fb633f
3 changed files with 10 additions and 9 deletions

4
Cargo.lock generated
View file

@ -304,9 +304,9 @@ dependencies = [
[[package]] [[package]]
name = "process-image" name = "process-image"
version = "0.2.0" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5af8362e66e347fba28d90c6569235402c7f1b7e41a4a67ed85ca29efade4b0" checksum = "1c1de5542ea7a8e8654e93e3d00b28c1f3318f95b0f270240685c9eeeb300986"
[[package]] [[package]]
name = "profirust" name = "profirust"

View file

@ -7,7 +7,7 @@ edition = "2021"
env_logger = "0.11.3" env_logger = "0.11.3"
linux-embedded-hal = { version = "0.4.0", default-features = false, features = ["i2c"] } linux-embedded-hal = { version = "0.4.0", default-features = false, features = ["i2c"] }
log = "0.4.21" log = "0.4.21"
process-image = "0.2.0" process-image = "0.2.1"
[dependencies.profirust] [dependencies.profirust]
# version = 0.2.0 # version = 0.2.0

View file

@ -181,12 +181,13 @@ fn fieldbus_task(fieldbus_data: Arc<Mutex<FieldbusInner>>) {
for peripheral_info in peripherals.iter() { for peripheral_info in peripherals.iter() {
let peripheral = dp_master.get_mut(peripheral_info.handle); let peripheral = dp_master.get_mut(peripheral_info.handle);
if peripheral.is_running() { {
data.pii[peripheral_info.liveness_bit.0] |= let mut liveness_bit = process_image::tag_mut!(
1 << peripheral_info.liveness_bit.1; &mut data.pii,
} else { peripheral_info.liveness_bit.0,
data.pii[peripheral_info.liveness_bit.0] &= peripheral_info.liveness_bit.1
!(1 << peripheral_info.liveness_bit.1); );
*liveness_bit = peripheral.is_running();
} }
if peripheral.is_running() { if peripheral.is_running() {