Skip to content

Commit

Permalink
AP_HAL: inline serial accessor function
Browse files Browse the repository at this point in the history
Saves a bit more flash.
  • Loading branch information
tpwrules committed Dec 10, 2023
1 parent b481cbc commit ea30dca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
9 changes: 0 additions & 9 deletions libraries/AP_HAL/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(uart_array)) {
return nullptr;
}
return uart_array[sernum];
}
9 changes: 9 additions & 0 deletions libraries/AP_HAL/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,12 @@ class AP_HAL::HAL {
#endif

};

// access serial ports using SERIALn numbering
inline AP_HAL::UARTDriver* AP_HAL::HAL::serial(uint8_t sernum) const
{
if (sernum >= ARRAY_SIZE(uart_array)) {
return nullptr;
}
return uart_array[sernum];
}

0 comments on commit ea30dca

Please sign in to comment.