Low-Level functions for the AT86RF215 driver. More...
Low-Level functions for the AT86RF215 driver.
Definition in file at86rf215_internal.h.
 Include dependency graph for at86rf215_internal.h:Go to the source code of this file.
Macros | |
| #define | AT86RF215_ACK_PSDU_BYTES (5) | 
| An ACK consists of 5 payload bytes.   | |
| #define | AT86RF215_OQPSK_MODE_LEGACY (0x1) | 
| legacy mode, 250 kbit/s   | |
| #define | AT86RF215_OQPSK_MODE_LEGACY_HDR (0x3) | 
| legacy mode, high data rate   | |
| #define | AT86RF215_MR_OQPSK_MODE(n) | 
| MR-QPSK.   | |
Functions | |
| int | at86rf215_hardware_reset (at86rf215_t *dev) | 
| Perform a reset of the entire chip.   | |
| void | at86rf215_reg_write (const at86rf215_t *dev, uint16_t reg, uint8_t val) | 
Write to a register at address addr from device dev.   | |
| void | at86rf215_reg_write_bytes (const at86rf215_t *dev, uint16_t reg, const void *data, size_t len) | 
| Write a chunk of data into the memory of the given device.   | |
| uint8_t | at86rf215_reg_read (const at86rf215_t *dev, uint16_t reg) | 
Read from a register at address addr from device dev.   | |
| void | at86rf215_reg_read_bytes (const at86rf215_t *dev, uint16_t reg, void *data, size_t len) | 
| Read a chunk of data from the memory of the given device.   | |
| void | at86rf215_filter_ack (at86rf215_t *dev, bool on) | 
| Enable / Disable the ACK filter.   | |
| void | at86rf215_get_random (at86rf215_t *dev, void *data, size_t len) | 
| Read random data from the RNG.   | |
| int | at86rf215_configure_FSK (at86rf215_t *dev, uint8_t srate, uint8_t mod_idx, uint8_t mod_order, uint8_t fec) | 
| Configure the radio to make use of FSK modulation.   | |
| int | at86rf215_FSK_set_srate (at86rf215_t *dev, uint8_t srate) | 
| Configure the symbol rate of the FSK modulation.   | |
| uint8_t | at86rf215_FSK_get_srate (at86rf215_t *dev) | 
| Get the symbol rate of the FSK modulation.   | |
| int | at86rf215_FSK_set_mod_idx (at86rf215_t *dev, uint8_t mod_idx) | 
| Configure the modulation index of the FSK modulation The modulation index is a fractional value, it is represented as fractions of 64.   | |
| uint8_t | at86rf215_FSK_get_mod_idx (at86rf215_t *dev) | 
| Get the current modulation index of the FSK modulation The modulation index is a fractional value, it is represented as fractions of 64.   | |
| int | at86rf215_FSK_set_fec (at86rf215_t *dev, uint8_t mode) | 
| Configure the Forward Error Correction (coding) scheme for FSK modulation.   | |
| uint8_t | at86rf215_FSK_get_fec (at86rf215_t *dev) | 
| Get the Forward Error Correction (coding) scheme for FSK modulation.   | |
| int | at86rf215_FSK_set_channel_spacing (at86rf215_t *dev, uint8_t ch_space) | 
| Configure the channel spacing for the FSK modulation.   | |
| uint16_t | at86rf215_get_channel_spacing (at86rf215_t *dev) | 
| Get the configured channel spacing.   | |
| int | at86rf215_FSK_set_mod_order (at86rf215_t *dev, uint8_t mod_order) | 
| Configure the FSK modulation order.   | |
| uint8_t | at86rf215_FSK_get_mod_order (at86rf215_t *dev) | 
| Get the current FSK modulation order.   | |
| void | at86rf215_FSK_prepare_rx (at86rf215_t *dev) | 
| The FSK premable length needs to be switched between RX and TX This function takes care of putting FSK into RX mode.   | |
| void | at86rf215_FSK_prepare_tx (at86rf215_t *dev) | 
| The FSK premable length needs to be switched between RX and TX This function takes care of putting FSK into TX mode.   | |
| int | at86rf215_configure_OFDM (at86rf215_t *dev, uint8_t option, uint8_t mcs) | 
| Configure the radio to make use of OFDM modulation.   | |
| int | at86rf215_OFDM_set_scheme (at86rf215_t *dev, uint8_t mcs) | 
| Set the current modulation and coding scheme (MCS)   | |
| uint8_t | at86rf215_OFDM_get_scheme (at86rf215_t *dev) | 
| Get the current modulation and coding scheme (MCS)   | |
| int | at86rf215_OFDM_set_option (at86rf215_t *dev, uint8_t option) | 
| Set the current OFDM option.   | |
| uint8_t | at86rf215_OFDM_get_option (at86rf215_t *dev) | 
| Get the current OFDM option.   | |
| int | at86rf215_configure_legacy_OQPSK (at86rf215_t *dev, bool high_rate) | 
| Configure the radio to make use of O-QPSK modulation.   | |
| int | at86rf215_configure_OQPSK (at86rf215_t *dev, uint8_t chips, uint8_t rate) | 
| Configure the radio to make use of O-QPSK modulation.   | |
| uint8_t | at86rf215_OQPSK_get_chips (at86rf215_t *dev) | 
| Get the current O-QPSK chip rate.   | |
| int | at86rf215_OQPSK_set_chips (at86rf215_t *dev, uint8_t chips) | 
| Set the current O-QPSK chip rate.   | |
| uint8_t | at86rf215_OQPSK_get_mode (at86rf215_t *dev) | 
| Get the current O-QPSK rate mode.   | |
| int | at86rf215_OQPSK_set_mode (at86rf215_t *dev, uint8_t mode) | 
| Set the current O-QPSK rate mode.   | |
| uint8_t | at86rf215_OQPSK_get_mode_legacy (at86rf215_t *dev) | 
| Get the current legacy O-QPSK mode.   | |
| int | at86rf215_OQPSK_set_mode_legacy (at86rf215_t *dev, bool high_rate) | 
| Set the current legacy O-QPSK rate mode.   | |
| static bool | at86rf215_OQPSK_is_legacy (at86rf215_t *dev) | 
| Test if O-QPSK PHY operates in legacy mode.   | |
| uint8_t | at86rf215_get_phy_mode (at86rf215_t *dev) | 
| Get the current PHY modulation.   | |
| uint16_t | at86rf215_chan_valid (at86rf215_t *dev, uint16_t chan) | 
| Check if a channel number is valid.   | |
| const char * | at86rf215_hw_state2a (uint8_t state) | 
| Converts radio state into human readable string.   | |
| const char * | at86rf215_sw_state2a (at86rf215_state_t state) | 
| Converts state machine state into human readable string.   | |
| static void | at86rf215_reg_and (const at86rf215_t *dev, uint16_t reg, uint8_t val) | 
Reads the contents of reg, apply val with a bitwise AND and then writes the result back to reg.   | |
| static void | at86rf215_reg_or (const at86rf215_t *dev, uint16_t reg, uint8_t val) | 
Reads the contents of reg, apply val with a bitwise OR and then writes the result back to reg.   | |
| static void | at86rf215_reg_write16 (const at86rf215_t *dev, uint16_t reg, uint16_t val) | 
Write a 16-bit word to a register at address addr from device dev.   | |
| static uint16_t | at86rf215_reg_read16 (const at86rf215_t *dev, uint16_t reg) | 
Read a 16-bit word from a register at address addr from device dev.   | |
| static void | at86rf215_rf_cmd (const at86rf215_t *dev, uint8_t rf_cmd) | 
| Issue a radio command to the device.   | |
| static uint8_t | at86rf215_get_rf_state (const at86rf215_t *dev) | 
| Get the radio state of the device.   | |
| static void | at86rf215_await_state (const at86rf215_t *dev, uint8_t state) | 
| Blocks until the device has reached the given state.   | |
| static void | at86rf215_await_state_end (const at86rf215_t *dev, uint8_t state) | 
| Blocks until the device has reached the given state.   | |
| bool | at86rf215_set_rx_from_idle (at86rf215_t *dev, uint8_t *old_state) | 
| Switch device back to IDLE-RX from non-RX idle.   | |
| bool | at86rf215_set_idle_from_rx (at86rf215_t *dev, uint8_t state) | 
| Switch device to non-RX idle state from RX.   | |
| static void | at86rf215_enable_baseband (const at86rf215_t *dev) | 
| Enable the baseband processor of the device.   | |
| static void | at86rf215_disable_baseband (const at86rf215_t *dev) | 
| Disable the baseband processor of the device.   | |
| static void | at86rf215_enable_radio (at86rf215_t *dev, uint8_t modulation) | 
| Enable the radio hardware with a given modulation.   | |
| void | at86rf215_disable_rpc (at86rf215_t *dev) | 
| Internal convenience function to disable reduced power consumption (RPC) for energy detection.   | |
| void | at86rf215_enable_rpc (at86rf215_t *dev) | 
| Internal convenience function to re-enable reduced power consumption (RPC) after energy detection.   | |
| static bool | is_subGHz (const at86rf215_t *dev) | 
| Checks whether the device operates in the sub-GHz band.   | |
Variables | |
| const uint8_t | _at86rf215_fsk_srate_10kHz [] | 
| Symbol Rates for register values, in 10kHz.  | |
| const uint8_t | _at86rf215_fsk_channel_spacing_25kHz [] | 
| Channel Spacing for register values, in 25kHz.  | |
| #define | CONFIG_AT86RF215_RESET_PULSE_WIDTH_US (16U) | 
| Minimum reset pulse width (tRST) in µs.   | |
| #define | AT86RF215_RESET_DELAY_US (16U) | 
| The typical transition time to TRX_OFF after reset (tPOWERON) in µs.   | |
| #define | AT86RF215_EDT_DEFAULT (-84) /* dBm */ | 
| Default energy detect threshold for CSMA (reset value)   | |
| #define | AT86RF215_RETRIES_MAX_DEFAULT (3) | 
| Default Parameters for 802.15.4 retransmissions & CSMA.   | |
| #define | AT86RF215_CSMA_RETRIES_MAX_DEFAULT (4) | 
| #define | AT86RF215_CSMA_MIN_BE_DEFAULT (3) | 
| #define | AT86RF215_CSMA_MAX_BE_DEFAULT (5) | 
| #define AT86RF215_ACK_PSDU_BYTES (5) | 
An ACK consists of 5 payload bytes.
Definition at line 56 of file at86rf215_internal.h.
| #define AT86RF215_CSMA_MAX_BE_DEFAULT (5) | 
Definition at line 52 of file at86rf215_internal.h.
| #define AT86RF215_CSMA_MIN_BE_DEFAULT (3) | 
Definition at line 51 of file at86rf215_internal.h.
| #define AT86RF215_CSMA_RETRIES_MAX_DEFAULT (4) | 
Definition at line 50 of file at86rf215_internal.h.
| #define AT86RF215_EDT_DEFAULT (-84) /* dBm */ | 
Default energy detect threshold for CSMA (reset value)
Definition at line 43 of file at86rf215_internal.h.
| #define AT86RF215_MR_OQPSK_MODE | ( | n | ) | 
| #define AT86RF215_OQPSK_MODE_LEGACY (0x1) | 
legacy mode, 250 kbit/s
Definition at line 58 of file at86rf215_internal.h.
| #define AT86RF215_OQPSK_MODE_LEGACY_HDR (0x3) | 
legacy mode, high data rate
Definition at line 59 of file at86rf215_internal.h.
| #define AT86RF215_RESET_DELAY_US (16U) | 
The typical transition time to TRX_OFF after reset (tPOWERON) in µs.
Definition at line 40 of file at86rf215_internal.h.
| #define AT86RF215_RETRIES_MAX_DEFAULT (3) | 
Default Parameters for 802.15.4 retransmissions & CSMA.
Definition at line 49 of file at86rf215_internal.h.
| #define CONFIG_AT86RF215_RESET_PULSE_WIDTH_US (16U) | 
Minimum reset pulse width (tRST) in µs.
Definition at line 34 of file at86rf215_internal.h.
      
  | 
  inlinestatic | 
