Loading...
Searching...
No Matches

Interface definition for AT86RF215 based drivers. More...

Detailed Description

Interface definition for AT86RF215 based drivers.

Author
Benjamin Valentin benja.nosp@m.min..nosp@m.valen.nosp@m.tin@.nosp@m.ml-pa.nosp@m..com

Definition in file at86rf215.h.

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

Go to the source code of this file.

Data Structures

struct  at86rf215_params
 struct holding all params needed for device initialization More...
 
struct  at86rf215
 Device descriptor for AT86RF215 radio devices. More...
 

Macros

#define AT86RF215_MAX_PKT_LENGTH   (2047)
 Maximum possible packet size in byte.
 
#define CONFIG_AT86RF215_USE_CLOCK_OUTPUT
 Set to 1 if the clock output of the AT86RF215 is used as a clock source on the board.
 
#define CONFIG_AT86RF215_TRIM_VAL   (0)
 Trim value for the external crystal oscillator.
 
#define CONFIG_AT86RF215_DEFAULT_TXPOWER   (CONFIG_IEEE802154_DEFAULT_TXPOWER)
 Default TX power (0dBm)
 

Typedefs

typedef struct at86rf215_RF_regs at86rf215_RF_regs_t
 Registers for the Radio Frontend.
 
typedef struct at86rf215_BBC_regs at86rf215_BBC_regs_t
 Registers for the BaseBand Controller.
 
typedef void(* at86rf215_batmon_cb_t) (void *arg)
 Signature for the Battery monitor callback.
 
typedef struct at86rf215_params at86rf215_params_t
 struct holding all params needed for device initialization
 
typedef struct at86rf215 at86rf215_t
 Device descriptor for AT86RF215 radio devices.
 

Enumerations

enum  { AT86RF215_FCHIP_100 , AT86RF215_FCHIP_200 , AT86RF215_FCHIP_1000 , AT86RF215_FCHIP_2000 }
 MR-O-QPSK chip rates (kChip/s) More...
 
enum  { AT86RF215_MODE_LEGACY_OQPSK , AT86RF215_MODE_MR_OQPSK , AT86RF215_MODE_MR_OFDM , AT86RF215_MODE_MR_FSK }
 

Functions

void at86rf215_setup (at86rf215_t *dev_09, at86rf215_t *dev_24, const at86rf215_params_t *params, uint8_t index)
 Setup an AT86RF215 based device state.
 
void at86rf215_reset_and_cfg (at86rf215_t *dev)
 Trigger a hardware reset and configure radio with default values.
 
void at86rf215_reset (at86rf215_t *dev)
 Trigger a hardware reset, configuration is retained.
 
uint16_t at86rf215_get_addr_short (const at86rf215_t *dev, uint8_t filter)
 Get the short address of the given device form multi address filter.
 
void at86rf215_set_addr_short (at86rf215_t *dev, uint8_t filter, uint16_t addr)
 Set the short address of the given device to multi address filter.
 
bool at86rf215_get_framefilter_enabled (at86rf215_t *dev, uint8_t filter)
 Get whether a frame filter is enabled or not.
 
void at86rf215_disable_framefilter (at86rf215_t *dev, uint8_t filter)
 Enables a frame filter.
 
void at86rf215_enable_framefilter (at86rf215_t *dev, uint8_t filter)
 Disables a frame filter.
 
uint64_t at86rf215_get_addr_long (const at86rf215_t *dev)
 Get the configured long address of the given device.
 
void at86rf215_set_addr_long (at86rf215_t *dev, uint64_t addr)
 Set the long address of the given device.
 
uint8_t at86rf215_get_chan (const at86rf215_t *dev)
 Get the configured channel number of the given device.
 
void at86rf215_set_chan (at86rf215_t *dev, uint16_t chan)
 Set the channel number of the given device.
 
uint16_t at86rf215_get_pan (const at86rf215_t *dev, uint8_t filter)
 Get the configured PAN ID of the given device from multi address filter.
 
void at86rf215_set_pan (at86rf215_t *dev, uint8_t filter, uint16_t pan)
 Set the PAN ID of the given address filter.
 
int16_t at86rf215_get_txpower (const at86rf215_t *dev)
 Get the configured transmission power of the given device [in dBm].
 
void at86rf215_set_txpower (const at86rf215_t *dev, int16_t txpower)
 Set the transmission power of the given device [in dBm].
 
int8_t at86rf215_get_cca_threshold (const at86rf215_t *dev)
 Get the CCA threshold value.
 
void at86rf215_set_cca_threshold (at86rf215_t *dev, int8_t value)
 Set the CCA threshold value.
 
int8_t at86rf215_get_ed_level (at86rf215_t *dev)
 Get the latest ED level measurement.
 
void at86rf215_set_option (at86rf215_t *dev, uint16_t option, bool state)
 Enable or disable driver specific options.
 
void at86rf215_set_trim (at86rf215_t *dev, uint8_t trim)
 Set crystal oscillator trim value.
 
void at86rf215_set_clock_output (at86rf215_t *dev, at86rf215_clko_cur_t cur, at86rf215_clko_freq_t freq)
 Configure the Clock Output pin.
 
ssize_t at86rf215_send (at86rf215_t *dev, const void *data, size_t len)
 Convenience function for simply sending data.
 
int at86rf215_tx_prepare (at86rf215_t *dev)
 Prepare for sending of data.
 
size_t at86rf215_tx_load (at86rf215_t *dev, const uint8_t *data, size_t len, size_t offset)
 Load chunks of data into the transmit buffer of the given device.
 
