Contiki 2.5
Macros | Enumerations | Functions
radio.c File Reference

This file contains radio driver code. More...

#include <stdlib.h>
#include <util/delay.h>
#include "radio.h"
#include "hal.h"
#include "process.h"
#include "sicslowmac.h"
#include "frame.h"

Go to the source code of this file.

Macros

#define RADIO_CCA_DONE_MASK   (1 << 7)
 Mask used to check the CCA_DONE bit. More...
 
#define RADIO_CCA_IDLE_MASK   (1 << 6)
 Mask used to check the CCA_STATUS bit. More...
 
#define RADIO_START_CCA   (1)
 Value in the CCA_REQUEST subregister that initiate a cca. More...
 

Enumerations

enum  radio_trx_timing_t {
  TIME_TO_ENTER_P_ON = 510, TIME_P_ON_TO_TRX_OFF = 510, TIME_SLEEP_TO_TRX_OFF = 880, TIME_RESET = 6,
  TIME_ED_MEASUREMENT = 140, TIME_CCA = 140, TIME_PLL_LOCK = 150, TIME_FTN_TUNING = 25,
  TIME_NOCLK_TO_WAKE = 6, TIME_CMD_FORCE_TRX_OFF = 1, TIME_TRX_OFF_TO_PLL_ACTIVE = 180, TIME_STATE_TRANSITION_PLL_ACTIVE = 1,
  TIME_TO_ENTER_P_ON = 510, TIME_P_ON_TO_TRX_OFF = 510, TIME_SLEEP_TO_TRX_OFF = 880, TIME_RESET = 6,
  TIME_ED_MEASUREMENT = 140, TIME_CCA = 140, TIME_PLL_LOCK = 150, TIME_FTN_TUNING = 25,
  TIME_NOCLK_TO_WAKE = 6, TIME_CMD_FORCE_TRX_OFF = 1, TIME_TRX_OFF_TO_PLL_ACTIVE = 180, TIME_STATE_TRANSITION_PLL_ACTIVE = 1
}
 This enumeration defines the necessary timing information for the AT86RF230 radio transceiver. More...
 

Functions

bool radio_is_sleeping (void)
 This function checks if the radio transceiver is sleeping. More...
 
radio_status_t radio_init (bool cal_rc_osc, hal_rx_start_isr_event_handler_t rx_event, hal_trx_end_isr_event_handler_t trx_end_event, radio_rx_callback rx_callback)
 Initialize the Transceiver Access Toolbox and lower layers. More...
 
uint8_t radio_get_operating_channel (void)
 This function will return the channel used by the radio transceiver. More...
 
radio_status_t radio_set_operating_channel (uint8_t channel)
 This function will change the operating channel. More...
 
uint8_t radio_get_tx_power_level (void)
 This function will read and return the output power level. More...
 
radio_status_t radio_set_tx_power_level (uint8_t power_level)
 This function will change the output power level. More...
 
uint8_t radio_get_cca_mode (void)
 This function returns the current CCA mode used. More...
 
uint8_t radio_get_ed_threshold (void)
 This function returns the current ED threshold used by the CCA algorithm. More...
 
radio_status_t radio_set_cca_mode (uint8_t mode, uint8_t ed_threshold)
 This function will configure the Clear Channel Assessment algorithm. More...
 
radio_status_t radio_get_rssi_value (uint8_t *rssi)
 This function returns the Received Signal Strength Indication. More...
 
uint8_t radio_batmon_get_voltage_threshold (void)
 This function returns the current threshold volatge used by the battery monitor (BATMON_VTH). More...
 
uint8_t radio_batmon_get_voltage_range (void)
 This function returns if high or low voltage range is used. More...
 
radio_status_t radio_batmon_configure (bool range, uint8_t voltage_threshold)
 This function is used to configure the battery monitor module. More...
 
radio_status_t radio_batmon_get_status (void)
 This function returns the status of the Battery Monitor module. More...
 
uint8_t radio_get_clock_speed (void)
 This function returns the current clock setting for the CLKM pin. More...
 
radio_status_t radio_set_clock_speed (bool direct, uint8_t clock_speed)
 This function changes the prescaler on the CLKM pin. More...
 
radio_status_t radio_calibrate_filter (void)
 This function calibrates the Single Side Band Filter. More...
 
radio_status_t radio_calibrate_pll (void)
 This function calibrates the PLL. More...
 
uint8_t radio_get_trx_state (void)
 This function return the Radio Transceivers current state. More...
 
radio_status_t radio_set_trx_state (uint8_t new_state)
 This function will change the current state of the radio transceiver's internal state machine. More...
 
radio_status_t radio_enter_sleep_mode (void)
 This function will put the radio transceiver to sleep. More...
 
radio_status_t radio_leave_sleep_mode (void)
 This function will take the radio transceiver from sleep mode and put it into the TRX_OFF state. More...
 
void radio_reset_state_machine (void)
 This function will reset the state machine (to TRX_OFF) from any of its states, except for the SLEEP state.
 
void radio_reset_trx (void)
 This function will reset all the registers and the state machine of the radio transceiver.
 
void radio_use_auto_tx_crc (bool auto_crc_on)
 This function will enable or disable automatic CRC during frame transmission. More...
 
radio_status_t radio_send_data (uint8_t data_length, uint8_t *data)
 This function will download a frame to the radio transceiver's transmit buffer and send it. More...
 
uint8_t radio_get_device_role (void)
 This function will read the I_AM_COORD sub register. More...
 
void radio_set_device_role (bool i_am_coordinator)
 This function will set the I_AM_COORD sub register. More...
 
uint16_t radio_get_pan_id (void)
 This function will return the PANID used by the address filter. More...
 
void radio_set_pan_id (uint16_t new_pan_id)
 This function will set the PANID used by the address filter. More...
 
uint16_t radio_get_short_address (void)
 This function will return the current short address used by the address filter. More...
 
void radio_set_short_address (uint16_t new_short_address)
 This function will set the short address used by the address filter. More...
 
void radio_get_extended_address (uint8_t *extended_address)
 This function will read the extended address used by the address filter. More...
 
void radio_set_extended_address (uint8_t *extended_address)
 This function will set a new extended address to be used by the address filter. More...
 
radio_status_t radio_configure_csma (uint8_t seed0, uint8_t be_csma_seed1)
 This function will configure the CSMA algorithm used by the radio transceiver when transmitting data from TX_ARET_ON state. More...
 
bool calibrate_rc_osc_clkm (void)
 Calibrate the internal RC oscillator. More...
 
void calibrate_rc_osc_32k (void)
 Calibrate the internal RC oscillator. More...
 

Detailed Description

This file contains radio driver code.

Definition in file radio.c.