Interface definition for AT86RF2xx based drivers. More...

Detailed Description

#include <stdint.h>
#include <stdbool.h>
#include "board.h"
#include "kernel_defines.h"
#include "net/netdev.h"
#include "net/netdev/ieee802154.h"
#include "net/gnrc/nettype.h"
#include "periph/spi.h"
#include "periph/gpio.h"
+ Include dependency graph for at86rf2xx.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  at86rf2xx_params
 struct holding all params needed for device initialization More...
 
struct  at86rf2xx_t
 Device descriptor for AT86RF2XX radio devices. More...
 

Macros

#define AT86RF2XX_MAX_PKT_LENGTH   (IEEE802154_FRAME_LEN_MAX)
 Maximum possible packet size in byte.
 
#define AT86RF2XX_DEFAULT_TXPOWER   (CONFIG_IEEE802154_DEFAULT_TXPOWER)
 Default TX power (0dBm)
 
#define RSSI_BASE_VAL   (-91)
 Base (minimal) RSSI value in dBm.
 
#define MIN_RX_SENSITIVITY   (-101)
 Min Receiver sensitivity value in dBm.
 
#define AT86RF2XX_HAVE_RETRIES   (1)
 Frame retry counter reporting. More...
 
#define AT86RF2XX_RANDOM_NUMBER_GENERATOR   (0)
 Random Number Generator. More...
 
#define AT86RF2XX_SMART_IDLE_LISTENING   (0)
 Smart idle listening feature. More...
 
#define AT86RF2XX_PHY_STATE_RX   AT86RF2XX_STATE_RX_ON
 Internal radio state equivalent to RX_ON.
 
#define AT86RF2XX_PHY_STATE_RX_BUSY   AT86RF2XX_STATE_BUSY_RX
 Internal radio state equivalent to RX_BUSY.
 
#define AT86RF2XX_PHY_STATE_TX   AT86RF2XX_STATE_PLL_ON
 Internal radio state equivalent to TX_ON.
 
#define AT86RF2XX_PHY_STATE_TX_BUSY   AT86RF2XX_STATE_BUSY_TX
 Internal radio state equivalent to TX_BUSY.
 

Typedefs

typedef struct at86rf2xx_params at86rf2xx_params_t
 struct holding all params needed for device initialization
 

Functions

void at86rf2xx_setup (at86rf2xx_t *dev, const at86rf2xx_params_t *params, uint8_t index)
 Setup an AT86RF2xx based device state. More...
 
void at86rf2xx_reset (at86rf2xx_t *dev)
 Trigger a hardware reset and configure radio with default values. More...
 
void at86rf2xx_get_addr_short (const at86rf2xx_t *dev, network_uint16_t *addr)
 Get the short address of the given device. More...
 
void at86rf2xx_set_addr_short (at86rf2xx_t *dev, const network_uint16_t *addr)
 Set the short address of the given device. More...
 
void at86rf2xx_get_addr_long (const at86rf2xx_t *dev, eui64_t *addr)
 Get the configured long address of the given device. More...
 
void at86rf2xx_set_addr_long (at86rf2xx_t *dev, const eui64_t *addr)
 Set the long address of the given device. More...
 
uint8_t at86rf2xx_get_chan (const at86rf2xx_t *dev)
 Get the configured channel number of the given device. More...
 
void at86rf2xx_set_chan (at86rf2xx_t *dev, uint8_t chan)
 Set the channel number of the given device. More...
 
uint8_t at86rf2xx_get_page (const at86rf2xx_t *dev)
 Get the configured channel page of the given device. More...
 
void at86rf2xx_set_page (at86rf2xx_t *dev, uint8_t page)
 Set the channel page of the given device. More...
 
uint8_t at86rf2xx_get_phy_mode (at86rf2xx_t *dev)
 Get the PHY mode of the given device. More...
 
uint8_t at86rf2xx_get_rate (at86rf2xx_t *dev)
 Get the current O-QPSK rate mode of the PHY. More...
 
int at86rf2xx_set_rate (at86rf2xx_t *dev, uint8_t rate)
 Set the current O-QPSK rate mode of the PHY rate modes > 0 are proprietary. More...
 
uint16_t at86rf2xx_get_pan (const at86rf2xx_t *dev)
 Get the configured PAN ID of the given device. More...
 
void at86rf2xx_set_pan (at86rf2xx_t *dev, uint16_t pan)
 Set the PAN ID of the given device. More...
 
int16_t at86rf2xx_get_txpower (const at86rf2xx_t *dev)
 Get the configured transmission power of the given device [in dBm]. More...
 
void at86rf2xx_set_txpower (const at86rf2xx_t *dev, int16_t txpower)
 Set the transmission power of the given device [in dBm]. More...
 
int8_t at86rf2xx_get_rxsensitivity (const at86rf2xx_t *dev)
 Get the configured receiver sensitivity of the given device [in dBm]. More...
 
void at86rf2xx_set_rxsensitivity (const at86rf2xx_t *dev, int8_t rxsens)
 Set the receiver sensitivity of the given device [in dBm]. More...
 
