[Pager] Added missing exclude direct receive guards (#697)
This commit is contained in:
parent
482b962f79
commit
f809f17dc8
2 changed files with 14 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "Pager.h"
|
||||
#if !defined(RADIOLIB_EXCLUDE_PAGER)
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
// this is a massive hack, but we need a global-scope ISR to manage the bit reading
|
||||
// let's hope nobody ever tries running two POCSAG receivers at the same time
|
||||
static PhysicalLayer* _readBitInstance = NULL;
|
||||
|
@ -14,10 +15,13 @@ static void PagerClientReadBit(void) {
|
|||
_readBitInstance->readBit(_readBitPin);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PagerClient::PagerClient(PhysicalLayer* phy) {
|
||||
_phy = phy;
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
_readBitInstance = _phy;
|
||||
#endif
|
||||
}
|
||||
|
||||
int16_t PagerClient::begin(float base, uint16_t speed, bool invert, uint16_t shift) {
|
||||
|
@ -214,6 +218,7 @@ int16_t PagerClient::transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t
|
|||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
int16_t PagerClient::startReceive(RADIOLIB_PIN_TYPE pin, uint32_t addr, uint32_t mask) {
|
||||
// save the variables
|
||||
_readBitPin = pin;
|
||||
|
@ -430,6 +435,7 @@ int16_t PagerClient::readData(uint8_t* data, size_t* len, uint32_t* addr) {
|
|||
*len = decodedBytes;
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
#endif
|
||||
|
||||
void PagerClient::write(uint32_t* data, size_t len) {
|
||||
// write code words from buffer
|
||||
|
@ -471,6 +477,7 @@ void PagerClient::write(uint32_t codeWord) {
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
uint32_t PagerClient::read() {
|
||||
uint32_t codeWord = 0;
|
||||
codeWord |= (uint32_t)_phy->read() << 24;
|
||||
|
@ -491,6 +498,7 @@ uint32_t PagerClient::read() {
|
|||
// TODO BCH error correction here
|
||||
return(codeWord);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t PagerClient::encodeBCD(char c) {
|
||||
switch(c) {
|
||||
|
|
|
@ -142,6 +142,8 @@ class PagerClient {
|
|||
*/
|
||||
int16_t transmit(uint8_t* data, size_t len, uint32_t addr, uint8_t encoding = RADIOLIB_PAGER_BCD);
|
||||
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
/*!
|
||||
\brief Start reception of POCSAG packets.
|
||||
|
||||
|
@ -190,6 +192,7 @@ class PagerClient {
|
|||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t readData(uint8_t* data, size_t* len, uint32_t* addr = NULL);
|
||||
#endif
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
private:
|
||||
|
@ -202,7 +205,6 @@ class PagerClient {
|
|||
uint16_t _shift;
|
||||
uint16_t _shiftHz;
|
||||
uint16_t _bitDuration;
|
||||
uint32_t _readBatchPos;
|
||||
uint32_t _filterAddr;
|
||||
uint32_t _filterMask;
|
||||
bool inv = false;
|
||||
|
@ -214,7 +216,10 @@ class PagerClient {
|
|||
|
||||
void write(uint32_t* data, size_t len);
|
||||
void write(uint32_t codeWord);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
uint32_t read();
|
||||
#endif
|
||||
|
||||
uint8_t encodeBCD(char c);
|
||||
char decodeBCD(uint8_t b);
|
||||
|
|
Loading…
Add table
Reference in a new issue