89 #define RFM70_LIB_VERSION "V1.02 (2011-12-31)" 94 #define RFM70_MAX_PACKET_LEN 32 112 #define RFM70_CMD_R_RX_PAYLOAD 0x61 115 #define RFM70_CMD_W_TX_PAYLOAD 0xA0 118 #define RFM70_CMD_FLUSH_TX 0xE1 121 #define RFM70_CMD_FLUSH_RX 0xE2 124 #define RFM70_CMD_REUSE_TX_PL 0xE3 127 #define RFM70_CMD_W_TX_PAYLOAD_NOACK 0xB0 130 #define RFM70_CMD_W_ACK_PAYLOAD 0xA8 133 #define RFM70_CMD_ACTIVATE 0x50 136 #define RFM70_CMD_R_RX_PL_WID 0x60 139 #define RFM70_CMD_NOP 0xFF 158 #define RFM70_REG_CONFIG 0x00 170 #define RFM70_REG_EN_AA 0x01 182 #define RFM70_REG_EN_RXADDR 0x02 189 #define RFM70_REG_SETUP_AW 0x03 196 #define RFM70_REG_SETUP_RETR 0x04 201 #define RFM70_REG_RF_CH 0x05 210 #define RFM70_REG_RF_SETUP 0x06 229 #define RFM70_REG_STATUS 0x07 242 #define RFM70_REG_OBSERVE_TX 0x08 249 #define RFM70_REG_CD 0x09 256 #define RFM70_REG_RX_ADDR_P0 0x0A 263 #define RFM70_REG_RX_ADDR_P1 0x0B 270 #define RFM70_REG_RX_ADDR_P2 0x0C 277 #define RFM70_REG_RX_ADDR_P3 0x0D 284 #define RFM70_REG_RX_ADDR_P4 0x0E 291 #define RFM70_REG_RX_ADDR_P5 0x0F 298 #define RFM70_REG_TX_ADDR 0x10 304 #define RFM70_REG_RX_PW_P0 0x11 310 #define RFM70_REG_RX_PW_P1 0x12 316 #define RFM70_REG_RX_PW_P2 0x13 322 #define RFM70_REG_RX_PW_P3 0x14 328 #define RFM70_REG_RX_PW_P4 0x15 334 #define RFM70_REG_RX_PW_P5 0x16 346 #define RFM70_REG_FIFO_STATUS 0x17 360 #define RFM70_REG_DYNPD 0x1C 369 #define RFM70_REG_FEATURE 0x1D 383 pins::output_pin &sclk;
384 pins::output_pin &mosi;
385 pins::input_pin &miso;
386 pins::output_pin &csn;
387 pins::output_pin &ce;
389 void(*wait_ms)(
unsigned int);
390 void(*wait_us)(
unsigned int);
392 unsigned char SPI_RW(
unsigned char value );
402 pins::output_pin &sclk,
403 pins::output_pin &mosi,
404 pins::input_pin &miso,
405 pins::output_pin &csn,
408 ,
void(*wait_ms)(
unsigned int)
409 ,
void(*wait_us)(
unsigned int)
422 void bank(
unsigned char b );
481 const unsigned char *buf,
555 void channel(
unsigned char ch );
602 void power(
unsigned char level );
746 const unsigned char *buf,
765 const unsigned char *buf,
806 unsigned char & pipe,
808 unsigned char & length
void channel_payload_size(unsigned char n, unsigned char size)
set the payload size for pipe n
Definition: rfm70.cpp:749
unsigned char receive_next_pipe(void)
get pipe number of the next message in receive FIFO
Definition: rfm70.cpp:784
unsigned char rfm70_buffer[RFM70_MAX_PACKET_LEN]
type of rfm70 (transmit or receive) buffer
Definition: rfm70.h:99
unsigned char lost_packets_count(void)
read rfm70 lost packets count
Definition: rfm70.cpp:684
void receive_address_p1(const unsigned char address[5])
set the rfm70 pipe 1 address
Definition: rfm70.cpp:668
void buffer_read(unsigned char reg, unsigned char *buf, unsigned char length)
read a multi-byte command or register
Definition: rfm70.cpp:442
void mode_standby(void)
switch the rfm70 to standby mode
Definition: rfm70.cpp:589
void transmit_message_once(const unsigned char *buf, unsigned char length)
transmit a message once
Definition: rfm70.cpp:774
bool transmit_fifo_full(void)
report whether the transmit fifo is full
Definition: rfm70.cpp:652
void retransmit_delay_attempts(unsigned char d, unsigned char n)
set the retransmission delay and number of attempts
Definition: rfm70.cpp:719
bool receive(unsigned char &pipe, unsigned char *buf, unsigned char &length)
(try to) receive a message
Definition: rfm70.cpp:793
void air_data_rate(unsigned char rate)
set the rfm70 air data rate (baudrate)
Definition: rfm70.cpp:610
void channel(unsigned char ch)
set the rfm70 channel frequency
Definition: rfm70.cpp:605
void receive_address_pn(unsigned char channel, unsigned char address)
set the rfm70 pipe n (2..5) address
Definition: rfm70.cpp:672
void mode_powerdown(void)
switch the rfm70 to power down mode
Definition: rfm70.cpp:597
bool is_present(void)
report whether the rfm70 module is present
Definition: rfm70.cpp:542
unsigned char register_read(unsigned char reg)
read a single-byte command or register
Definition: rfm70.cpp:430
void transmit_address(const unsigned char *address)
set the rfm70 transmit address
Definition: rfm70.cpp:676
void buffer_write(char reg, const unsigned char *buf, unsigned char length)
write a multi-byte command or register
Definition: rfm70.cpp:459
#define RFM70_MAX_PACKET_LEN
maximum number of data bytes in a (received or transmitted) rfm70 packet
Definition: rfm70.h:94
void transmit_message(const unsigned char *buf, unsigned char length)
transmit a message
Definition: rfm70.cpp:764
void lost_packets_reset(void)
reset rfm70 lost packets count
Definition: rfm70.cpp:714
void mode_receive(void)
switch the rfm70 to receive mode
Definition: rfm70.cpp:551
void pipe_autoack(unsigned char pipe, bool enabled)
enables or disables the autoack on a pipe
Definition: rfm70.cpp:688
void mode_transmit(void)
switch the rfm70 to transmit mode
Definition: rfm70.cpp:570
interface to an RFM70 module
Definition: rfm70.h:380
unsigned char retransmit_count(void)
read rfm70 retransmit count
Definition: rfm70.cpp:680
void receive_address_p0(const unsigned char address[5])
set the rfm70 pipe 0 address
Definition: rfm70.cpp:664
rfm70(pins::output_pin &sclk, pins::output_pin &mosi, pins::input_pin &miso, pins::output_pin &csn, pins::output_pin &ce, void(*wait_ms)(unsigned int), void(*wait_us)(unsigned int))
constructor: create and RFM70 object
Definition: rfm70.h:401
void register_write(unsigned char reg, unsigned char val)
write a single-byte command or register
Definition: rfm70.cpp:420
void pipe_enable(unsigned char d, bool enabled)
enables or disables a pipe
Definition: rfm70.cpp:701
void power(unsigned char level)
set the rfm70 transmit power
Definition: rfm70.cpp:736
unsigned char receive_next_length(void)
get payload length of the next message in receive FIFO
Definition: rfm70.cpp:789
void lna_high(void)
set the rfm70 lna gain to high
Definition: rfm70.cpp:724
void address_length(unsigned char len)
set the rfm70 address length
Definition: rfm70.cpp:642
void init(void)
initialize the library and the rfm70 module
Definition: rfm70.cpp:808
bool receive_fifo_empty(void)
report whether the receive fifo is empty
Definition: rfm70.cpp:658
void crc_length(unsigned char len)
set the rfm70 CRC length
Definition: rfm70.cpp:622
void lna_low(void)
set the rfm70 lna gain to low
Definition: rfm70.cpp:730