14 #define RF12_VERSION 2
17 #define rf12_grp rf12_buf[0]
19 #define rf12_hdr rf12_buf[1]
21 #define rf12_len rf12_buf[2]
23 #define rf12_data (rf12_buf + 3)
26 #define RF12_HDR_CTL 0x80
28 #define RF12_HDR_DST 0x40
30 #define RF12_HDR_ACK 0x20
32 #define RF12_HDR_MASK 0x1F
35 #define RF12_MAXDATA 66
42 #define RF12_EEPROM_ADDR ((uint8_t*) 0x20)
43 #define RF12_EEPROM_SIZE 16
44 #define RF12_EEPROM_EKEY ((uint8_t*) 0x40)
45 #define RF12_EEPROM_ELEN 16
46 #define RF12_EEPROM_VERSION 1
49 #define RF12_WANTS_ACK ((rf12_hdr & RF12_HDR_ACK) && !(rf12_hdr & RF12_HDR_CTL))
51 #define RF12_ACK_REPLY (rf12_hdr & RF12_HDR_DST ? RF12_HDR_CTL : \
52 RF12_HDR_CTL | RF12_HDR_DST | (rf12_hdr & RF12_HDR_MASK))
56 #define RF12_WAKEUP -1
73 uint8_t
rf12_initialize(uint8_t
id, uint8_t band, uint8_t group=0xD4, uint16_t frequency=1600);
97 void rf12_sendNow(uint8_t hdr,
const void* ptr, uint8_t len);
138 RF12_DATA_RATE_CMD = 0xC600,
139 RF12_DATA_RATE_9 = RF12_DATA_RATE_CMD | 0x02,
140 RF12_DATA_RATE_8 = RF12_DATA_RATE_CMD | 0x05,
141 RF12_DATA_RATE_7 = RF12_DATA_RATE_CMD | 0x06,
142 RF12_DATA_RATE_6 = RF12_DATA_RATE_CMD | 0x08,
143 RF12_DATA_RATE_5 = RF12_DATA_RATE_CMD | 0x11,
144 RF12_DATA_RATE_4 = RF12_DATA_RATE_CMD | 0x23,
145 RF12_DATA_RATE_3 = RF12_DATA_RATE_CMD | 0x47,
146 RF12_DATA_RATE_2 = RF12_DATA_RATE_CMD | 0x91,
147 RF12_DATA_RATE_1 = RF12_DATA_RATE_CMD | 0x9E,
148 RF12_DATA_RATE_DEFAULT = RF12_DATA_RATE_7,
uint8_t rf12_configSilent()
Initialize the RFM12B module from settings stored in EEPROM by "RF12demo" don't call rf12_initializ...
Definition: RF12.cpp:645
long rf12_seq
Seq number of encrypted packet (or -1).
Definition: RF12.cpp:143
uint8_t rf12_canSend(void)
Call this to check whether a new transmission can be started.
Definition: RF12.cpp:416
void rf12_easyInit(uint8_t secs)
Set up the easy tranmission mode, arg is number of seconds between packets.
Definition: RF12.cpp:769
void rf12_sendNow(uint8_t hdr, const void *ptr, uint8_t len)
This variant loops on rf12_canSend() and then calls rf12_sendStart() asap.
Definition: RF12.cpp:484
char rf12_easyPoll(void)
Call this often to keep the easy transmission mode going.
Definition: RF12.cpp:782
uint8_t rf12_recvDone(void)
Call this frequently, returns true if a packet has been received.
Definition: RF12.cpp:383
uint8_t rf12_initialize(uint8_t id, uint8_t band, uint8_t group=0xD4, uint16_t frequency=1600)
Call this once with the node ID, frequency band, and optional group.
Definition: RF12.cpp:547
void rf12_configDump()
Call this to send a description of the EEPROM settings to the serial port.
Definition: RF12.cpp:668
char rf12_easySend(const void *data, uint8_t size)
Send new data using easy transmission mode, buffer gets copied to driver.
Definition: RF12.cpp:837
void rf12_sendWait(uint8_t mode)
Wait for send to finish.
Definition: RF12.cpp:499
void rf12_sleep(char n)
Power off the RFM12B, ms > 0 sets watchdog to wake up again after N * 32 ms.
Definition: RF12.cpp:726
volatile uint16_t rf12_crc
Running crc value, should be zero at end.
Definition: RF12.cpp:141
void rf12_sendStart(uint8_t hdr)
Call this only when rf12_recvDone() or rf12_canSend() return true.
Definition: RF12.cpp:428
rf12DataRates
See http://blog.strobotics.com.au/2009/07/27/rfm12-tutorial-part-3a/ Transmissions are packetized...
Definition: RF12.h:137
void rf12_onOff(uint8_t value)
This simulates OOK by turning the transmitter on and off via SPI commands.
Definition: RF12.cpp:632
void rf12_encrypt(const uint8_t *)
Enable encryption (null arg disables it again).
Definition: RF12.cpp:930
volatile uint8_t rf12_buf[]
Recv/xmit buf including hdr & crc bytes.
Definition: RF12.cpp:142
uint16_t rf12_control(uint16_t cmd)
Low-level control of the RFM12B via direct register access.
Definition: RF12.cpp:252
uint8_t rf12_config(uint8_t show=1)
Definition: RF12.cpp:706
char rf12_lowbat(void)
Return true if the supply voltage is below 3.1V.
Definition: RF12.cpp:743
void rf12_set_cs(uint8_t pin)
Option to set RFM12 CS (or SS) pin for use on different hardware setups.
Definition: RF12.cpp:150
void rf12_spiInit(void)
Only needed if you want to init the SPI bus before rf12_initialize() does.
Definition: RF12.cpp:160