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 Nov 21, 2023
1 parent c0fdc6b commit 4f3ef57
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(num_serial)) {
return nullptr;
}
return uart_array[sernum];
}

0 comments on commit 4f3ef57

Please sign in to comment.