AP_HAL: inline serial accessor function

Saves a bit more flash.
This commit is contained in:
Thomas Watson 2023-11-20 20:20:07 -06:00 committed by Andrew Tridgell
parent 8747ae539f
commit 6a6c3ce7a1
2 changed files with 9 additions and 9 deletions

View File

@ -11,12 +11,3 @@ HAL::FunCallbacks::FunCallbacks(void (*setup_fun)(void), void (*loop_fun)(void))
}
}
// access serial ports using SERIALn numbering
AP_HAL::UARTDriver* AP_HAL::HAL::serial(uint8_t sernum) const
{
if (sernum >= ARRAY_SIZE(serial_array)) {
return nullptr;
}
return serial_array[sernum];
}

View File

@ -155,3 +155,12 @@ public:
#endif
};
// access serial ports using SERIALn numbering
inline AP_HAL::UARTDriver* AP_HAL::HAL::serial(uint8_t sernum) const
{
if (sernum >= ARRAY_SIZE(serial_array)) {
return nullptr;
}
return serial_array[sernum];
}