int at86rf215_tx_exec (at86rf215_t *dev)
 Trigger sending of data previously loaded into transmit buffer.
 
void at86rf215_tx_abort (at86rf215_t *dev)
 Abort sending of data previously loaded into transmit buffer.
 
void at86rf215_tx_done (at86rf215_t *dev)
 Signal that the transfer of the frame (and optional ACK reception) has finished.
 
bool at86rf215_cca (at86rf215_t *dev)
 Perform one manual channel clear assessment (CCA)
 
int at86rf215_enable_batmon (at86rf215_t *dev, unsigned voltage)
 Generate an interrupt if supply voltage drops below the configured threshold.
 
void at86rf215_disable_batmon (at86rf215_t *dev)
 Disable the Battery Monitor interrupt.
 

Channel configuration

#define CONFIG_AT86RF215_DEFAULT_CHANNEL   (CONFIG_IEEE802154_DEFAULT_CHANNEL)
 
#define CONFIG_AT86RF215_DEFAULT_SUBGHZ_CHANNEL   (CONFIG_IEEE802154_DEFAULT_SUBGHZ_CHANNEL)
 

Enable Reduced Power Consumption

#define CONFIG_AT86RF215_RPC_EN   (0)
 

Default Battery Monitor trigger threshold (in mV)

if battery monitoring is enabled

#define CONFIG_AT86RF215_BATMON_THRESHOLD   (1800)
 

Default PHY Mode

#define CONFIG_AT86RF215_DEFAULT_PHY_MODE   (IEEE802154_PHY_OQPSK)
 

Default O-QPSK Rate Mode

Non-zero value enables proprietary high data rate by default

#define CONFIG_AT86RF215_DEFAULT_OQPSK_RATE   (0)
 

Default MR-O-QPSK Chip Rate

#define CONFIG_AT86RF215_DEFAULT_MR_OQPSK_CHIPS   (AT86RF215_FCHIP_1000)
 

Default MR-O-QPSK Rate Mode

#define CONFIG_AT86RF215_DEFAULT_MR_OQPSK_RATE   (2)
 

Default MR-OFDM Option

#define CONFIG_AT86RF215_DEFAULT_MR_OFDM_OPT   (2)
 

Default MR-OFDM Modulation & Coding Scheme

#define CONFIG_AT86RF215_DEFAULT_MR_OFDM_MCS   (2)
 

Default MR-FSK Symbol Rate

#define CONFIG_AT86RF215_DEFAULT_MR_FSK_SRATE   FSK_SRATE_200K
 

Default MR-FSK Modulation Index, fraction of 64

#define CONFIG_AT86RF215_DEFAULT_MR_FSK_MOD_IDX   (64)
 

Default MR-FSK Modulation Order

#define CONFIG_AT86RF215_DEFAULT_MR_FSK_MORD   FSK_MORD_4SFK
 

Default MR-FSK Forward Error Correction Scheme

#define CONFIG_AT86RF215_DEFAULT_MR_FSK_FEC   IEEE802154_FEC_NONE
 

Internal device option flags

#define AT86RF215_OPT_CSMA   (0x0010)
 CSMA active.
 
#define AT86RF215_OPT_PROMISCUOUS   (0x0020)
 promiscuous mode active
 
#define AT86RF215_OPT_PRELOADING   (0x0040)
 preloading enabled
 
#define AT86RF215_OPT_AUTOACK   (0x0080)
 Auto ACK active.
 
#define AT86RF215_OPT_ACK_REQUESTED   (0x0100)
 ACK requested for current frame.
 
#define AT86RF215_OPT_AGCH   (0x0200)
 AGC Hold active.
 
#define AT86RF215_OPT_TX_PENDING   (0x0400)
 Frame is loaded into TX buffer.
 
#define AT86RF215_OPT_CCA_PENDING   (0x0800)
 CCA needs to be done for the current frame.
 
#define AT86RF215_OPT_RPC   (0x1000)
 Enable Reduced Power Consumption.
 
#define AT86RF215_OPT_CCATX   (0x2000)
 TX after CCA performd automatically.
 

Internal timeout flags

#define AT86RF215_TIMEOUT_ACK   (0x0001)
 ACK timeout.
 
#define AT86RF215_TIMEOUT_CSMA   (0x0002)
 CMSA timeout.
 

Flags for device internal states (see datasheet)

enum  at86rf215_state_t {
  AT86RF215_STATE_OFF , AT86RF215_STATE_IDLE , AT86RF215_STATE_RX_SEND_ACK , AT86RF215_STATE_TX ,
  AT86RF215_STATE_TX_WAIT_ACK , AT86RF215_STATE_SLEEP
}
 

Clock Output Driver Strength

enum  at86rf215_clko_cur_t { AT86RF215_CLKO_2mA = 0 << 3 , AT86RF215_CLKO_4mA = 1 << 3 , AT86RF215_CLKO_6mA = 2 << 3 , AT86RF215_CLKO_8mA = 3 << 3 }
 

Clock Output Frequency

enum  at86rf215_clko_freq_t {
  AT86RF215_CLKO_OFF = 0 , AT86RF215_CLKO_26_MHz , AT86RF215_CLKO_32_MHz , AT86RF215_CLKO_16_MHz ,
  AT86RF215_CLKO_8_MHz , AT86RF215_CLKO_4_MHz , AT86RF215_CLKO_2_MHz , AT86RF215_CLKO_1_MHz
}