fixed mock uart driver for standalone unit tests

This commit is contained in:
proddy
2020-06-14 14:43:43 +02:00
parent a710080c46
commit d08cd09f4e
2 changed files with 9 additions and 12 deletions

View File

@@ -56,7 +56,7 @@ void EMSuart::send_poll(uint8_t data) {
* buf contains the CRC and len is #bytes including the CRC
* 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) {
return EMS_TX_STATUS_OK; // nothing to send
}

View File

@@ -23,11 +23,8 @@
namespace emsesp {
typedef enum {
EMS_TX_STATUS_OK = 1,
EMS_TX_WTD_TIMEOUT, // watchdog timeout during send
EMS_TX_BRK_DETECT, // incoming BRK during Tx
} EMSUART_STATUS;
#define EMS_TX_STATUS_ERR 0
#define EMS_TX_STATUS_OK 1
class EMSuart {
public:
@@ -38,7 +35,7 @@ class EMSuart {
static void stop();
static void restart();
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:
static char * hextoa(char * result, const uint8_t value);