[PHY] Added method to manually drop synchronization in direct mode

This commit is contained in:
jgromes 2022-10-19 18:10:45 +02:00
parent 39489aeae6
commit 88f528a789
3 changed files with 18 additions and 2 deletions

View file

@ -244,6 +244,9 @@ sendMicE KEYWORD2
# Pager # Pager
sendTone KEYWORD2 sendTone KEYWORD2
# PhysicalLayer
dropSync KEYWORD2
####################################### #######################################
# Constants (LITERAL1) # Constants (LITERAL1)
####################################### #######################################

View file

@ -195,11 +195,17 @@ int16_t PhysicalLayer::available() {
return(_bufferWritePos); return(_bufferWritePos);
} }
uint8_t PhysicalLayer::read() { void PhysicalLayer::dropSync() {
if(_directSyncWordLen > 0) { if(_directSyncWordLen > 0) {
_gotSync = false; _gotSync = false;
_syncBuffer = 0; _syncBuffer = 0;
} }
}
uint8_t PhysicalLayer::read(bool drop) {
if(drop) {
dropSync();
}
_bufferWritePos--; _bufferWritePos--;
return(_buffer[_bufferReadPos++]); return(_buffer[_bufferReadPos++]);
} }

View file

@ -318,12 +318,19 @@ class PhysicalLayer {
*/ */
int16_t available(); int16_t available();
/*!
\brief Forcefully drop synchronization.
*/
void dropSync();
/*! /*!
\brief Get data from direct mode buffer. \brief Get data from direct mode buffer.
\param drop Drop synchronization on read - next reading will require waiting for the sync word again. Defautls to true.
\returns Byte from direct mode buffer. \returns Byte from direct mode buffer.
*/ */
uint8_t read(); uint8_t read(bool drop = true);
#endif #endif
/*! /*!