mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
fix txmode 1 for ESP8266 UART
This commit is contained in:
@@ -320,12 +320,11 @@ EMSUART_STATUS ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EMSUART_STATUS result = EMS_TX_STATUS_OK;
|
|
||||||
|
|
||||||
// disable rx interrupt
|
// disable rx interrupt
|
||||||
// clear Rx status register, resetting the Rx FIFO and flush it
|
// clear Rx status register, resetting the Rx FIFO and flush it
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
// ETS_UART_INTR_DISABLE();
|
// ETS_UART_INTR_DISABLE();
|
||||||
|
// USC0(EMSUART_UART) |= (1 << UCRXRST); // reset uart rx fifo
|
||||||
emsuart_flush_fifos();
|
emsuart_flush_fifos();
|
||||||
|
|
||||||
// send the bytes along the serial line
|
// send the bytes along the serial line
|
||||||
@@ -354,7 +353,6 @@ EMSUART_STATUS ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
|
|||||||
// on Rx-BRK (bus collision), we simply enable Rx and leave it
|
// on Rx-BRK (bus collision), we simply enable Rx and leave it
|
||||||
// otherwise we send the final Tx-BRK in the loopback and re=enable Rx-INT.
|
// otherwise we send the final Tx-BRK in the loopback and re=enable Rx-INT.
|
||||||
// worst case, we'll see an additional Rx-BRK...
|
// worst case, we'll see an additional Rx-BRK...
|
||||||
if (result == EMS_TX_STATUS_OK) {
|
|
||||||
// neither bus collision nor timeout - send terminating BRK signal
|
// neither bus collision nor timeout - send terminating BRK signal
|
||||||
if (!(USIS(EMSUART_UART) & (1 << UIBD))) {
|
if (!(USIS(EMSUART_UART) & (1 << UIBD))) {
|
||||||
// no bus collision - send terminating BRK signal
|
// no bus collision - send terminating BRK signal
|
||||||
@@ -369,12 +367,11 @@ EMSUART_STATUS ICACHE_FLASH_ATTR EMSuart::transmit(uint8_t * buf, uint8_t len) {
|
|||||||
USIC(EMSUART_UART) = (1 << UIBD); // clear BRK detect IRQ
|
USIC(EMSUART_UART) = (1 << UIBD); // clear BRK detect IRQ
|
||||||
phantomBreak = 1;
|
phantomBreak = 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
interrupts();
|
interrupts();
|
||||||
// ETS_UART_INTR_ENABLE(); // open up the FIFO again to start receiving
|
// ETS_UART_INTR_ENABLE(); // open up the FIFO again to start receiving
|
||||||
|
|
||||||
return result; // send the Tx status back
|
return EMS_TX_STATUS_OK; // send the Tx ok status back
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
#define EMSUART_TX_LAG 8
|
#define EMSUART_TX_LAG 8
|
||||||
#define EMSUART_BUSY_WAIT (EMSUART_BIT_TIME / 8)
|
#define EMSUART_BUSY_WAIT (EMSUART_BIT_TIME / 8)
|
||||||
#define EMS_TX_TO_CHARS (2 + 20)
|
#define EMS_TX_TO_CHARS (2 + 20)
|
||||||
#define EMS_TX_TO_COUNT ((EMS_TX_TO_CHARS)*8)
|
#define EMS_TX_TO_COUNT ((EMS_TX_TO_CHARS)*8*10)
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user