File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
libraries/SoftwareSerial/src Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ uint8_t gSoftwareSerialNumObjs = 0;
42
42
SoftwareSerial *ap3_serial_handle = 0 ;
43
43
44
44
// Uncomment to enable debug pulses and Serial.prints
45
- #define DEBUG
45
+ // #define DEBUG
46
46
47
47
#ifdef DEBUG
48
48
#define SS_DEBUG_PIN 8
@@ -168,7 +168,7 @@ int SoftwareSerial::available()
168
168
return (rxBufferHead + AP3_SS_BUFFER_SIZE - rxBufferTail) % AP3_SS_BUFFER_SIZE;
169
169
}
170
170
171
- uint8_t SoftwareSerial::read ()
171
+ int SoftwareSerial::read ()
172
172
{
173
173
if (available () == 0 ) return (-1 );
174
174
@@ -177,6 +177,28 @@ uint8_t SoftwareSerial::read()
177
177
return (rxBuffer[rxBufferTail]);
178
178
}
179
179
180
+ int SoftwareSerial::peek ()
181
+ {
182
+ if (available () == 0 ) return (-1 );
183
+
184
+ uint8_t tempTail = rxBufferTail + 1 ;
185
+ tempTail %= AP3_SS_BUFFER_SIZE;
186
+ return (rxBuffer[tempTail]);
187
+ }
188
+
189
+ // Returns true if overflow flag is set
190
+ // Clears flag when called
191
+ bool SoftwareSerial::overflow ()
192
+ {
193
+ if (_rxBufferOverflow)
194
+ {
195
+ _rxBufferOverflow = false ;
196
+ return (true );
197
+ }
198
+ return (false );
199
+
200
+ }
201
+
180
202
ap3_err_t SoftwareSerial::softwareserialSetConfig (HardwareSerial_Config_e SSconfig)
181
203
{
182
204
ap3_err_t retval = AP3_OK;
Original file line number Diff line number Diff line change @@ -51,7 +51,10 @@ class SoftwareSerial
51
51
52
52
ap3_err_t softwareserialSetConfig (HardwareSerial_Config_e SSconfig);
53
53
int available ();
54
- uint8_t read ();
54
+ int read ();
55
+ int peek ();
56
+ bool overflow ();
57
+
55
58
56
59
void rxBit (void );
57
60
void endOfByte (void );
You can’t perform that action at this time.
0 commit comments