Blocks until the device has reached the given state.
| [in] | dev | device to poll | 
| [in] | state | the expected state | 
Definition at line 585 of file at86rf215_internal.h.
      
  | 
  inlinestatic | 
Blocks until the device has reached the given state.
| [in] | dev | device to poll | 
| [in] | state | the expected state | 
Definition at line 596 of file at86rf215_internal.h.
| uint16_t at86rf215_chan_valid | ( | at86rf215_t * | dev, | 
| uint16_t | chan ) | 
Check if a channel number is valid.
The function takes the current frequency band and modulation into account to determine if chan would be a legal channel number. If so, it is returned unmodified. Otherwise the next closest legal channel number is returned.
| [in] | dev | device to check against | 
| [in] | chan | the channel number to check | 
chan is returned. Otherwise the next closest legal channel number is returned. 
      
  | 
  inlinestatic | 
Disable the baseband processor of the device.
| [in] | dev | device to disable the baseband on | 
Definition at line 636 of file at86rf215_internal.h.
| void at86rf215_disable_rpc | ( | at86rf215_t * | dev | ) | 
Internal convenience function to disable reduced power consumption (RPC) for energy detection.
| [in] | dev | device to configure | 
      
  | 
  inlinestatic | 
Enable the baseband processor of the device.
| [in] | dev | device to enable the baseband on | 
Definition at line 626 of file at86rf215_internal.h.
      
  | 
  inlinestatic | 
