Restructured a bit

This commit is contained in:
strange_v 2022-07-11 20:51:58 +03:00
parent ada0e6abcd
commit 4b91c6c1b6
2 changed files with 8 additions and 7 deletions

View File

@ -154,11 +154,6 @@ bool RFM69::initialize(uint8_t freqBand, uint16_t nodeID, uint8_t networkID)
return true;
}
void RFM69::setIsrCallback(void (*callback)())
{
_isrCallback = callback;
}
// return the frequency (in Hz)
uint32_t RFM69::getFrequency()
{
@ -234,6 +229,12 @@ void RFM69::setNetwork(uint8_t networkID)
writeReg(REG_SYNCVALUE2, networkID);
}
//set user's ISR callback
void RFM69::setIsrCallback(void (*callback)())
{
_isrCallback = callback;
}
// Control transmitter output power (this is NOT a dBm value!)
// the power configurations are explained in the SX1231H datasheet (Table 10 on p21; RegPaLevel p66): http://www.semtech.com/images/datasheet/sx1231h.pdf
// valid powerLevel parameter values are 0-31 and result in a directly proportional effect on the output/transmission power

View File

@ -201,9 +201,9 @@ class RFM69 {
RFM69(uint8_t slaveSelectPin=RF69_SPI_CS, uint8_t interruptPin=RF69_IRQ_PIN, bool isRFM69HW_HCW=false, SPIClass *spi=nullptr);
bool initialize(uint8_t freqBand, uint16_t ID, uint8_t networkID=1);
void setIsrCallback(void (*callback)());
void setAddress(uint16_t addr);
void setNetwork(uint8_t networkID);
void setIsrCallback(void (*callback)());
virtual bool canSend();
virtual void send(uint16_t toAddress, const void* buffer, uint8_t bufferSize, bool requestACK=false);
virtual bool sendWithRetry(uint16_t toAddress, const void* buffer, uint8_t bufferSize, uint8_t retries=2, uint8_t retryWaitTime=RFM69_ACK_TIMEOUT);
@ -249,7 +249,6 @@ class RFM69 {
virtual void interruptHook(uint8_t CTLbyte __attribute__((unused))) {};
static volatile bool _haveData;
static RFM69 *_instance;
void (*_isrCallback)() = nullptr;
virtual void sendFrame(uint16_t toAddress, const void* buffer, uint8_t size, bool requestACK=false, bool sendACK=false);
// for ListenMode sleep/timer
@ -263,6 +262,7 @@ class RFM69 {
uint8_t _powerLevel;
bool _isRFM69HW;
SPIClass *_spi;
void (*_isrCallback)() = nullptr;
#if defined (SPCR) && defined (SPSR)
uint8_t _SPCR;
uint8_t _SPSR;