-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AP_HAL_ESP32: UART driver tweaks and making closer in shape to chibios #28717
AP_HAL_ESP32: UART driver tweaks and making closer in shape to chibios #28717
Conversation
I don't get this, nobody ever uses I'm also realizing now that the ESP32 HAL has the serial ports mis-numbered, we need to kill that before it becomes a whole thing like on STM32... |
libraries/AP_HAL_ESP32/UARTDriver.h
Outdated
HAL_Semaphore _sem; | ||
|
||
// table to find UARTDrivers from serial number, used for event handling | ||
static UARTDriver *uart_drivers[UART_MAX_DRIVERS]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change name to serial_drivers
to align with chibiOS UARTDriver.
Changed in: 169e164
I think the aim here is to begin aligning the esp32 UART driver with the one for chibiOS. In the latter case the equivalent of
This being |
- Use underscore prefix for private member variables. - Replace all instances of uart_num with _serial_num. - Rename table uart_drivers to serial_drivers. - Only override the protected member _begin(). - Comment console debug print in _begin(). Signed-off-by: Rhys Mainwaring <[email protected]>
ab6465c
to
169e164
Compare
Okay, let's add that table in whichever PR we add a
I did a big PR last year (#25589) to fix all of this up for ChibiOS and other HALs, I will review my notes and decide what we need to do for ESP32. I had noted that I needed to come back to it but I didn't have hardware at the time. That PR is also how a lot of the guts of the ChibiOS driver got renamed to I don't think this PR gets us anything at the moment. The semaphore in |
re: "ESP32 HAL has the serial ports mis-numbered, we need to kill that before it becomes a whole thing like on STM32."
re esp32 variable/function/class naming conventions...
the specific's of this PR is/was about the uarts becoming a "list" and having an index into them, and isnt necessarily perfect by any stretch, but it was adequate at the time - if you want to cleanup/re-work/whatever thats fine too. |
Break out 9e0ada6 from @davidbuzz's larger PR #28514 and apply fixes.
Testing
Tested on
esp32empty
. The console print inUARTDriver::_begin
is suppressed because the message is displayed repeatedly forUART1 = SERIAL3
(default params set SERIAL3_PROTOCOL = 5 (GPS), which is not available).