mirror of https://github.com/ArduPilot/ardupilot
AP_HAL_ESP32: 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
a9ddadee3b
commit
2dbf5aefb3
|
@ -56,8 +56,14 @@ uint64_t millis64()
|
||||||
|
|
||||||
} // namespace AP_HAL
|
} // namespace AP_HAL
|
||||||
|
|
||||||
|
static HAL_ESP32 hal_esp32;
|
||||||
|
|
||||||
const AP_HAL::HAL& AP_HAL::get_HAL()
|
const AP_HAL::HAL& AP_HAL::get_HAL()
|
||||||
{
|
{
|
||||||
static const HAL_ESP32 hal;
|
return hal_esp32;
|
||||||
return hal;
|
}
|
||||||
|
|
||||||
|
AP_HAL::HAL& AP_HAL::get_HAL_mutable()
|
||||||
|
{
|
||||||
|
return hal_esp32;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue