µracoli Manual
Version foo
|
Data Structures | |
struct | trx_param_t |
This group of functions provides the register level access to the radio transceivers. The trx
interface is given in transceiver.hThe use of the Transceiver API is illustrated by the following examples.
trx_regval_t trx_bit_read | ( | trx_regaddr_t | addr, |
trx_regval_t | mask, | ||
uint8_t | pos | ||
) |
addr | offset of the register |
mask | bit mask of the subregister |
pos | bit position of the subregister |
data | pointer where the read and demuxed value is stored |
void trx_bit_write | ( | trx_regaddr_t | addr, |
trx_regval_t | mask, | ||
uint8_t | pos, | ||
trx_regval_t | value | ||
) |
addr | offset of the register |
mask | bit mask of the subregister |
pos | bit position of the subregister |
value | data, which is muxed into the register |
uint8_t trx_decode_datarate | ( | uint8_t | rhash, |
char * | rstr, | ||
uint8_t | nlen | ||
) |
rhash | Hash value of a data rate. |
rstr | pointer to the buffer, where data rate is copied, |
nlen | maximum length of rstr |
rhash
is not supported by the transceiver or invalid, otherwise 0. void* trx_decode_datarate_p | ( | uint8_t | rhash | ) |
rhash | Hash value of a data rate. |
uint8_t trx_frame_get_length | ( | void | ) |
uint8_t trx_frame_read | ( | uint8_t * | data, |
uint8_t | datasz, | ||
uint8_t * | lqi | ||
) |
This function reads a frame from the transceiver.
data | Pointer to an array of (Payload-) bytes that should be sent |
datasz | maximum number of bytes, which fit in the data buffer. |
lqi | Pointer where the LQI value is stored |
uint8_t trx_frame_read_crc | ( | uint8_t * | data, |
uint8_t | datasz, | ||
bool * | crc_ok | ||
) |
This function reads a frame from the transceiver. While the upload is in progress, the CRC16 value is caluculated and compared against the last two bytes. The two crc bytes are copied in the data buffer.
data | Pointer to an array of (Payload-) bytes that should be sent |
datasz | maximum number of bytes, which fit in the data buffer. |
crc_ok | Result of the CRC16 check. |
uint8_t trx_frame_read_data_crc | ( | uint8_t * | data, |
uint8_t | datasz, | ||
uint8_t * | lqi, | ||
bool * | crc_ok | ||
) |
This function reads a frame from the transceiver. While the upload is in progress, the CRC16 value is caluculated and compared against the last two bytes. The two crc bytes are not copied in the data buffer.
data | Pointer to an array of (Payload-) bytes that should be sent |
datasz | maximum number of bytes, which fit in the data buffer. |
lqi | Pointer where the LQI value is stored |
crc_ok | Result of the CRC16 check. |
void trx_frame_write | ( | uint8_t | length, |
uint8_t * | data | ||
) |
This function writes a frame to the transceiver.
length | Length of the frame that should be written into the frame buffer |
data | Pointer to an array of (Payload-) bytes that should be sent |
uint8_t trx_get_datarate | ( | void | ) |
uint8_t trx_get_datarate_str | ( | uint8_t | idx, |
char * | rstr, | ||
uint8_t | nlen | ||
) |
idx | Index of the data rate. |
rstr | pointer to the buffer, where data rate is copied, |
nlen | maximum length of rstr |
idx
is out of range, otherwise 0. void* trx_get_datarate_str_p | ( | uint8_t | idx | ) |
This function can be used to get a list of data rates, supported of the current radio transceiver.
idx | Index of the data rate. |
|
static |
Definition at line 532 of file transceiver.h.
void trx_io_init | ( | uint8_t | spirate | ) |
spirate | Configuration Byte of the SPI Control Register (SPCR) in case of RFA1, RFR2, ... this parameter is a dummy. |
void trx_parms_get | ( | trx_param_t * | p | ) |
This function reads the static transceiver parameters, defined in a structure and protects it with a CRC16.
p | pointer to the data structure. |
uint8_t trx_parms_set | ( | trx_param_t * | p | ) |
This function writes the static transceiver parameters, defined in a structure protects it with a CRC16.
p | pointer to the data structure. |
no_crc_check | if this parameter is true, the the CRC given in the sructure is not checked. |
uint8_t trx_reg_read | ( | trx_regaddr_t | addr | ) |
This function reads a transceiver register.
addr | Address of the Register in the Transceiver (Offset) that should be read |
void trx_reg_write | ( | trx_regaddr_t | addr, |
trx_regval_t | val | ||
) |
This function write to a transceiver register.
addr | Address of the Register in the Transceiver (Offset) that should be written |
val | Byte that will be written into the Register |
uint8_t trx_set_datarate | ( | uint8_t | rate_type | ) |
The transceiver is forced to state TRX_OFF in order to switch the data rate.
rate_type | type code (the data rate hash codes, e.g. OQPSK250, e.g. *PSK macros) of the desired data rate. |
void trx_set_irq_handler | ( | trx_irq_handler_t | irqhandler | ) |
set function pointer for IRQ handler
void trx_sram_read | ( | trx_ramaddr_t | addr, |
uint8_t | length, | ||
uint8_t * | data | ||
) |
addr | Address in the TRX's SRAM where the read burst should start |
length | Length of the write burst |
data | Pointer to an array of bytes that should be read |
void trx_sram_write | ( | trx_ramaddr_t | addr, |
uint8_t | length, | ||
uint8_t * | data | ||
) |
This function writes into the SRAM of the transceiver.
addr | Address in the TRX's SRAM where the write burst should start |
length | Length of the write burst |
data | Pointer to an array of bytes that should be written |
struct trx_param_t |
Data Fields | ||
---|---|---|
unsigned int | cca: 2 |
CCA mode see sub register SR_CCA_MODE |
channel_t | chan |
current channel see sub register SR_CHANNEL |
unsigned int | clkm: 3 |
clkm control see sub register SR_CLKM_CTRL |
unsigned int | edt: 4 |
ED threshold see sub register SR_CCA_ED_THRES |
unsigned int | txp: 4 |
TX power index see sub register SR_TX_PWR |
typedef uint8_t ccamode_t |
typedef bool rxidle_t |
typedef void(* trx_irq_handler_t) (uint8_t cause) |
Data Type for Transceiver IRQ callback function
Definition at line 95 of file transceiver.h.
typedef uint8_t trx_ramaddr_t |
Data Type for Transceiver SRAM address
Definition at line 81 of file transceiver.h.
typedef uint8_t trx_regaddr_t |
Data Type for Transceiver register address
Definition at line 89 of file transceiver.h.
typedef uint8_t trx_regval_t |
Data Type for Transceiver register value
Definition at line 85 of file transceiver.h.
#define DEFAULT_PAN_ID (0xb5c2) |
#define DEFAULT_SHORT_ADDRESS (0x6172) |
#define FCTL_DATA _BV(0) |
#define FCTL_DST_LONG 0x0c00 |
destination long address in frame control field
#define FCTL_DST_SHORT 0x0800 |
destination short address in frame control field
#define FCTL_IPAN _BV(6) |
#define FCTL_SRC_LONG 0xc000 |
source long address in frame control field
#define FCTL_SRC_SHORT 0x8000 |
source short address in frame control field
#define INVALID_PART_NUM (2) |
flag for invalid part number
Definition at line 113 of file transceiver.h.
#define INVALID_REV_NUM (1) |
flag for invalid revision number
Definition at line 114 of file transceiver.h.
#define MAX_FRAME_SIZE (127) |
Maximum size in bytes of an IEEE 802.15.4 frame
Definition at line 140 of file transceiver.h.
#define SPI_RATE_1_128 (3) |
#define SPI_RATE_1_16 (1) |
#define SPI_RATE_1_2 (4) |
SPI clock running is 0.5 (1/2) of cpu clock
#define SPI_RATE_1_32 (6) |
#define SPI_RATE_1_4 (0) |
#define SPI_RATE_1_64 (2) |
#define SPI_RATE_1_8 (5) |
#define TRX_INIT_FAIL (1) |
trx init function failed (TRX_OFF not reached after reset)
Definition at line 109 of file transceiver.h.
#define TRX_OK (0) |
trx function succeeded
Definition at line 107 of file transceiver.h.
#define TRX_PLL_FAIL (2) |
trx pll check function failed (PLL_LOCK coult not be observed in PLL_ON)
Definition at line 111 of file transceiver.h.