Restructured a bit
This commit is contained in:
parent
ada0e6abcd
commit
4b91c6c1b6
11
RFM69.cpp
11
RFM69.cpp
|
|
@ -154,11 +154,6 @@ bool RFM69::initialize(uint8_t freqBand, uint16_t nodeID, uint8_t networkID)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RFM69::setIsrCallback(void (*callback)())
|
|
||||||
{
|
|
||||||
_isrCallback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
// return the frequency (in Hz)
|
// return the frequency (in Hz)
|
||||||
uint32_t RFM69::getFrequency()
|
uint32_t RFM69::getFrequency()
|
||||||
{
|
{
|
||||||
|
|
@ -234,6 +229,12 @@ void RFM69::setNetwork(uint8_t networkID)
|
||||||
writeReg(REG_SYNCVALUE2, 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!)
|
// 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
|
// 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
|
// valid powerLevel parameter values are 0-31 and result in a directly proportional effect on the output/transmission power
|
||||||
|
|
|
||||||
4
RFM69.h
4
RFM69.h
|
|
@ -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);
|
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);
|
bool initialize(uint8_t freqBand, uint16_t ID, uint8_t networkID=1);
|
||||||
void setIsrCallback(void (*callback)());
|
|
||||||
void setAddress(uint16_t addr);
|
void setAddress(uint16_t addr);
|
||||||
void setNetwork(uint8_t networkID);
|
void setNetwork(uint8_t networkID);
|
||||||
|
void setIsrCallback(void (*callback)());
|
||||||
virtual bool canSend();
|
virtual bool canSend();
|
||||||
virtual void send(uint16_t toAddress, const void* buffer, uint8_t bufferSize, bool requestACK=false);
|
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);
|
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))) {};
|
virtual void interruptHook(uint8_t CTLbyte __attribute__((unused))) {};
|
||||||
static volatile bool _haveData;
|
static volatile bool _haveData;
|
||||||
static RFM69 *_instance;
|
static RFM69 *_instance;
|
||||||
void (*_isrCallback)() = nullptr;
|
|
||||||
virtual void sendFrame(uint16_t toAddress, const void* buffer, uint8_t size, bool requestACK=false, bool sendACK=false);
|
virtual void sendFrame(uint16_t toAddress, const void* buffer, uint8_t size, bool requestACK=false, bool sendACK=false);
|
||||||
|
|
||||||
// for ListenMode sleep/timer
|
// for ListenMode sleep/timer
|
||||||
|
|
@ -263,6 +262,7 @@ class RFM69 {
|
||||||
uint8_t _powerLevel;
|
uint8_t _powerLevel;
|
||||||
bool _isRFM69HW;
|
bool _isRFM69HW;
|
||||||
SPIClass *_spi;
|
SPIClass *_spi;
|
||||||
|
void (*_isrCallback)() = nullptr;
|
||||||
#if defined (SPCR) && defined (SPSR)
|
#if defined (SPCR) && defined (SPSR)
|
||||||
uint8_t _SPCR;
|
uint8_t _SPCR;
|
||||||
uint8_t _SPSR;
|
uint8_t _SPSR;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue