mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fixed mock uart driver for standalone unit tests
This commit is contained in:
@@ -56,7 +56,7 @@ void EMSuart::send_poll(uint8_t data) {
|
|||||||
* buf contains the CRC and len is #bytes including the CRC
|
* buf contains the CRC and len is #bytes including the CRC
|
||||||
* returns code, 0=success, 1=brk error, 2=watchdog timeout
|
* returns code, 0=success, 1=brk error, 2=watchdog timeout
|
||||||
*/
|
*/
|
||||||
EMSUART_STATUS EMSuart::transmit(uint8_t * buf, uint8_t len) {
|
uint16_t EMSuart::transmit(uint8_t * buf, uint8_t len) {
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return EMS_TX_STATUS_OK; // nothing to send
|
return EMS_TX_STATUS_OK; // nothing to send
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,8 @@
|
|||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
|
|
||||||
typedef enum {
|
#define EMS_TX_STATUS_ERR 0
|
||||||
EMS_TX_STATUS_OK = 1,
|
#define EMS_TX_STATUS_OK 1
|
||||||
EMS_TX_WTD_TIMEOUT, // watchdog timeout during send
|
|
||||||
EMS_TX_BRK_DETECT, // incoming BRK during Tx
|
|
||||||
} EMSUART_STATUS;
|
|
||||||
|
|
||||||
class EMSuart {
|
class EMSuart {
|
||||||
public:
|
public:
|
||||||
@@ -38,7 +35,7 @@ class EMSuart {
|
|||||||
static void stop();
|
static void stop();
|
||||||
static void restart();
|
static void restart();
|
||||||
static void send_poll(uint8_t data);
|
static void send_poll(uint8_t data);
|
||||||
static EMSUART_STATUS transmit(uint8_t * buf, uint8_t len);
|
static uint16_t transmit(uint8_t * buf, uint8_t len);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static char * hextoa(char * result, const uint8_t value);
|
static char * hextoa(char * result, const uint8_t value);
|
||||||
|
|||||||
Reference in New Issue
Block a user