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

This file contains radio driver code. More...

#include <stdint.h>
#include <stdbool.h>
#include "at86rf230_registermap.h"
#include "hal.h"

Go to the source code of this file.

Macros

#define RF230_MAX_TX_FRAME_LENGTH   ( 127 )
 127 Byte PSDU. More...
 
#define RADIO_STATUS_START_VALUE   ( 0x40 )
 This macro defines the start value for the RADIO_* status constants. More...
 
Transaction status codes
#define TRAC_SUCCESS   0
 
#define TRAC_SUCCESS_DATA_PENDING   1
 
#define TRAC_SUCCESS_WAIT_FOR_ACK   2
 
#define TRAC_CHANNEL_ACCESS_FAILURE   3
 
#define TRAC_NO_ACK   5
 
#define TRAC_INVALID   7
 

Enumerations

enum  radio_status_t {
  RADIO_SUCCESS = RADIO_STATUS_START_VALUE, RADIO_UNSUPPORTED_DEVICE, RADIO_INVALID_ARGUMENT, RADIO_TIMED_OUT,
  RADIO_WRONG_STATE, RADIO_BUSY_STATE, RADIO_STATE_TRANSITION_FAILED, RADIO_CCA_IDLE,
  RADIO_CCA_BUSY, RADIO_TRX_BUSY, RADIO_BAT_LOW, RADIO_BAT_OK,
  RADIO_CRC_FAILED, RADIO_CHANNEL_ACCESS_FAILURE, RADIO_NO_ACK, RADIO_SUCCESS = RADIO_STATUS_START_VALUE,
  RADIO_UNSUPPORTED_DEVICE, RADIO_INVALID_ARGUMENT, RADIO_TIMED_OUT, RADIO_WRONG_STATE,
  RADIO_BUSY_STATE, RADIO_STATE_TRANSITION_FAILED, RADIO_CCA_IDLE, RADIO_CCA_BUSY,
  RADIO_TRX_BUSY, RADIO_BAT_LOW, RADIO_BAT_OK, RADIO_CRC_FAILED,
  RADIO_CHANNEL_ACCESS_FAILURE, RADIO_NO_ACK
}
 This enumeration defines the possible return values for the TAT API functions. More...
 
enum  radio_cca_mode_t {
  CCA_ED = 0, CCA_CARRIER_SENSE = 1, CCA_CARRIER_SENSE_WITH_ED = 2, CCA_ENERGY_DETECT = 0,
  CCA_CARRIER_SENSE = 1, CCA_CARRIER_SENSE_WITH_ED = 2
}
 This enumeration defines the possible modes available for the Clear Channel Assessment algorithm. More...
 
enum  radio_clkm_speed_t
 This enumeration defines the possible CLKM speeds. More...
 

Functions

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.

Id:
radio.h,v 1.2 2008/10/14 18:37:28 c_oflynn Exp

Definition in file radio.h.