41 #include <util/crc16.h>
64 #define STATE_TXAUTO (3)
66 #define STATE_RXAUTO (4)
68 #define STATE_SLEEP (5)
95 typedef enum SHORTENUM
119 typedef enum SHORTENUM
167 #if defined __cplusplus
203 typedef enum SHORTENUM
238 #define VOID_RSSI (0xff)
245 # define RP_CHANNEL(x)
246 #elif defined __cplusplus
247 # define RP_CHANNEL(x) phyCurrentChannel,radio_param_t((channel_t)x)
249 # define RP_CHANNEL(x) phyCurrentChannel,(radio_param_t){.channel=x}
258 #elif defined __cplusplus
259 # define RP_TXPWR(x) phyTransmitPower,radio_param_t((txpwr_t)x)
261 # define RP_TXPWR(x) phyTransmitPower,(radio_param_t){.tx_pwr=x}
269 # define RP_IDLESTATE(x)
270 #elif defined __cplusplus
271 # define RP_IDLESTATE(x) phyIdleState,radio_param_t(x)
273 # define RP_IDLESTATE(x) phyIdleState,(radio_param_t){.idle_state=x}
281 # define RP_CCAMODE(x)
282 #elif defined __cplusplus
283 # define RP_CCAMODE(x) phyCCAMode,radio_param_t((ccamode_t)x)
285 # define RP_CCAMODE(x) phyCCAMode,(radio_param_t){.cca_mode=x}
294 #elif defined __cplusplus
295 # define RP_PANID(x) phyPanId,radio_param_t((uint16_t)x)
297 # define RP_PANID(x) phyPanId,(radio_param_t){.pan_id=x}
305 # define RP_SHORTADDR(x)
306 #elif defined __cplusplus
307 # define RP_SHORTADDR(x) phyShortAddr,radio_param_t((uint16_t)x)
309 # define RP_SHORTADDR(x) phyShortAddr,(radio_param_t){.short_addr=x}
317 # define RP_LONGADDR(x)
318 #elif defined __cplusplus
319 # define RP_LONGADDR(x) phyLongAddr,radio_param_t((uint64_t *)x)
321 # define RP_LONGADDR(x) phyLongAddr,(radio_param_t){.long_addr=x}
330 # define RP_DATARATE(x)
331 #elif defined __cplusplus
332 # define RP_DATARATE(x) phyDataRate,radio_param_t((uint16_t)x)
334 # define RP_DATARATE(x) phyDataRate,(radio_param_t){.data_rate=x}
342 # define RP_CHANNEL(x)
343 #elif defined __cplusplus
344 # define RP_TX_PA(x) phyTxPa,radio_param_t((tx_pa_t)x)
346 # define RP_TX_PA(x) phyTxPa,(radio_param_t){.tx_pa=x}
354 # define RP_RX_LNA(x)
355 #elif defined __cplusplus
356 # define RP_RX_LNA(x) phyRxLna,radio_param_t((rx_lna_t)x)
358 # define RP_RX_LNA(x) phyRxLna,(radio_param_t){.rx_lna=x}
361 #define CRC_CCITT_UPDATE(crc, data) _crc_ccitt_update(crc, data)
363 #ifndef RADIO_CFG_EEOFFSET
365 #define RADIO_CFG_EEOFFSET (8)
368 #ifndef RADIO_CFG_DATA
370 #define RADIO_CFG_DATA {chan: 16, txp: 0, cca: 1, edt: 11, clkm: 0, crc: 0xab12}
393 void radio_init(uint8_t * rxbuf, uint8_t rxbufsz);
462 int radio_putchar(
int c);
463 int radio_getchar(
void);
void radio_init(uint8_t *rxbuf, uint8_t rxbufsz)
Radio related ressource initialization.
void radio_force_state(radio_state_t state)
Force the radio to the requested state. (using CMD_FORCE_TRX_OFF)
void usr_radio_tx_done(radio_tx_done_t status)
radio_cca_t radio_do_cca(void)
Perform CCA Measure.
void usr_radio_error(radio_error_t err)
Structure for storage of radio parameters.
radio_error_t
Error codes.
Container for handover of radio parameter values.
void radio_send_frame(uint8_t len, uint8_t *frm, uint8_t compcrc)
Frame transmission.
uint8_t * usr_radio_receive_frame(uint8_t len, uint8_t *frm, uint8_t lqi, int8_t ed, uint8_t crc_fail)
Frame reception callback function.
void usr_radio_irq(uint8_t cause)
void radio_set_param(radio_attribute_t attr, radio_param_t parm)
Set a radio parameter.
void radio_set_state(radio_state_t state)
Bring the the radio in the requested state.