Enable the radio hardware with a given modulation.
| [in] | dev | device to enable | 
| [in] | modulation | modulation to configure on the radio | 
Definition at line 646 of file at86rf215_internal.h.
| void at86rf215_enable_rpc | ( | at86rf215_t * | dev | ) | 
Internal convenience function to re-enable reduced power consumption (RPC) after energy detection.
| [in] | dev | device to configure | 
| void at86rf215_filter_ack | ( | at86rf215_t * | dev, | 
| bool | on ) | 
Enable / Disable the ACK filter.
| [in] | dev | device to configure | 
| [in] | on | if true, only ACK frames are received if false, only non-ACK frames are received | 
| uint8_t at86rf215_get_phy_mode | ( | at86rf215_t * | dev | ) | 
Get the current PHY modulation.
May be IEEE802154_PHY_MR_FSK, IEEE802154_PHY_MR_OFDM, IEEE802154_PHY_MR_OQPSK, IEEE802154_PHY_OQPSK or IEEE802154_PHY_DISABLED.
| [in] | dev | device to read from | 
| void at86rf215_get_random | ( | at86rf215_t * | dev, | 
| void * | data, | ||
| size_t | len ) | 
Read random data from the RNG.
| [in] | dev | device to configure | 
| [out] | data | buffer to copy the random data to | 
| [in] | len | number of random bytes to store in data | 
      
  | 
  inlinestatic | 
