libukhasnet-rfm69
An RFM69 library maintained for UKHASnet
|
Typedefs | |
typedef uint8_t | rfm_reg_t |
typedef enum rfm_status_t | rfm_status_t |
Enumerations | |
enum | rfm_status_t { RFM_OK, RFM_FAIL, RFM_TIMEOUT } |
Functions | |
rfm_status_t | rf69_init (void) |
rfm_status_t | _rf69_read (const rfm_reg_t reg, rfm_reg_t *result) |
rfm_status_t | _rf69_write (const rfm_reg_t reg, const rfm_reg_t val) |
rfm_status_t | _rf69_burst_read (const rfm_reg_t reg, rfm_reg_t *dest, uint8_t len) |
rfm_status_t | _rf69_burst_write (rfm_reg_t reg, const rfm_reg_t *src, uint8_t len) |
rfm_status_t | _rf69_fifo_write (const rfm_reg_t *src, uint8_t len) |
rfm_status_t | rf69_set_mode (const rfm_reg_t newMode) |
rfm_status_t | rf69_receive (rfm_reg_t *buf, rfm_reg_t *len, int16_t *lastrssi, bool *rfm_packet_waiting) |
rfm_status_t | rf69_send (const rfm_reg_t *data, uint8_t len, const uint8_t power) |
rfm_status_t | _rf69_clear_fifo (void) |
rfm_status_t | rf69_read_temp (int8_t *temperature) |
rfm_status_t | _rf69_sample_rssi (int16_t *rssi) |
rfm_status_t | spi_init (void) |
rfm_status_t | spi_exchange_single (const rfm_reg_t out, rfm_reg_t *in) |
rfm_status_t | spi_ss_assert (void) |
rfm_status_t | spi_ss_deassert (void) |
Variables | |
static const rfm_reg_t | CONFIG [][2] |
static rfm_reg_t | _mode |
rfm_status_t _rf69_burst_read | ( | const rfm_reg_t | reg, |
rfm_reg_t * | dest, | ||
uint8_t | len | ||
) |
Read a given number of bytes from the given register address into a provided buffer
reg | The address of the register to start from |
dest | A pointer into the destination buffer |
len | The number of bytes to read |
rfm_status_t _rf69_burst_write | ( | rfm_reg_t | reg, |
const rfm_reg_t * | src, | ||
uint8_t | len | ||
) |
Write a given number of bytes into the registers in the RFM69.
reg | The first byte address into which to write |
src | A pointer into the source data buffer |
len | The number of bytes to write |
rfm_status_t _rf69_clear_fifo | ( | void | ) |
Clear the FIFO in the RFM69. We do this by entering STBY mode and then returing to RX mode.
rfm_status_t _rf69_fifo_write | ( | const rfm_reg_t * | src, |
uint8_t | len | ||
) |
Write data into the FIFO on the RFM69
src | The source data comes from this buffer |
len | Write this number of bytes from the buffer into the FIFO |
rfm_status_t _rf69_read | ( | const rfm_reg_t | reg, |
rfm_reg_t * | result | ||
) |
Read a single byte from a register in the RFM69. Transmit the (one byte) address of the register to be read, then read the (one byte) response.
reg | The register address to be read |
result | A pointer to where to put the result |
rfm_status_t _rf69_sample_rssi | ( | int16_t * | rssi | ) |
Get the last RSSI value from the RFM69
rssi | A pointer to an int16_t where we will place the RSSI value |
rfm_status_t _rf69_write | ( | const rfm_reg_t | reg, |
const rfm_reg_t | val | ||
) |
Write a single byte to a register in the RFM69. Transmit the register address (one byte) with the write mask RFM_SPI_WRITE_MASK on, and then the value of the register to be written.
reg | The address of the register to write |
val | The value for the address |
rfm_status_t rf69_init | ( | void | ) |
Initialise the RFM69 device.
rfm_status_t rf69_read_temp | ( | int8_t * | temperature | ) |
The RFM69 has an onboard temperature sensor, read its value
temperature | A pointer to the variable into which the temperature will be read by this method. |
rfm_status_t rf69_receive | ( | rfm_reg_t * | buf, |
rfm_reg_t * | len, | ||
int16_t * | lastrssi, | ||
bool * | rfm_packet_waiting | ||
) |
Get data from the RFM69 receive buffer.
buf | A pointer into the local buffer in which we would like the data. |
len | The length of the data |
lastrssi | The RSSI of the packet we're getting |
rfm_packet_waiting | A boolean pointer which is true if a packet was received and has been put into the buffer buf, false if there was no packet to get from the RFM69. |
rfm_status_t rf69_send | ( | const rfm_reg_t * | data, |
uint8_t | len, | ||
const uint8_t | power | ||
) |
Send a packet using the RFM69 radio.
data | The data buffer that contains the string to transmit |
len | The number of bytes in the data packet (excluding preamble, sync and checksum) |
power | The transmit power to be used in dBm |
rfm_status_t rf69_set_mode | ( | const rfm_reg_t | newMode | ) |
Change the RFM69 operating mode to a new one.
newMode | The value representing the new mode (see datasheet for further information). The MODE bits are masked in the register, i.e. only bits 2-4 of newMode are ovewritten in the register. |
rfm_status_t spi_init | ( | void | ) |
SPI device driver functions. These are to be provided by the user. Prototypes are provided here such that the library can be built. Documentation can be found in spi_conf.c.
|
static |
Track the current mode of the radio