OpenWSN Firmware
Go to the documentation of this file.
1 #ifndef __RADIO_H
2 #define __RADIO_H
15 #include "radiotimer.h"
17 //=========================== define ==========================================
19 #define LENGTH_CRC 2
28 typedef enum {
45 //=========================== typedef =========================================
47 //=========================== variables =======================================
49 //=========================== prototypes ======================================
51 // admin
52 void radio_init(void);
57 // reset
58 void radio_reset(void);
59 // timer
60 void radio_startTimer(PORT_TIMER_WIDTH period);
61 PORT_TIMER_WIDTH radio_getTimerValue(void);
62 void radio_setTimerPeriod(PORT_TIMER_WIDTH period);
63 PORT_TIMER_WIDTH radio_getTimerPeriod(void);
64 // RF admin
65 void radio_setFrequency(uint8_t frequency);
66 void radio_rfOn(void);
67 void radio_rfOff(void);
68 // TX
69 void radio_loadPacket(uint8_t* packet, uint8_t len);
70 void radio_txEnable(void);
71 void radio_txNow(void);
72 // RX
73 void radio_rxEnable(void);
74 void radio_rxNow(void);
75 void radio_getReceivedFrame(uint8_t* bufRead,
76  uint8_t* lenRead,
77  uint8_t maxBufLen,
78  int8_t* rssi,
79  uint8_t* lqi,
80  bool* crc);
82 // interrupt handlers
90 #endif
Frame has been sent/received completely.
Definition: radio.h:41
void radio_setFrequency(uint8_t frequency)
void radio_setCompareCb(radiotimer_compare_cbt cb)
void radio_rfOff(void)
Radio ready to transmit.
Definition: radio.h:36
Current state of the radio.
Definition: radio.h:28
kick_scheduler_t radio_isr(void)
void radio_init(void)
void radio_txNow(void)
void radio_rxEnable(void)
Busy transmitting bytes.
Definition: radio.h:37
void(* radiotimer_compare_cbt)(void)
Definition: radiotimer.h:22
Configuring the frequency.
Definition: radio.h:31
void radio_txEnable(void)
Done configuring the frequency.
Definition: radio.h:32
Definition: board.h:20
void radio_setStartFrameCb(radiotimer_capture_cbt cb)
The RF TX chaing is being enabled (includes locking the PLL).
Definition: radio.h:35
Busy receiving bytes.
Definition: radio.h:40
void radio_rxNow(void)
void radio_reset(void)
void radio_getReceivedFrame(uint8_t *bufRead, uint8_t *lenRead, uint8_t maxBufLen, int8_t *rssi, uint8_t *lqi, bool *crc)
PORT_TIMER_WIDTH radio_getTimerValue(void)
PORT_TIMER_WIDTH radio_getTimerPeriod(void)
void radio_loadPacket(uint8_t *packet, uint8_t len)
Listening for commands, but RF chain is off.
Definition: radio.h:30
Loading packet into the radio's TX buffer.
Definition: radio.h:33
void radio_startTimer(PORT_TIMER_WIDTH period)
Packet is fully loaded in the radio's TX buffer.
Definition: radio.h:34
void radio_setEndFrameCb(radiotimer_capture_cbt cb)
The RF RX chain is being enabled (includes locking the PLL).
Definition: radio.h:38
void radio_rfOn(void)
Completely stopped.
Definition: radio.h:29
Turning the RF chain off.
Definition: radio.h:42
void radio_setTimerPeriod(PORT_TIMER_WIDTH period)
void radio_setOverflowCb(radiotimer_compare_cbt cb)
RF chain is on, listening, but no packet received yet.
Definition: radio.h:39
void(* radiotimer_capture_cbt)(PORT_TIMER_WIDTH timestamp)
Definition: radiotimer.h:23