Get the radio state of the device.
| [in] | dev | device to read from | 
Definition at line 574 of file at86rf215_internal.h.
| int at86rf215_hardware_reset | ( | at86rf215_t * | dev | ) | 
Perform a reset of the entire chip.
| dev | device to reset, will also reset sibling device | 
| const char * at86rf215_hw_state2a | ( | uint8_t | state | ) | 
Converts radio state into human readable string.
| [in] | state | radio state | 
      
  | 
  inlinestatic | 
Reads the contents of reg, apply val with a bitwise AND and then writes the result back to reg. 
| [in] | dev | device to write to | 
| [in] | reg | register to write to | 
| [in] | val | value to bitwise AND with the register content | 
Definition at line 509 of file at86rf215_internal.h.
      
  | 
  inlinestatic | 
Reads the contents of reg, apply val with a bitwise OR and then writes the result back to reg. 
| [in] | dev | device to write to | 
| [in] | reg | register to write to | 
| [in] | val | value to bitwise OR with the register content | 
Definition at line 523 of file at86rf215_internal.h.
| uint8_t at86rf215_reg_read | ( | const at86rf215_t * | dev, | 
| uint16_t | reg ) | 
Read from a register at address addr from device dev. 
| [in] | dev | device to read from | 
| [in] | reg | address of the register to read | 
      
  | 
  inlinestatic | 
Read a 16-bit word from a register at address addr from device dev. 
| [in] | dev | device to read from | 
| [in] | reg | address of the register to read | 
Definition at line 549 of file at86rf215_internal.h.
| void at86rf215_reg_read_bytes | ( | const at86rf215_t * | dev, | 
| uint16_t | reg, | ||
| void * | data, | ||
| size_t | len ) | 
Read a chunk of data from the memory of the given device.
| [in] | dev | device to read from | 
| [in] | reg | starting address to read from | 
| [out] | data | buffer to read data into | 
| [in] | len | number of bytes to read | 
| void at86rf215_reg_write | ( | const at86rf215_t * | dev, | 
| uint16_t | reg, | ||
| uint8_t | val ) | 
Write to a register at address addr from device dev. 
| [in] | dev | device to write to | 
| [in] | reg | address of the register to write | 
| [in] | val | value to write to the given register | 
      
  | 
  inlinestatic | 
Write a 16-bit word to a register at address addr from device dev. 
| [in] | dev | device to write to | 
| [in] | reg | address of the register to write | 
| [in] | val | value to write to the given register | 
Definition at line 536 of file at86rf215_internal.h.
| void at86rf215_reg_write_bytes | ( | const at86rf215_t * | dev, | 
| uint16_t | reg, | ||
| const void * | data, | ||
| size_t | len ) | 
Write a chunk of data into the memory of the given device.
| [in] | dev | device to write to | 
| [in] | reg | address in the device to write to | 
| [in] | data | data to copy into the device | 
| [in] | len | number of bytes to write into the device | 
      
  | 
  inlinestatic | 
Issue a radio command to the device.
| [in] | dev | device to configure | 
| [in] | rf_cmd | command to send | 
Definition at line 562 of file at86rf215_internal.h.
| bool at86rf215_set_idle_from_rx | ( | at86rf215_t * | dev, | 
| uint8_t | state ) | 
Switch device to non-RX idle state from RX.
| [in] | dev | device to update | 
| [out] | state | the new state (may be CMD_RF_TRXOFF or CMD_RF_SLEEP) | 
| bool at86rf215_set_rx_from_idle | ( | at86rf215_t * | dev, | 
| uint8_t * | old_state ) | 
Switch device back to IDLE-RX from non-RX idle.
| [in] | dev | device to update | 
| [out] | old_state | pointer to store the previous state, may be NULL | 
| const char * at86rf215_sw_state2a | ( | at86rf215_state_t | state | ) | 
Converts state machine state into human readable string.
| [in] | state | state of the driver's state machine | 
      
  | 
  inlinestatic | 
Checks whether the device operates in the sub-GHz band.
| [in] | dev | device to read from | 
Definition at line 679 of file at86rf215_internal.h.