mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_ChibiOS: introduce get_HAL_mutable() to complement get_HAL()
Returns a mutable reference to the same HAL for certain purposes where the HAL needs to be mutated to avoid UB problems with casting away const and to make the fact that mutation is happening obvious.
This commit is contained in:
parent
dc76e03890
commit
a9ddadee3b
|
@ -344,8 +344,13 @@ void HAL_ChibiOS::run(int argc, char * const argv[], Callbacks* callbacks) const
|
||||||
main_loop();
|
main_loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HAL_ChibiOS hal_chibios;
|
||||||
|
|
||||||
const AP_HAL::HAL& AP_HAL::get_HAL() {
|
const AP_HAL::HAL& AP_HAL::get_HAL() {
|
||||||
static const HAL_ChibiOS hal_chibios;
|
return hal_chibios;
|
||||||
|
}
|
||||||
|
|
||||||
|
AP_HAL::HAL& AP_HAL::get_HAL_mutable() {
|
||||||
return hal_chibios;
|
return hal_chibios;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue