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;
4242SoftwareSerial *ap3_serial_handle = 0 ;
4343
4444// Uncomment to enable debug pulses and Serial.prints
45- #define DEBUG
45+ // #define DEBUG
4646
4747#ifdef DEBUG
4848#define SS_DEBUG_PIN 8
@@ -168,7 +168,7 @@ int SoftwareSerial::available()
168168 return (rxBufferHead + AP3_SS_BUFFER_SIZE - rxBufferTail) % AP3_SS_BUFFER_SIZE;
169169}
170170
171- uint8_t SoftwareSerial::read ()
171+ int SoftwareSerial::read ()
172172{
173173 if (available () == 0 ) return (-1 );
174174
@@ -177,6 +177,28 @@ uint8_t SoftwareSerial::read()
177177 return (rxBuffer[rxBufferTail]);
178178}
179179
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+
180202ap3_err_t SoftwareSerial::softwareserialSetConfig (HardwareSerial_Config_e SSconfig)
181203{
182204 ap3_err_t retval = AP3_OK;
Original file line number Diff line number Diff line change @@ -51,7 +51,10 @@ class SoftwareSerial
5151
5252 ap3_err_t softwareserialSetConfig (HardwareSerial_Config_e SSconfig);
5353 int available ();
54- uint8_t read ();
54+ int read ();
55+ int peek ();
56+ bool overflow ();
57+
5558
5659 void rxBit (void );
5760 void endOfByte (void );
You can’t perform that action at this time.
0 commit comments