Prep support ESP32 enum SerialConfig

This commit is contained in:
Theo Arends 2023-04-02 14:20:03 +02:00
parent efa7ae492e
commit 326c605122
2 changed files with 15 additions and 15 deletions

View File

@ -129,7 +129,7 @@ uint32_t analogGetTimerFrequency(uint8_t timer);
#define os_delay_us ets_delay_us
// Serial minimal type to hold the config
typedef int SerConfu8;
typedef int SerialConfig;
//typedef int SerialConfig; // Will be replaced enum in esp32_hal-uart.h (#7926)
//
// UDP

View File

@ -3142,7 +3142,7 @@ next_line:
#endif // ESP32
SerialConfig smode = SERIAL_8N1;
uint32_t smode = SERIAL_8N1;
if (mp->sopt & 0xf0) {
// new serial config
@ -3178,14 +3178,14 @@ next_line:
mp->meter_ss->flush();
}
if (mp->meter_ss->hardwareSerial()) {
Serial.begin(mp->params, smode);
Serial.begin(mp->params, (SerialConfig)smode); // void HardwareSerial::begin(unsigned long baud, SerialConfig config, SerialMode mode, uint8_t tx_pin, bool invert)
ClaimSerial();
//Serial.setRxBufferSize(512);
}
#endif // ESP8266
#ifdef ESP32
mp->meter_ss->begin(mp->params, smode, mp->srcpin, mp->trxpin);
mp->meter_ss->begin(mp->params, smode, mp->srcpin, mp->trxpin); // void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert, unsigned long timeout_ms, uint8_t rxfifo_full_thrhd)
#ifdef USE_ESP32_SW_SERIAL
mp->meter_ss->setRxBufferSize(mp->sibsiz);
#endif
@ -3293,7 +3293,7 @@ uint32_t SML_Write(int32_t meter, char *hstr) {
hstr++;
// currently only 8 bits and ignore stopbits
hstr++;
SerialConfig smode;
uint32_t smode;
switch (*hstr) {
case 'N':
smode = SERIAL_8N1;
@ -3307,9 +3307,9 @@ uint32_t SML_Write(int32_t meter, char *hstr) {
}
#ifdef ESP8266
Serial.begin(baud, smode);
Serial.begin(baud, (SerialConfig)smode); // void HardwareSerial::begin(unsigned long baud, SerialConfig config, SerialMode mode, uint8_t tx_pin, bool invert)
#else
meter_desc[meter].meter_ss->begin(baud, smode, sml_globs.mp[meter].srcpin, sml_globs.mp[meter].trxpin);
meter_desc[meter].meter_ss->begin(baud, smode, sml_globs.mp[meter].srcpin, sml_globs.mp[meter].trxpin); // void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert, unsigned long timeout_ms, uint8_t rxfifo_full_thrhd)
#endif
}
return 1;