-
Notifications
You must be signed in to change notification settings - Fork 6
/
Port_ESPEasySerial_HardwareSerial.h
56 lines (37 loc) · 1.3 KB
/
Port_ESPEasySerial_HardwareSerial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef ESPEASYSERIAL_ESPEASYSERIAL_HARDWARESERIAL_H
#define ESPEASYSERIAL_ESPEASYSERIAL_HARDWARESERIAL_H
#include "ESPEasySerial_common_defines.h"
#include "Port_ESPEasySerial_base.h"
#include <HardwareSerial.h>
#ifdef ESP32
# include <esp32-hal-uart.h>
#endif // ifdef ESP32
class Port_ESPEasySerial_HardwareSerial_t : public Port_ESPEasySerial_base {
public:
Port_ESPEasySerial_HardwareSerial_t();
~Port_ESPEasySerial_HardwareSerial_t();
// Allow for resetConfig, instead of end() and begin().
// This can otherwise cause issues with some sensors when starting/stopping an ESPEasy task
void resetConfig(const ESPEasySerialConfig& config);
void begin(unsigned long baud);
void end();
int available(void);
int availableForWrite(void);
int peek(void);
int read(void);
size_t read(uint8_t *buffer,
size_t size);
void flush(void);
void flush(bool txOnly);
size_t write(uint8_t);
size_t write(const uint8_t *buffer,
size_t size);
int getBaudRate() const override;
operator bool() const;
void setDebugOutput(bool);
size_t setRxBufferSize(size_t new_size);
size_t setTxBufferSize(size_t new_size);
private:
HardwareSerial *_serial = nullptr;
};
#endif // ifndef ESPEASYSERIAL_ESPEASYSERIAL_HARDWARESERIAL_H