prepare for when UART PR#4465 is merged.
This commit is contained in:
parent
9ce5eb1f38
commit
b95c246c20
12
.github/workflows/main.yml
vendored
12
.github/workflows/main.yml
vendored
@ -26,14 +26,26 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- id: test
|
||||
file: tests/test.esp32_ard.uart.yaml
|
||||
name: Test tests/test.esp32_ard.uart.yaml
|
||||
pio_cache_key: test.esp32_ard.uart
|
||||
- id: test
|
||||
file: tests/test.esp32_ard.yaml
|
||||
name: Test tests/test.esp32_ard.yaml
|
||||
pio_cache_key: test.esp32_ard
|
||||
- id: test
|
||||
file: tests/test.esp32_idf.uart.yaml
|
||||
name: Test tests/test.esp32_idf.uart.yaml
|
||||
pio_cache_key: test.esp32_idf.uart
|
||||
- id: test
|
||||
file: tests/test.esp32_idf.yaml
|
||||
name: Test tests/test.esp32_idf.yaml
|
||||
pio_cache_key: test.esp32_idf
|
||||
- id: test
|
||||
file: tests/test.rp2040.uart.yaml
|
||||
name: Test tests/test.rp2040.uart.yaml
|
||||
pio_cache_key: test.rp2040.uart
|
||||
- id: test
|
||||
file: tests/test.rp2040.yaml
|
||||
name: Test tests/test.rp2040.yaml
|
||||
|
||||
@ -4,7 +4,12 @@
|
||||
#include "driver/uart.h"
|
||||
#include "soc/uart_struct.h"
|
||||
#include "soc/uart_reg.h"
|
||||
#ifdef CUSTOM_ESPHOME_UART
|
||||
#include "esphome/components/uart/truma_uart_component_esp32_arduino.h"
|
||||
#define ESPHOME_UART uart::truma_ESP32ArduinoUARTComponent
|
||||
#else
|
||||
#define ESPHOME_UART uart::ESP32ArduinoUARTComponent
|
||||
#endif // CUSTOM_ESPHOME_UART
|
||||
#include "esphome/components/uart/uart_component_esp32_arduino.h"
|
||||
|
||||
namespace esphome {
|
||||
@ -15,7 +20,7 @@ static const char *const TAG = "truma_inetbox.LinBusListener";
|
||||
#define QUEUE_WAIT_BLOCKING (portTickType) portMAX_DELAY
|
||||
|
||||
void LinBusListener::setup_framework() {
|
||||
auto uartComp = static_cast<esphome::uart::truma_ESP32ArduinoUARTComponent *>(this->parent_);
|
||||
auto uartComp = static_cast<ESPHOME_UART *>(this->parent_);
|
||||
|
||||
auto uart_num = uartComp->get_hw_serial_number();
|
||||
auto hw_serial = uartComp->get_hw_serial();
|
||||
@ -76,5 +81,6 @@ void LinBusListener::eventTask_(void *args) {
|
||||
} // namespace esphome
|
||||
|
||||
#undef QUEUE_WAIT_BLOCKING
|
||||
#undef ESPHOME_UART
|
||||
|
||||
#endif // USE_ESP32_FRAMEWORK_ARDUINO
|
||||
@ -2,7 +2,12 @@
|
||||
#include "LinBusListener.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "soc/uart_reg.h"
|
||||
#ifdef CUSTOM_ESPHOME_UART
|
||||
#include "esphome/components/uart/truma_uart_component_esp_idf.h"
|
||||
#define ESPHOME_UART uart::truma_IDFUARTComponent
|
||||
#else
|
||||
#define ESPHOME_UART uart::IDFUARTComponent
|
||||
#endif // CUSTOM_ESPHOME_UART
|
||||
#include "esphome/components/uart/uart_component_esp_idf.h"
|
||||
|
||||
namespace esphome {
|
||||
@ -14,7 +19,7 @@ static const char *const TAG = "truma_inetbox.LinBusListener";
|
||||
|
||||
void LinBusListener::setup_framework() {
|
||||
// uartSetFastReading
|
||||
auto uartComp = static_cast<uart::truma_IDFUARTComponent *>(this->parent_);
|
||||
auto uartComp = static_cast<ESPHOME_UART *>(this->parent_);
|
||||
|
||||
auto uart_num = uartComp->get_hw_serial_number();
|
||||
|
||||
@ -60,7 +65,7 @@ void LinBusListener::setup_framework() {
|
||||
|
||||
void LinBusListener::uartEventTask_(void *args) {
|
||||
LinBusListener *instance = (LinBusListener *) args;
|
||||
auto uartComp = static_cast<uart::truma_IDFUARTComponent *>(instance->parent_);
|
||||
auto uartComp = static_cast<ESPHOME_UART *>(instance->parent_);
|
||||
auto uart_num = uartComp->get_hw_serial_number();
|
||||
auto uartEventQueue = uartComp->get_uart_event_queue();
|
||||
uart_event_t event;
|
||||
@ -92,5 +97,6 @@ void LinBusListener::eventTask_(void *args) {
|
||||
} // namespace esphome
|
||||
|
||||
#undef QUEUE_WAIT_BLOCKING
|
||||
#undef ESPHOME_UART
|
||||
|
||||
#endif // USE_ESP32_FRAMEWORK_ESP_IDF
|
||||
@ -1,7 +1,12 @@
|
||||
#ifdef USE_RP2040
|
||||
#include "LinBusListener.h"
|
||||
#include "esphome/core/log.h"
|
||||
#ifdef CUSTOM_ESPHOME_UART
|
||||
#include "esphome/components/uart/truma_uart_component_rp2040.h"
|
||||
#define ESPHOME_UART uart::truma_RP2040UartComponent
|
||||
#else
|
||||
#define ESPHOME_UART uart::RP2040UartComponent
|
||||
#endif // CUSTOM_ESPHOME_UART
|
||||
#include "esphome/components/uart/uart_component_rp2040.h"
|
||||
#include <SerialUART.h>
|
||||
|
||||
@ -18,7 +23,7 @@ static const char *const TAG = "truma_inetbox.LinBusListener";
|
||||
#define QUEUE_WAIT_DONT_BLOCK (TickType_t) 0
|
||||
|
||||
void LinBusListener::setup_framework() {
|
||||
auto uartComp = static_cast<esphome::uart::truma_RP2040UartComponent *>(this->parent_);
|
||||
auto uartComp = static_cast<ESPHOME_UART *>(this->parent_);
|
||||
auto is_hw_serial = uartComp->is_hw_serial();
|
||||
if (!is_hw_serial) {
|
||||
ESP_LOGW(TAG, "Must use hardware serial SerialPIO is not supported.");
|
||||
@ -113,5 +118,6 @@ extern void loop1() {
|
||||
}
|
||||
|
||||
#undef QUEUE_WAIT_DONT_BLOCK
|
||||
#undef ESPHOME_UART
|
||||
|
||||
#endif // USE_RP2040
|
||||
|
||||
@ -216,6 +216,7 @@ async def to_code(config):
|
||||
cg.add_global(uart_ns.using)
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
await cg.register_component(var, config)
|
||||
cg.add_build_flag("-DCUSTOM_ESPHOME_UART");
|
||||
|
||||
cg.add(var.set_baud_rate(config[CONF_BAUD_RATE]))
|
||||
|
||||
|
||||
5
tests/.gitignore
vendored
Normal file
5
tests/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# Gitignore settings for ESPHome
|
||||
# This is an example and may include too much for your use-case.
|
||||
# You can modify this file to suit your needs.
|
||||
/.esphome/
|
||||
/secrets.yaml
|
||||
41
tests/test.esp32_ard.uart.yaml
Normal file
41
tests/test.esp32_ard.uart.yaml
Normal file
@ -0,0 +1,41 @@
|
||||
esphome:
|
||||
name: "esp32-ard-uart"
|
||||
|
||||
on_boot:
|
||||
then:
|
||||
# read time from external source (connected via I2C)
|
||||
- ds1307.read_time
|
||||
|
||||
external_components:
|
||||
# https://github.com/esphome/esphome/pull/4465
|
||||
- source: github://pr#4465
|
||||
components: [uart]
|
||||
- source:
|
||||
type: local
|
||||
path: ../components
|
||||
components: [truma_inetbox]
|
||||
|
||||
esp32:
|
||||
board: esp32dev
|
||||
framework:
|
||||
type: arduino
|
||||
|
||||
i2c:
|
||||
sda: 14
|
||||
scl: 27
|
||||
scan: false
|
||||
id: i2c_bus_a
|
||||
|
||||
time:
|
||||
- platform: ds1307
|
||||
update_interval: never
|
||||
id: esptime
|
||||
|
||||
uart: !include test.common.uart.yaml
|
||||
truma_inetbox: !include test.common.truma_inetbox.yaml
|
||||
binary_sensor: !include test.common.binary_sensor.yaml
|
||||
button: !include test.common.button.yaml
|
||||
climate: !include test.common.climate.yaml
|
||||
number: !include test.common.number.yaml
|
||||
sensor: !include test.common.sensor.yaml
|
||||
switch: !include test.common.switch.yaml
|
||||
41
tests/test.esp32_idf.uart.yaml
Normal file
41
tests/test.esp32_idf.uart.yaml
Normal file
@ -0,0 +1,41 @@
|
||||
esphome:
|
||||
name: "esp32-idf-uart"
|
||||
|
||||
on_boot:
|
||||
then:
|
||||
# read time from external source (connected via I2C)
|
||||
- ds1307.read_time
|
||||
|
||||
external_components:
|
||||
# https://github.com/esphome/esphome/pull/4465
|
||||
- source: github://pr#4465
|
||||
components: [uart]
|
||||
- source:
|
||||
type: local
|
||||
path: ../components
|
||||
components: [truma_inetbox]
|
||||
|
||||
esp32:
|
||||
board: esp32dev
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
i2c:
|
||||
sda: 14
|
||||
scl: 27
|
||||
scan: false
|
||||
id: i2c_bus_a
|
||||
|
||||
time:
|
||||
- platform: ds1307
|
||||
update_interval: never
|
||||
id: esptime
|
||||
|
||||
uart: !include test.common.uart.yaml
|
||||
truma_inetbox: !include test.common.truma_inetbox.yaml
|
||||
binary_sensor: !include test.common.binary_sensor.yaml
|
||||
button: !include test.common.button.yaml
|
||||
climate: !include test.common.climate.yaml
|
||||
number: !include test.common.number.yaml
|
||||
sensor: !include test.common.sensor.yaml
|
||||
switch: !include test.common.switch.yaml
|
||||
41
tests/test.rp2040.uart.yaml
Normal file
41
tests/test.rp2040.uart.yaml
Normal file
@ -0,0 +1,41 @@
|
||||
esphome:
|
||||
name: "rp2040-uart"
|
||||
|
||||
on_boot:
|
||||
then:
|
||||
# read time from external source (connected via I2C)
|
||||
- ds1307.read_time
|
||||
|
||||
external_components:
|
||||
# https://github.com/esphome/esphome/pull/4465
|
||||
- source: github://pr#4465
|
||||
components: [uart]
|
||||
- source:
|
||||
type: local
|
||||
path: ../components
|
||||
components: [truma_inetbox]
|
||||
|
||||
rp2040:
|
||||
board: rpipicow
|
||||
framework:
|
||||
platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git
|
||||
|
||||
i2c:
|
||||
sda: 14
|
||||
scl: 27
|
||||
scan: false
|
||||
id: i2c_bus_a
|
||||
|
||||
time:
|
||||
- platform: ds1307
|
||||
update_interval: never
|
||||
id: esptime
|
||||
|
||||
uart: !include test.common.uart.yaml
|
||||
truma_inetbox: !include test.common.truma_inetbox.yaml
|
||||
binary_sensor: !include test.common.binary_sensor.yaml
|
||||
button: !include test.common.button.yaml
|
||||
climate: !include test.common.climate.yaml
|
||||
number: !include test.common.number.yaml
|
||||
sensor: !include test.common.sensor.yaml
|
||||
switch: !include test.common.switch.yaml
|
||||
Loading…
x
Reference in New Issue
Block a user