File tree 4 files changed +153
-132
lines changed
4 files changed +153
-132
lines changed Original file line number Diff line number Diff line change @@ -33,80 +33,48 @@ void HardwareSerial::setDebugOutput(bool en)
33
33
return ;
34
34
}
35
35
if (en) {
36
- if (_uart->txEnabled ) {
37
- uartSetDebug (_uart);
38
- } else {
39
- uartSetDebug (0 );
40
- }
36
+ uartSetDebug (_uart);
41
37
} else {
42
38
if (uartGetDebug () == _uart_nr) {
43
39
uartSetDebug (0 );
44
40
}
45
41
}
46
42
}
47
43
48
- bool HardwareSerial::isTxEnabled (void )
49
- {
50
- if (_uart == 0 ) {
51
- return false ;
52
- }
53
- return _uart->txEnabled ;
54
- }
55
-
56
- bool HardwareSerial::isRxEnabled (void )
57
- {
58
- if (_uart == 0 ) {
59
- return false ;
60
- }
61
- return _uart->rxEnabled ;
62
- }
63
-
64
44
int HardwareSerial::available (void )
65
45
{
66
- if (_uart && _uart->rxEnabled ) {
67
- return uartAvailable (_uart);
68
- }
69
- return 0 ;
46
+ return uartAvailable (_uart);
70
47
}
71
48
72
49
int HardwareSerial::peek (void )
73
50
{
74
- if (_uart && _uart-> rxEnabled ) {
51
+ if (available () ) {
75
52
return uartPeek (_uart);
76
53
}
77
54
return -1 ;
78
55
}
79
56
80
57
int HardwareSerial::read (void )
81
58
{
82
- if (_uart && _uart-> rxEnabled ) {
59
+ if (available () ) {
83
60
return uartRead (_uart);
84
61
}
85
62
return -1 ;
86
63
}
87
64
88
65
void HardwareSerial::flush ()
89
66
{
90
- if (_uart == 0 || !_uart->txEnabled ) {
91
- return ;
92
- }
93
67
uartFlush (_uart);
94
68
}
95
69
96
70
size_t HardwareSerial::write (uint8_t c)
97
71
{
98
- if (_uart == 0 || !_uart->txEnabled ) {
99
- return 0 ;
100
- }
101
72
uartWrite (_uart, c);
102
73
return 1 ;
103
74
}
104
75
105
76
size_t HardwareSerial::write (const uint8_t *buffer, size_t size)
106
77
{
107
- if (_uart == 0 || !_uart->txEnabled ) {
108
- return 0 ;
109
- }
110
78
uartWriteBuf (_uart, buffer, size);
111
79
return size;
112
80
}
Original file line number Diff line number Diff line change @@ -65,8 +65,6 @@ class HardwareSerial: public Stream
65
65
operator bool () const ;
66
66
67
67
void setDebugOutput (bool );
68
- bool isTxEnabled (void );
69
- bool isRxEnabled (void );
70
68
71
69
protected:
72
70
int _uart_nr;
You can’t perform that action at this time.
0 commit comments