15 #include "nRF905_config.h" 91 #define NRF905_MAX_PAYLOAD 32 92 #define NRF905_REGISTER_COUNT 10 93 #define NRF905_DEFAULT_RXADDR 0xE7E7E7E7 94 #define NRF905_DEFAULT_TXADDR 0xE7E7E7E7 95 #define NRF905_PIN_UNUSED 255 97 #define NRF905_CALC_CHANNEL(f, b) ((((f) / (1 + (b>>1))) - 422400000UL) / 100000UL) 103 SPISettings spiSettings;
115 void (*onRxComplete)(
nRF905* device);
116 void (*onRxInvalid)(
nRF905* device);
117 void (*onTxComplete)(
nRF905* device);
118 void (*onAddrMatch)(
nRF905* device);
120 volatile uint8_t validPacket;
123 inline uint8_t cselect();
124 inline uint8_t cdeselect();
125 uint8_t readConfigRegister(uint8_t reg);
126 void writeConfigRegister(uint8_t reg, uint8_t val);
127 void setConfigReg1(uint8_t val, uint8_t mask, uint8_t reg);
128 void setConfigReg2(uint8_t val, uint8_t mask, uint8_t reg);
129 void defaultConfig();
130 inline void powerOn(
bool val);
131 inline void standbyMode(
bool val);
132 inline void txMode(
bool val);
133 void setAddress(uint32_t address, uint8_t cmd);
134 uint8_t readStatus();
136 bool addressMatched();
184 void (*callback_interrupt_dr)(),
185 void (*callback_interrupt_am)()
212 void (*onRxComplete)(
nRF905* device),
213 void (*onRxInvalid)(
nRF905* device),
214 void (*onTxComplete)(
nRF905* device),
215 void (*onAddrMatch)(
nRF905* device)
392 void write(uint32_t sendTo,
void* data, uint8_t len);
407 void read(
void* data, uint8_t len);
bool airwayBusy()
See if airway is busy (carrier detect pin asserted).
void setListenAddress(uint32_t address)
Set address to listen to.
10dBm = 10mW
Definition: nRF905.h:64
void RX()
Enter receive mode.
void poll()
When running in polled mode this method should be called as often as possible.
868/915MHz band
Definition: nRF905.h:53
4MHz clock
Definition: nRF905.h:73
nRF905_band_t
Frequency bands.
Definition: nRF905.h:44
void setAutoRetransmit(bool val)
Set auto-retransmit.
Transmit mode.
Definition: nRF905.h:37
Transmit mode (will auto-retransmit if enabled, otherwise will transmit a carrier wave with no data) ...
Definition: nRF905.h:26
2MHz clock
Definition: nRF905.h:74
nRF905_mode_t
Current radio mode.
Definition: nRF905.h:32
nRF905_outclk_t
Output a clock signal on pin 3 of IC.
Definition: nRF905.h:70
void begin(SPIClass spi, uint32_t spiClock, int csn, int trx, int tx, int pwr, int cd, int dr, int am, void(*callback_interrupt_dr)(), void(*callback_interrupt_am)())
Initialise, must be called after SPI.begin() and before any other nRF905 stuff.
Power-down mode.
Definition: nRF905.h:34
6dBm = 4mW
Definition: nRF905.h:63
Receive or transmit mode (when unable to tell due to the tx pin being unused, hardwired to VCC (TX) o...
Definition: nRF905.h:38
void read(void *data, uint8_t len)
Read received payload.
Standby mode.
Definition: nRF905.h:35
Disable CRC.
Definition: nRF905.h:86
1MHz clock
Definition: nRF905.h:75
nRF905_pwr_t
Output power (n means negative, n10 = -10).
Definition: nRF905.h:59
void standby()
Enter standby mode.
void interrupt_am()
When running in interrupt mode this method must be called from the AM interrupt callback function...
void setLowRxPower(bool val)
Set low power receive mode.
void events(void(*onRxComplete)(nRF905 *device), void(*onRxInvalid)(nRF905 *device), void(*onTxComplete)(nRF905 *device), void(*onAddrMatch)(nRF905 *device))
Register event functions.
void setBand(nRF905_band_t band)
Frequency band.
433MHz band
Definition: nRF905.h:51
Standby mode.
Definition: nRF905.h:24
void interrupt_dr()
When running in interrupt mode this method must be called from the DR interrupt callback function...
8bit CRC (Don't know what algorithm is used for this one)
Definition: nRF905.h:87
void otherSPIinterrupts()
If your sketch uses libraries that access the SPI bus from inside an interrupt then this method shoul...
void setChannel(uint16_t channel)
Channel to listen and transmit on.
void setAddressSize(uint8_t sizeTX, uint8_t sizeRX)
Address sizes.
void setPayloadSize(uint8_t sizeTX, uint8_t sizeRX)
Payload sizes.
void write(uint32_t sendTo, void *data, uint8_t len)
Write payload data and set destination address.
bool receiveBusy()
See if the address match (AM) is asserted.
Receive mode.
Definition: nRF905.h:25
nRF905_mode_t mode()
Get current radio mode.
void getConfigRegisters(void *regs)
Read configuration registers into byte array of NRF905_REGISTER_COUNT elements, mainly for debugging...
nRF905_nextmode_t
Available modes after transmission complete.
Definition: nRF905.h:20
Disable output clock.
Definition: nRF905.h:72
16bit CRC (CRC16-CCITT-FALSE (0xFFFF))
Definition: nRF905.h:88
868/915MHz band
Definition: nRF905.h:52
void setTransmitPower(nRF905_pwr_t val)
Set transmit output power.
-2dBm = 631uW
Definition: nRF905.h:62
Receive mode.
Definition: nRF905.h:36
-10dBm = 100uW
Definition: nRF905.h:61
nRF905_crc_t
CRC Checksum.
Definition: nRF905.h:84
500KHz clock (default)
Definition: nRF905.h:76
void setClockOut(nRF905_outclk_t val)
Set clock output.
bool TX(nRF905_nextmode_t nextMode, bool collisionAvoid)
Begin a transmission.
void setCRC(nRF905_crc_t val)
Set CRC algorithm.