UART refactored (#236)
`Uart` is now an abstract class with a `UartEsp` and a `UartPosix` implementation.
This commit is contained in:
committed by
GitHub
parent
de46401d85
commit
b85ef7a2e7
@@ -95,10 +95,8 @@ extern const Configuration crowpanel_advance_28 = {
|
||||
.uart {
|
||||
// "UART0-IN"
|
||||
uart::Configuration {
|
||||
.name = "UART0",
|
||||
.port = UART_NUM_1,
|
||||
.initMode = uart::InitMode::Disabled, // Manual init
|
||||
.canReinit = true,
|
||||
.hasMutableConfiguration = false,
|
||||
.rxPin = GPIO_NUM_44,
|
||||
.txPin = GPIO_NUM_43,
|
||||
.rtsPin = GPIO_NUM_NC,
|
||||
@@ -121,10 +119,8 @@ extern const Configuration crowpanel_advance_28 = {
|
||||
},
|
||||
// "UART1-OUT"
|
||||
uart::Configuration {
|
||||
.port = UART_NUM_1,
|
||||
.initMode = uart::InitMode::Disabled, // Manual init
|
||||
.canReinit = true,
|
||||
.hasMutableConfiguration = false,
|
||||
.name = "UART1",
|
||||
.port = UART_NUM_2,
|
||||
.rxPin = GPIO_NUM_18,
|
||||
.txPin = GPIO_NUM_17,
|
||||
.rtsPin = GPIO_NUM_NC,
|
||||
|
||||
@@ -95,10 +95,8 @@ extern const Configuration crowpanel_advance_35 = {
|
||||
.uart {
|
||||
// "UART0-IN"
|
||||
uart::Configuration {
|
||||
.name = "UART0",
|
||||
.port = UART_NUM_1,
|
||||
.initMode = uart::InitMode::Disabled, // Manual init
|
||||
.canReinit = true,
|
||||
.hasMutableConfiguration = false,
|
||||
.rxPin = GPIO_NUM_44,
|
||||
.txPin = GPIO_NUM_43,
|
||||
.rtsPin = GPIO_NUM_NC,
|
||||
@@ -121,10 +119,8 @@ extern const Configuration crowpanel_advance_35 = {
|
||||
},
|
||||
// "UART1-OUT"
|
||||
uart::Configuration {
|
||||
.port = UART_NUM_1,
|
||||
.initMode = uart::InitMode::Disabled, // Manual init
|
||||
.canReinit = true,
|
||||
.hasMutableConfiguration = false,
|
||||
.name = "UART1",
|
||||
.port = UART_NUM_2,
|
||||
.rxPin = GPIO_NUM_18,
|
||||
.txPin = GPIO_NUM_17,
|
||||
.rtsPin = GPIO_NUM_NC,
|
||||
|
||||
@@ -97,10 +97,8 @@ extern const Configuration crowpanel_basic_28 = {
|
||||
.uart {
|
||||
// "UART1"
|
||||
uart::Configuration {
|
||||
.name = "UART1",
|
||||
.port = UART_NUM_1,
|
||||
.initMode = uart::InitMode::Disabled, // Manual init
|
||||
.canReinit = true,
|
||||
.hasMutableConfiguration = false,
|
||||
.rxPin = GPIO_NUM_16,
|
||||
.txPin = GPIO_NUM_17,
|
||||
.rtsPin = GPIO_NUM_NC,
|
||||
|
||||
@@ -97,10 +97,8 @@ extern const Configuration crowpanel_basic_35 = {
|
||||
.uart {
|
||||
// "UART1"
|
||||
uart::Configuration {
|
||||
.name = "UART1",
|
||||
.port = UART_NUM_1,
|
||||
.initMode = uart::InitMode::Disabled, // Manual init
|
||||
.canReinit = true,
|
||||
.hasMutableConfiguration = false,
|
||||
.rxPin = GPIO_NUM_3,
|
||||
.txPin = GPIO_NUM_1,
|
||||
.rtsPin = GPIO_NUM_NC,
|
||||
|
||||
@@ -85,10 +85,8 @@ extern const Configuration lilygo_tdeck = {
|
||||
},
|
||||
.uart {
|
||||
uart::Configuration {
|
||||
.name = "Grove",
|
||||
.port = UART_NUM_1,
|
||||
.initMode = uart::InitMode::Disabled, // Let GPS driver control this interface
|
||||
.canReinit = true,
|
||||
.hasMutableConfiguration = false,
|
||||
.rxPin = GPIO_NUM_44,
|
||||
.txPin = GPIO_NUM_43,
|
||||
.rtsPin = GPIO_NUM_NC,
|
||||
@@ -113,7 +111,7 @@ extern const Configuration lilygo_tdeck = {
|
||||
.gps = {
|
||||
gps::GpsDevice::Configuration {
|
||||
.name = "Internal",
|
||||
.uartPort = UART_NUM_1,
|
||||
.uartName = "Grove",
|
||||
.baudRate = 38400,
|
||||
.model = gps::GpsModel::UBLOX10
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#define TAG "hardware"
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static bool initBoot() {
|
||||
lv_init();
|
||||
lvgl_task_start();
|
||||
@@ -26,17 +28,17 @@ TT_UNUSED static void deinitPower() {
|
||||
#endif
|
||||
}
|
||||
|
||||
extern const tt::hal::Configuration hardware = {
|
||||
extern const Configuration hardware = {
|
||||
.initBoot = initBoot,
|
||||
.createDisplay = createDisplay,
|
||||
.createKeyboard = createKeyboard,
|
||||
.sdcard = std::make_shared<SimulatorSdCard>(),
|
||||
.power = simulatorPower,
|
||||
.i2c = {
|
||||
tt::hal::i2c::Configuration {
|
||||
i2c::Configuration {
|
||||
.name = "Internal",
|
||||
.port = I2C_NUM_0,
|
||||
.initMode = tt::hal::i2c::InitMode::ByTactility,
|
||||
.initMode = i2c::InitMode::ByTactility,
|
||||
.canReinit = false,
|
||||
.hasMutableConfiguration = false,
|
||||
.config = (i2c_config_t) {
|
||||
@@ -51,15 +53,15 @@ extern const tt::hal::Configuration hardware = {
|
||||
.clk_flags = 0
|
||||
}
|
||||
},
|
||||
tt::hal::i2c::Configuration {
|
||||
i2c::Configuration {
|
||||
.name = "External",
|
||||
.port = I2C_NUM_1,
|
||||
.initMode = tt::hal::i2c::InitMode::ByTactility,
|
||||
.initMode = i2c::InitMode::ByTactility,
|
||||
.canReinit = true,
|
||||
.hasMutableConfiguration = true,
|
||||
.config = (i2c_config_t) {
|
||||
.mode = I2C_MODE_MASTER,
|
||||
.sda_io_num = 1,
|
||||
.sda_io_num = 3,
|
||||
.scl_io_num = 2,
|
||||
.sda_pullup_en = false,
|
||||
.scl_pullup_en = false,
|
||||
@@ -69,5 +71,23 @@ extern const tt::hal::Configuration hardware = {
|
||||
.clk_flags = 0
|
||||
}
|
||||
}
|
||||
},
|
||||
.uart = {
|
||||
uart::Configuration {
|
||||
.name = "/dev/ttyUSB0",
|
||||
.baudRate = 115200
|
||||
},
|
||||
uart::Configuration {
|
||||
.name = "/dev/ttyACM0",
|
||||
.baudRate = 115200
|
||||
}
|
||||
},
|
||||
.gps = {
|
||||
gps::GpsDevice::Configuration {
|
||||
.name = "Internal",
|
||||
.uartName = "/dev/ttyACM0",
|
||||
.baudRate = 115200,
|
||||
.model = gps::GpsModel::UBLOX10
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user