uint8_t at86rf2xx_get_max_retries (const at86rf2xx_t *dev)
 Get the maximum number of retransmissions. More...
 
void at86rf2xx_set_max_retries (const at86rf2xx_t *dev, uint8_t max)
 Set the maximum number of retransmissions. More...
 
uint8_t at86rf2xx_get_csma_max_retries (const at86rf2xx_t *dev)
 Get the maximum number of channel access attempts per frame (CSMA) More...
 
void at86rf2xx_set_csma_max_retries (const at86rf2xx_t *dev, int8_t retries)
 Set the maximum number of channel access attempts per frame (CSMA) More...
 
void at86rf2xx_set_csma_backoff_exp (const at86rf2xx_t *dev, uint8_t min, uint8_t max)
 Set the min and max backoff exponent for CSMA/CA. More...
 
void at86rf2xx_set_csma_seed (const at86rf2xx_t *dev, const uint8_t entropy[2])
 Set seed for CSMA random backoff. More...
 
int8_t at86rf2xx_get_cca_threshold (const at86rf2xx_t *dev)
 Get the CCA threshold value. More...
 
void at86rf2xx_set_cca_threshold (const at86rf2xx_t *dev, int8_t value)
 Set the CCA threshold value. More...
 
int8_t at86rf2xx_get_ed_level (at86rf2xx_t *dev)
 Get the latest ED level measurement. More...
 
void at86rf2xx_set_option (at86rf2xx_t *dev, uint16_t option, bool state)
 Enable or disable driver specific options. More...
 
uint8_t at86rf2xx_set_state (at86rf2xx_t *dev, uint8_t state)
 Set the state of the given device (trigger a state change) More...
 
size_t at86rf2xx_send (at86rf2xx_t *dev, const uint8_t *data, size_t len)
 Convenience function for simply sending data. More...
 
void at86rf2xx_tx_prepare (at86rf2xx_t *dev)
 Prepare for sending of data. More...
 
size_t at86rf2xx_tx_load (at86rf2xx_t *dev, const uint8_t *data, size_t len, size_t offset)
 Load chunks of data into the transmit buffer of the given device. More...
 
void at86rf2xx_tx_exec (at86rf2xx_t *dev)
 Trigger sending of data previously loaded into transmit buffer. More...
 
bool at86rf2xx_cca (at86rf2xx_t *dev)
 Perform one manual channel clear assessment (CCA) More...
 

Channel configuration

#define AT86RF2XX_MIN_CHANNEL   (IEEE802154_CHANNEL_MIN)
 
#define AT86RF2XX_MAX_CHANNEL   (IEEE802154_CHANNEL_MAX)
 
#define AT86RF2XX_DEFAULT_CHANNEL   (CONFIG_IEEE802154_DEFAULT_CHANNEL)
 

Flags for device internal states (see datasheet)

#define AT86RF2XX_STATE_P_ON   (0x00)
 initial power on
 
#define AT86RF2XX_STATE_BUSY_RX   (0x01)
 busy receiving data (basic mode)
 
#define AT86RF2XX_STATE_BUSY_TX   (0x02)
 busy transmitting data (basic mode)
 
#define AT86RF2XX_STATE_FORCE_TRX_OFF   (0x03)
 force transition to idle
 
#define AT86RF2XX_STATE_RX_ON   (0x06)
 listen mode (basic mode)
 
#define AT86RF2XX_STATE_TRX_OFF   (0x08)
 idle
 
#define AT86RF2XX_STATE_PLL_ON   (0x09)
 ready to transmit
 
#define AT86RF2XX_STATE_SLEEP   (0x0f)
 sleep mode
 
#define AT86RF2XX_STATE_BUSY_RX_AACK   (0x11)
 busy receiving data (extended mode)
 
#define AT86RF2XX_STATE_BUSY_TX_ARET   (0x12)
 busy transmitting data (extended mode)
 
#define AT86RF2XX_STATE_RX_AACK_ON   (0x16)
 wait for incoming data
 
#define AT86RF2XX_STATE_TX_ARET_ON   (0x19)
 ready for sending data
 
#define AT86RF2XX_STATE_IN_PROGRESS   (0x1f)
 ongoing state conversion
 

Internal device option flags

#define AT86RF2XX_OPT_TELL_TX_START   (0x0001)
 notify MAC layer on TX start
 
#define AT86RF2XX_OPT_TELL_TX_END   (0x0002)
 notify MAC layer on TX finished
 
#define AT86RF2XX_OPT_TELL_RX_START   (0x0004)
 notify MAC layer on RX start
 
#define AT86RF2XX_OPT_TELL_RX_END   (0x0008)
 notify MAC layer on RX finished
 
#define AT86RF2XX_OPT_CSMA   (0x0010)
 CSMA active.
 
#define AT86RF2XX_OPT_PROMISCUOUS   (0x0020)
 promiscuous mode active
 
#define AT86RF2XX_OPT_PRELOADING   (0x0040)
 preloading enabled
 
#define AT86RF2XX_OPT_AUTOACK   (0x0080)
 Auto ACK active.
 
#define AT86RF2XX_OPT_ACK_PENDING   (0x0100)
 ACK frames with data pending.