at86rf2xx_internal.h File Reference

Internal interfaces for AT86RF2xx drivers. More...

Detailed Description

#include <stdint.h>
#include "at86rf2xx.h"
+ Include dependency graph for at86rf2xx_internal.h:

Go to the source code of this file.

#define AT86RF2XX_TXPOWER_MAX   (20)
 Max. More...
 
#define AT86RF2XX_TXPOWER_OFF   (17)
 Transmit power offset.
 
#define AT86RF2XX_WAKEUP_DELAY   (306U)
 Transition time from SLEEP to TRX_OFF in us, refer figure 7-4, p.42. More...
 
#define AT86RF2XX_RESET_PULSE_WIDTH   (62U)
 Minimum reset pulse width, refer p.190. More...
 
#define AT86RF2XX_RESET_DELAY   (62U)
 The typical transition time to TRX_OFF after reset pulse is 26 us, refer to figure 7-8, p. More...
 
uint8_t at86rf2xx_reg_read (const at86rf2xx_t *dev, uint8_t addr)
 Read from a register at address addr from device dev. More...
 
void at86rf2xx_reg_write (const at86rf2xx_t *dev, uint8_t addr, uint8_t value)
 Write to a register at address addr from device dev. More...
 
void at86rf2xx_sram_read (const at86rf2xx_t *dev, uint8_t offset, uint8_t *data, size_t len)
 Read a chunk of data from the SRAM of the given device. More...
 
void at86rf2xx_sram_write (const at86rf2xx_t *dev, uint8_t offset, const uint8_t *data, size_t len)
 Write a chunk of data into the SRAM of the given device. More...
 
void at86rf2xx_fb_start (const at86rf2xx_t *dev)
 Start a read transcation internal frame buffer of the given device. More...
 
void at86rf2xx_fb_read (const at86rf2xx_t *dev, uint8_t *data, size_t len)
 Read the internal frame buffer of the given device. More...
 
void at86rf2xx_fb_stop (const at86rf2xx_t *dev)
 Stop a read transcation internal frame buffer of the given device. More...
 
uint8_t at86rf2xx_get_status (const at86rf2xx_t *dev)
 Convenience function for reading the status of the given device. More...
 
void at86rf2xx_assert_awake (at86rf2xx_t *dev)
 Make sure that device is not sleeping. More...
 
void at86rf2xx_hardware_reset (at86rf2xx_t *dev)
 Trigger a hardware reset. More...
 
void at86rf2xx_configure_phy (at86rf2xx_t *dev)
 Set PHY parameters based on channel and page number. More...
 
void at86rf2xx_get_random (const at86rf2xx_t *dev, uint8_t *data, size_t len)
 Read random data from the RNG. More...
 

Macro Definition Documentation

◆ AT86RF2XX_RESET_DELAY

#define AT86RF2XX_RESET_DELAY   (62U)

The typical transition time to TRX_OFF after reset pulse is 26 us, refer to figure 7-8, p.

  1. We use 62 us so that it is at least one tick on platforms that use a 16384 Hz oscillator or have slow start up times due to parasitic capacitance on the oscillator

Definition at line 79 of file at86rf2xx_internal.h.

◆ AT86RF2XX_RESET_PULSE_WIDTH

#define AT86RF2XX_RESET_PULSE_WIDTH   (62U)

Minimum reset pulse width, refer p.190.

We use 62us so that it is at least one tick on platforms with coarse xtimers

Definition at line 71 of file at86rf2xx_internal.h.

◆ AT86RF2XX_TXPOWER_MAX

#define AT86RF2XX_TXPOWER_MAX   (20)

Max.

allowed transmit power for the transceiver

Definition at line 49 of file at86rf2xx_internal.h.

◆ AT86RF2XX_WAKEUP_DELAY

#define AT86RF2XX_WAKEUP_DELAY   (306U)

Transition time from SLEEP to TRX_OFF in us, refer figure 7-4, p.42.

For different environments refer figure 13-13, p.201

