mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-26 09:43:57 -04:00
HAL_SITL: notify GCS on GPIO changes
useful for testing relays in SITL
This commit is contained in:
parent
fd0f31dc44
commit
d7faeada87
@ -32,12 +32,15 @@ void GPIO::write(uint8_t pin, uint8_t value)
|
||||
return;
|
||||
}
|
||||
uint8_t mask = sitlState->_sitl->pin_mask.get();
|
||||
uint8_t new_mask = mask;
|
||||
if (value) {
|
||||
mask |= (1U<<pin);
|
||||
new_mask |= (1U<<pin);
|
||||
} else {
|
||||
mask &= ~(1U<<pin);
|
||||
new_mask &= ~(1U<<pin);
|
||||
}
|
||||
if (mask != new_mask) {
|
||||
sitlState->_sitl->pin_mask.set_and_notify(new_mask);
|
||||
}
|
||||
sitlState->_sitl->pin_mask.set(mask);
|
||||
}
|
||||
|
||||
void GPIO::toggle(uint8_t pin)
|
||||
|
Loading…
Reference in New Issue
Block a user