Cleaner code to write liveness bit into process image
This commit is contained in:
parent
1ef275a520
commit
f603fb633f
3 changed files with 10 additions and 9 deletions
|
|
@ -181,12 +181,13 @@ fn fieldbus_task(fieldbus_data: Arc<Mutex<FieldbusInner>>) {
|
|||
for peripheral_info in peripherals.iter() {
|
||||
let peripheral = dp_master.get_mut(peripheral_info.handle);
|
||||
|
||||
if peripheral.is_running() {
|
||||
data.pii[peripheral_info.liveness_bit.0] |=
|
||||
1 << peripheral_info.liveness_bit.1;
|
||||
} else {
|
||||
data.pii[peripheral_info.liveness_bit.0] &=
|
||||
!(1 << peripheral_info.liveness_bit.1);
|
||||
{
|
||||
let mut liveness_bit = process_image::tag_mut!(
|
||||
&mut data.pii,
|
||||
peripheral_info.liveness_bit.0,
|
||||
peripheral_info.liveness_bit.1
|
||||
);
|
||||
*liveness_bit = peripheral.is_running();
|
||||
}
|
||||
|
||||
if peripheral.is_running() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue