TCP Tx En GPIO type (#21269)

This commit is contained in:
s-hadinger 2024-04-24 19:53:01 +02:00 committed by GitHub
parent 5a8d713d77
commit 91dd120aa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 106 additions and 6 deletions

View File

@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
## [13.4.1.2]
### Added
- esp32_partition_app3904k_fs3392k partition scheme for 8MB ESP32S3
- TCP Tx En GPIO type
### Breaking Changed
- ESP32-C3 OTA binary name from `tasmota32c3cdc.bin` to `tasmota32c3.bin` with USB HWCDC and fallback to serial (#21212)

View File

@ -40,6 +40,7 @@ class TasmotaSerial : public Stream {
TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fallback = 0, int nwmode = 0, int buffer_size = TM_SERIAL_BUFFER_SIZE, bool invert = false);
virtual ~TasmotaSerial();
void setTransmitEnablePin(int tx_enable_pin);
void clearTransmitEnablePin(void) { m_tx_enable_pin = -1; }
size_t setRxBufferSize(size_t size);
size_t getRxBufferSize() { return serial_buffer_size; }

View File

@ -9,6 +9,7 @@
#include "esp_arduino_version.h"
extern int b_serial_init(bvm *vm);
extern int b_config_tx_en(bvm *vm);
extern int b_serial_deinit(bvm *vm);
extern int b_serial_write(bvm *vm);
@ -83,6 +84,7 @@ class be_class_serial (scope: global, name: serial) {
SERIAL_8O2, int(SERIAL_8O2)
init, func(b_serial_init)
config_tx_en, func(b_config_tx_en)
deinit, func(b_serial_deinit)
close, func(b_serial_deinit)

View File

@ -1,5 +1,9 @@
/********************************************************************
* Generated code, don't edit
*
* The keys in the array belox must be in lexicographic order
*
* Generated by: `python3 gpio_convert.py`
*******************************************************************/
const be_const_member_t lv_gpio_constants[] = {
@ -143,6 +147,15 @@ const be_const_member_t lv_gpio_constants[] = {
{ "LEDLNK", (int32_t) GPIO_LEDLNK },
{ "LEDLNK_INV", (int32_t) GPIO_LEDLNK_INV },
{ "LMT01", (int32_t) GPIO_LMT01 },
{ "LORA_BUSY", (int32_t) GPIO_LORA_BUSY },
{ "LORA_CS", (int32_t) GPIO_LORA_CS },
{ "LORA_DI0", (int32_t) GPIO_LORA_DI0 },
{ "LORA_DI1", (int32_t) GPIO_LORA_DI1 },
{ "LORA_DI2", (int32_t) GPIO_LORA_DI2 },
{ "LORA_DI3", (int32_t) GPIO_LORA_DI3 },
{ "LORA_DI4", (int32_t) GPIO_LORA_DI4 },
{ "LORA_DI5", (int32_t) GPIO_LORA_DI5 },
{ "LORA_RST", (int32_t) GPIO_LORA_RST },
{ "LOW", LOW },
{ "LOX_O2_RX", (int32_t) GPIO_LOX_O2_RX },
{ "MAGIC_SWITCH", (int32_t) GPIO_MAGIC_SWITCH },
@ -191,6 +204,8 @@ const be_const_member_t lv_gpio_constants[] = {
{ "OUTPUT_OPEN_DRAIN", OUTPUT_OPEN_DRAIN },
{ "P9813_CLK", (int32_t) GPIO_P9813_CLK },
{ "P9813_DAT", (int32_t) GPIO_P9813_DAT },
{ "PIPSOLAR_RX", (int32_t) GPIO_PIPSOLAR_RX },
{ "PIPSOLAR_TX", (int32_t) GPIO_PIPSOLAR_TX },
{ "PMS5003_RX", (int32_t) GPIO_PMS5003_RX },
{ "PMS5003_TX", (int32_t) GPIO_PMS5003_TX },
{ "PN532_RXD", (int32_t) GPIO_PN532_RXD },
@ -218,6 +233,9 @@ const be_const_member_t lv_gpio_constants[] = {
{ "RFSEND", (int32_t) GPIO_RFSEND },
{ "RF_SENSOR", (int32_t) GPIO_RF_SENSOR },
{ "RISING", RISING },
{ "RN2XX3_RST", (int32_t) GPIO_RN2XX3_RST },
{ "RN2XX3_RX", (int32_t) GPIO_RN2XX3_RX },
{ "RN2XX3_TX", (int32_t) GPIO_RN2XX3_TX },
{ "ROT1A", (int32_t) GPIO_ROT1A },
{ "ROT1A_NP", (int32_t) GPIO_ROT1A_NP },
{ "ROT1B", (int32_t) GPIO_ROT1B },
@ -290,6 +308,7 @@ const be_const_member_t lv_gpio_constants[] = {
{ "TASMOTACLIENT_TXD", (int32_t) GPIO_TASMOTACLIENT_TXD },
{ "TCP_RX", (int32_t) GPIO_TCP_RX },
{ "TCP_TX", (int32_t) GPIO_TCP_TX },
{ "TCP_TX_EN", (int32_t) GPIO_TCP_TX_EN },
{ "TELEINFO_ENABLE", (int32_t) GPIO_TELEINFO_ENABLE },
{ "TELEINFO_RX", (int32_t) GPIO_TELEINFO_RX },
{ "TFMINIPLUS_RX", (int32_t) GPIO_TFMINIPLUS_RX },
@ -303,6 +322,9 @@ const be_const_member_t lv_gpio_constants[] = {
{ "TM1638CLK", (int32_t) GPIO_TM1638CLK },
{ "TM1638DIO", (int32_t) GPIO_TM1638DIO },
{ "TM1638STB", (int32_t) GPIO_TM1638STB },
{ "TS_IRQ", (int32_t) GPIO_TS_IRQ },
{ "TS_RST", (int32_t) GPIO_TS_RST },
{ "TS_SPI_CS", (int32_t) GPIO_TS_SPI_CS },
{ "TUYAMCUBR_RX", (int32_t) GPIO_TUYAMCUBR_RX },
{ "TUYAMCUBR_TX", (int32_t) GPIO_TUYAMCUBR_TX },
{ "TUYA_RX", (int32_t) GPIO_TUYA_RX },
@ -334,8 +356,6 @@ const be_const_member_t lv_gpio_constants[] = {
{ "ZIGBEE_RST", (int32_t) GPIO_ZIGBEE_RST },
{ "ZIGBEE_RX", (int32_t) GPIO_ZIGBEE_RX },
{ "ZIGBEE_TX", (int32_t) GPIO_ZIGBEE_TX },
{ "PIPSOLAR_RX", (int32_t) GPIO_PIPSOLAR_RX },
{ "PIPSOLAR_TX", (int32_t) GPIO_PIPSOLAR_TX },
};

View File

@ -219,6 +219,7 @@ enum UserSelectablePins {
GPIO_LORA_CS, GPIO_LORA_RST, GPIO_LORA_BUSY, GPIO_LORA_DI0, GPIO_LORA_DI1, GPIO_LORA_DI2, GPIO_LORA_DI3, GPIO_LORA_DI4, GPIO_LORA_DI5, // LoRa SPI
GPIO_TS_SPI_CS, GPIO_TS_RST, GPIO_TS_IRQ, // SPI for Universal Touch Screen
GPIO_RN2XX3_TX, GPIO_RN2XX3_RX, GPIO_RN2XX3_RST, // RN2XX3 LoRaWan node Serial interface
GPIO_TCP_TX_EN, // TCP to serial bridge, EN pin
GPIO_SENSOR_END };
// Error as warning to rethink GPIO usage with max 2045
@ -485,6 +486,7 @@ const char kSensorNames[] PROGMEM =
D_GPIO_LORA_CS "|" D_GPIO_LORA_RST "|" D_GPIO_LORA_BUSY "|" D_GPIO_LORA_DI "0|" D_GPIO_LORA_DI "1|" D_GPIO_LORA_DI "2|" D_GPIO_LORA_DI "3|" D_GPIO_LORA_DI "4|" D_GPIO_LORA_DI "5|"
D_GPIO_TS_SPI_CS "|" D_GPIO_TS_RST "|" D_GPIO_TS_IRQ "|"
D_GPIO_RN2XX3_TX "|" D_GPIO_RN2XX3_RX "|" D_GPIO_RN2XX3_RST "|"
D_SENSOR_TCP_TXD_EN "|"
;
const char kSensorNamesFixed[] PROGMEM =
@ -983,6 +985,7 @@ const uint16_t kGpioNiceList[] PROGMEM = {
#ifdef USE_TCP_BRIDGE
AGPIO(GPIO_TCP_TX), // TCP Serial bridge
AGPIO(GPIO_TCP_RX), // TCP Serial bridge
AGPIO(GPIO_TCP_TX_EN), // TCP Serial bridge EN
#endif
#ifdef USE_ZIGBEE
AGPIO(GPIO_ZIGBEE_TX), // Zigbee Serial interface

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 Tx"
#define D_SENSOR_IEM3000_RX "iEM3000 Rx"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH - MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH - MDIO"
#define D_SENSOR_TCP_TXD "TCP - TX"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP - RX"
#define D_SENSOR_IEM3000_TX "iEM3000 - TX"
#define D_SENSOR_IEM3000_RX "iEM3000 - RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -909,6 +909,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -908,6 +908,7 @@
#define D_SENSOR_ETH_PHY_MDC "ETH MDC"
#define D_SENSOR_ETH_PHY_MDIO "ETH MDIO"
#define D_SENSOR_TCP_TXD "TCP Tx"
#define D_SENSOR_TCP_TXD_EN "TCP Tx En"
#define D_SENSOR_TCP_RXD "TCP Rx"
#define D_SENSOR_IEM3000_TX "iEM3000 TX"
#define D_SENSOR_IEM3000_RX "iEM3000 RX"

View File

@ -151,6 +151,10 @@ void TCPInit(void) {
}
TCPSerial = new TasmotaSerial(Pin(GPIO_TCP_RX), Pin(GPIO_TCP_TX), TasmotaGlobal.seriallog_level ? 1 : 2, 0, TCP_BRIDGE_BUF_SIZE); // set a receive buffer of 256 bytes
tcp_serial = TCPSerial->begin(Settings->tcp_baudrate * 1200, ConvertSerialConfig(0x7F & Settings->tcp_config));
if (PinUsed(GPIO_TCP_TX_EN)) {
TCPSerial->setTransmitEnablePin(Pin(GPIO_TCP_TX_EN));
AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_TCP "TCP Bridge EN is used on Pin %d"), Pin(GPIO_TCP_TX_EN));
}
if (tcp_serial) {
if (TCPSerial->hardwareSerial()) {
ClaimSerial();

View File

@ -70,6 +70,22 @@ extern "C" {
be_raise(vm, kTypeError, nullptr);
}
// Berry: `config_tx_en(tx_en_gpio:int) -> nil`
int32_t b_config_tx_en(struct bvm *vm);
int32_t b_config_tx_en(struct bvm *vm) {
be_getmember(vm, 1, ".p");
TasmotaSerial * ser = (TasmotaSerial *) be_tocomptr(vm, -1);
if (ser) {
int32_t tx_en = be_toint(vm, 2);
if (tx_en >= 0) {
ser->setTransmitEnablePin(tx_en);
} else {
ser->clearTransmitEnablePin();
}
}
be_return_nil(vm);
}
// Berry: `deinit(void)`
int32_t b_serial_deinit(struct bvm *vm);
int32_t b_serial_deinit(struct bvm *vm) {

View File

@ -22,9 +22,9 @@ with open(lv_module_file) as f:
l_raw = l_raw.strip(" \t\n\r") # remove leading or trailing spaces
if l_raw.startswith("//"):
lv_module.append( [ None, l_raw ] ) # if key in None then add comment line
l_raw = re.sub('//.*$', '', l_raw) # remove trailing comments
l_raw = re.sub('\s+', '', l_raw) # remove all spaces
l_raw = re.sub(',.*$', '', l_raw) # remove comma and anything after it
l_raw = re.sub(r'//.*$', '', l_raw) # remove trailing comments
l_raw = re.sub(r'\s+', '', l_raw) # remove all spaces
l_raw = re.sub(r',.*$', '', l_raw) # remove comma and anything after it
if (len(l_raw) == 0): continue
k_v = l_raw.split("=")
@ -35,7 +35,7 @@ with open(lv_module_file) as f:
k = k_v[0]
if k.startswith("_"):
continue # skip any label starting with '_'
k = re.sub('^LV_', '', k) # remove remove any LV_ prefix
k = re.sub(r'^LV_', '', k) # remove remove any LV_ prefix
v = None
if len(k_v) == 2: # value is included
v = k_v[1]
@ -53,6 +53,10 @@ with open(lv_module_file) as f:
sys.stdout = open(out_prefix + be_gpio_defines, 'w')
print("/********************************************************************")
print(" * Generated code, don't edit")
print(" * ")
print(" * The keys in the array belox must be in lexicographic order")
print(" * ")
print(" * Generated by: `python3 gpio_convert.py`")
print(" *******************************************************************/")
print("""

View File

@ -1,4 +1,6 @@
// Enum values for GPIOs
// This is manually updated to have an appropriate name in Berry
// Convert using `python3 gpio_convert.py`
LOW
HIGH
@ -199,6 +201,7 @@ KEY1_TC = GPIO_KEY1_TC
BL0940_RX = GPIO_BL0940_RX
TCP_TX = GPIO_TCP_TX
TCP_RX = GPIO_TCP_RX
TCP_TX_EN = GPIO_TCP_TX_EN
ETH_PHY_POWER = GPIO_ETH_PHY_POWER
ETH_PHY_MDC = GPIO_ETH_PHY_MDC
ETH_PHY_MDIO = GPIO_ETH_PHY_MDIO
@ -344,4 +347,23 @@ MAGIC_SWITCH = GPIO_MAGIC_SWITCH
PIPSOLAR_TX = GPIO_PIPSOLAR_TX
PIPSOLAR_RX = GPIO_PIPSOLAR_RX
LORA_CS = GPIO_LORA_CS
LORA_RST = GPIO_LORA_RST
LORA_BUSY = GPIO_LORA_BUSY
LORA_DI0 = GPIO_LORA_DI0
LORA_DI1 = GPIO_LORA_DI1
LORA_DI2 = GPIO_LORA_DI2
LORA_DI3 = GPIO_LORA_DI3
LORA_DI4 = GPIO_LORA_DI4
LORA_DI5 = GPIO_LORA_DI5
TS_SPI_CS = GPIO_TS_SPI_CS
TS_RST = GPIO_TS_RST
TS_IRQ = GPIO_TS_IRQ
RN2XX3_TX = GPIO_RN2XX3_TX
RN2XX3_RX = GPIO_RN2XX3_RX
RN2XX3_RST = GPIO_RN2XX3_RST
SENSOR_END = GPIO_SENSOR_END