Definition at line 65 of file at86rf2xx_internal.h.

Function Documentation

◆ at86rf2xx_assert_awake()

void at86rf2xx_assert_awake ( at86rf2xx_t dev)

Make sure that device is not sleeping.

Parameters
[in,out]devdevice to eventually wake up

◆ at86rf2xx_configure_phy()

void at86rf2xx_configure_phy ( at86rf2xx_t dev)

Set PHY parameters based on channel and page number.

Parameters
[in,out]devdevice to configure

◆ at86rf2xx_fb_read()

void at86rf2xx_fb_read ( const at86rf2xx_t dev,
uint8_t *  data,
size_t  len 
)

Read the internal frame buffer of the given device.

Each read advances the position in the buffer by len.

Parameters
[in]devdevice to read from
[out]databuffer to copy the data to
[in]lennumber of bytes to read from the frame buffer

◆ at86rf2xx_fb_start()

void at86rf2xx_fb_start ( const at86rf2xx_t dev)

Start a read transcation internal frame buffer of the given device.

Reading the frame buffer returns some extra bytes that are not accessible through reading the RAM directly. This locks the used SPI.

Parameters
[in]devdevice to start read

◆ at86rf2xx_fb_stop()

void at86rf2xx_fb_stop ( const at86rf2xx_t dev)

Stop a read transcation internal frame buffer of the given device.

Release the SPI device and unlock frame buffer protection.

Parameters
[in]devdevice to stop read

◆ at86rf2xx_get_random()

void at86rf2xx_get_random ( const at86rf2xx_t dev,
uint8_t *  data,
size_t  len 
)

Read random data from the RNG.

Note
According to the data sheet this function only works properly in Basic Operation Mode. However, sporadic testing has shown that even in Extended Operation Mode this returns random enough data to be used as a seed for Random if no cryptographically secure randomness is required. Any further use-case needs to be evaluated, especially if crypto-relevant randomness is required.
Parameters
[in]devdevice to configure
[out]databuffer to copy the random data to
[in]lennumber of random bytes to store in data

◆ at86rf2xx_get_status()

uint8_t at86rf2xx_get_status ( const at86rf2xx_t dev)

Convenience function for reading the status of the given device.

Parameters
[in]devdevice to read the status from
Returns
internal status of the given device

◆ at86rf2xx_hardware_reset()

void at86rf2xx_hardware_reset ( at86rf2xx_t dev)

Trigger a hardware reset.

Parameters
[in,out]devdevice to reset

◆ at86rf2xx_reg_read()

uint8_t at86rf2xx_reg_read ( const at86rf2xx_t dev,
uint8_t  addr 
)

Read from a register at address addr from device dev.

Parameters
[in]devdevice to read from
[in]addraddress of the register to read
Returns
the value of the specified register

◆ at86rf2xx_reg_write()

void at86rf2xx_reg_write ( const at86rf2xx_t dev,
uint8_t  addr,
uint8_t  value 
)

Write to a register at address addr from device dev.

Parameters
[in]devdevice to write to
[in]addraddress of the register to write
[in]valuevalue to write to the given register

◆ at86rf2xx_sram_read()

void at86rf2xx_sram_read ( const at86rf2xx_t dev,
uint8_t  offset,
uint8_t *  data,
size_t  len 
)

Read a chunk of data from the SRAM of the given device.

Parameters
[in]devdevice to read from
[in]offsetstarting address to read from [valid 0x00-0x7f]
[out]databuffer to read data into
[in]lennumber of bytes to read from SRAM

◆ at86rf2xx_sram_write()

void at86rf2xx_sram_write ( const at86rf2xx_t dev,
uint8_t  offset,
const uint8_t *  data,
size_t  len 
)

Write a chunk of data into the SRAM of the given device.

Parameters
[in]devdevice to write to
[in]offsetaddress in the SRAM to write to [valid 0x00-0x7f]
[in]datadata to copy into SRAM
[in]lennumber of bytes to write to SRAM