µracoli Manual
Version foo
|
Data Structures | |
union | radio_param_t |
Container for handover of radio parameter values. More... | |
struct | radio_status_t |
Structure for storage of radio parameters. More... | |
radio_cca_t radio_do_cca | ( | void | ) |
void radio_force_state | ( | radio_state_t | state | ) |
state | requested radio state |
void radio_init | ( | uint8_t * | rxbuf, |
uint8_t | rxbufsz | ||
) |
The function initializes all IO ressources, needed for the usage of the radio and performs a reset.
rxbuf | A buffer for the receive frames. This buffer needs to be static, and of size MAX_FRAME_SIZE (see also function usr_radio_receive_frame). |
rxbufsz | maximum size of the rx buffer, frames longer then rxbufsz will be ignored |
void radio_send_frame | ( | uint8_t | len, |
uint8_t * | frm, | ||
uint8_t | compcrc | ||
) |
Initiates a frame transmission procedure, and then downloads the frame passed as frm
. The function returns immediately once the frame download procedure completed; the end of transmission is signalled by the usr_radio_tx_done callback. If the radio is in STATE_TXAUTO, a full unslotted CSMA-CA is procedure is performed by the transceiver hardware, including frame retransmissions in case the transmitted frame has requested an acknowledgement by the recipient. If the transceiver is in STATE_TX, an immediate frame transmission is initiated, without CSMA-CA or frame retransmissions.
len | length of frame to transmit |
frm | pointer to frame to transmit |
compcrc | compute CRC-16 if != 0 (currently ignored) |
void radio_set_param | ( | radio_attribute_t | attr, |
radio_param_t | parm | ||
) |
Note that the radio must not be in STATE_SLEEP when setting parameters. Preferrably, it should be kept in STATE_OFF (in which it is immediately after a call to radio_init) in order to set parameters.
attr | attribute parameter (enumeration value radio_attribute_t) |
parm | pointer to parameter value (union type radio_param_t) |
void radio_set_state | ( | radio_state_t | state | ) |
state | requested radio state |
void usr_radio_error | ( | radio_error_t | err | ) |
Error callback function which has to be implemented in the application.
This function is called, when a fatal error occurs. see also radio_error_t.
err | error code being reported |
void usr_radio_irq | ( | uint8_t | cause | ) |
Interrupt callback function.
cause | value of the transceiver's IRQ status register |
uint8_t* usr_radio_receive_frame | ( | uint8_t | len, |
uint8_t * | frm, | ||
uint8_t | lqi, | ||
int8_t | ed, | ||
uint8_t | crc_fail | ||
) |
This function is called within an interrupt context for every received frame, according to the current receive mode used (which involves address filtering in case the transceiver is in state RX_AUTO). The frame has been internally stored into the receive buffer that has been configured before, either by radio_init, or as the result of a previous call to usr_radio_receive_frame. The function must return a valid pointer to a receive buffer to be used for receiving the next frame; this can be the same value as the parameter frm
, or a different one in case the application wants to maintain multiple buffers.
The rssi
parameter is obtained at the frame's RX_START interrupt. If there was no RX_START interrupt to read an RSSI value at, the value VOID_RSSI is passed instead.
len | length of frame received |
frm | pointer to frame received |
lqi | LQI value reported by transceiver |
rssi | RSSI value obtained from transceiver |
crc_fail | boolean indicating whether the received frame failed FCS verification |
void usr_radio_tx_done | ( | radio_tx_done_t | status | ) |
Transmit done callback function.
status | completion status, radio_tx_done_t |
union radio_param_t |
Data Fields | ||
---|---|---|
ccamode_t | cca_mode |
Value for cca mode. |
channel_t | channel |
Value for current radio channel. (MIN_CHANNEL ... MAX_CHANNEL) |
uint8_t | data_rate |
data rate type |
radio_state_t | idle_state |
after TX go to idle state |
uint64_t * | long_addr |
Pointer to long (64-bit) address |
uint16_t | pan_id |
Value for PANID |
uint8_t | rx_lna |
RX LNA type |
uint16_t | short_addr |
Value for short address |
uint8_t | tx_pa |
TX power amp type |
txpwr_t | tx_pwr |
Value for transmit power in dB. |
struct radio_status_t |
Data Fields | ||
---|---|---|
uint8_t | cca_mode |
Current cca mode. |
uint8_t | channel |
Current radio channel. (MIN_CHANNEL ... MAX_CHANNEL) |
radio_state_t | idle_state |
after TX go to idle state |
uint8_t | rx_lna | |
uint8_t * | rxframe |
Pointer for frame data storage. |
uint8_t | rxframesz |
Length of the buffer rxframesz |
radio_state_t | state |
Current transceiver state. |
uint8_t | tx_pa | |
uint8_t | tx_pwr |
Current transmit power. |
typedef uint8_t radio_state_t |
Radio state type, supported values are
#define MOD_OQPSK_1000 (7) |
#define MOD_OQPSK_2000 (8) |
#define RADIO_AT86RF230A (RADIO_AT86RF230) |
#define RADIO_AT86RF230B (2) |
#define RADIO_ATMEGA128RFA1_A (5) |
#define RADIO_ATMEGA128RFA1_B (6) |
#define RADIO_ATMEGA128RFA1_C (7) |
#define RADIO_ATMEGA128RFA1_D (8) |
#define RADIO_ATMEGA2564RFR2 (12) |
#define RADIO_ATMEGA256RFR2 (11) |
#define RADIO_BAND_2400 (4) |
#define RADIO_BAND_900 (3) |
#define RADIO_CFG_DATA {chan: 16, txp: 0, cca: 1, edt: 11, clkm: 0, crc: 0xab12} |
#define RADIO_CFG_EEOFFSET (8) |
#define RP_CCAMODE | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the CCA mode to x
.
#define RP_CHANNEL | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the channel number to x
.
Helper macro to construct the arguments for radio_set_param in order to set the TX power amplifier enable number to x
.
#define RP_CHANNEL | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the channel number to x
.
Helper macro to construct the arguments for radio_set_param in order to set the TX power amplifier enable number to x
.
#define RP_DATARATE | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the data rate to x
.
#define RP_IDLESTATE | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the transceiver's idle state to x
.
#define RP_LONGADDR | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the long address pointer to x
.
#define RP_PANID | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the PAN ID to x
.
#define RP_RX_LNA | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the TX power amplifier enable number to x
.
#define RP_SHORTADDR | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the short address to x
.
#define RP_TXPWR | ( | x | ) |
Helper macro to construct the arguments for radio_set_param in order to set the tx power value to x
.
#define STATE_OFF (0) |
Radio state enumerationTRX in OFF state.
#define STATE_RX (2) |
Basic mode RX state.
#define STATE_RXAUTO (4) |
Extended mode RX state (RX_AACK).
#define STATE_SLEEP (5) |
Sleep state (lowest power consumption).
#define STATE_TX (1) |
Basic mode TX state.
#define STATE_TXAUTO (3) |
Extended mode TX state (TX_ARET).
enum radio_attribute_t |
Enumeration to identify radio attributes.
enum radio_cca_t |
enum radio_error_t |
enum radio_tx_done_t |