Skip to content
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: add control options to UART driver #28721

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
AP_HAL_ESP32: UARTDriver: rename UARTDesc to SerialDef
Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
  • Loading branch information
srmainwaring committed Nov 24, 2024
commit 904eac5be79b516b77a1644d8b3431fd2ee884ce
2 changes: 1 addition & 1 deletion libraries/AP_HAL_ESP32/UARTDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extern int ets_printf(const char* format, ...); //for ets_printf in rom
using namespace ESP32;


const UARTDriver::UARTDesc UARTDriver::_serial_tab[] = {HAL_ESP32_UART_DEVICES};
const UARTDriver::SerialDef UARTDriver::_serial_tab[] = {HAL_ESP32_UART_DEVICES};

// table to find UARTDrivers from serial number, used for event handling
UARTDriver *UARTDriver::serial_drivers[UART_MAX_DRIVERS];
Expand Down
10 changes: 3 additions & 7 deletions libraries/AP_HAL_ESP32/UARTDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ class ESP32::UARTDriver : public AP_HAL::UARTDriver
// return uint8_t(this - &_serial_tab[0]);
// }
// };

struct UARTDesc {
struct SerialDef {
uart_port_t port;
gpio_num_t rx;
gpio_num_t tx;
Expand Down Expand Up @@ -117,7 +116,7 @@ class ESP32::UARTDriver : public AP_HAL::UARTDriver
void vprintf(const char *fmt, va_list ap) override;

private:
const UARTDesc &sdef;
const SerialDef &sdef;

bool _initialized;
const size_t TX_BUF_SIZE = 1024;
Expand All @@ -139,10 +138,7 @@ class ESP32::UARTDriver : public AP_HAL::UARTDriver

uint32_t _baudrate;

// unused stuff from chibios - do we want it in the future?
//const SerialDef &sdef;
//static const SerialDef _serial_tab[];
static const UARTDesc _serial_tab[];
static const SerialDef _serial_tab[];

// timestamp for receiving data on the UART, avoiding a lock
uint64_t _receive_timestamp[2];
Expand Down