Radio#
- group bsp_radio
Control the radio peripheral.
This radio driver supports BLE 1Mbit, 2Mbit, Long Range 125Kbit, Long Range 500Kbit and IEEE 802.15.4 250Kbit
- Author
Said Alvarado-Marin said-alexander.alvarado-marin@inria.fr
- Author
Alexandre Abadie alexandre.abadie@inria.fr
- Author
Diego Badillo-San-Juan diego.badillo-san-juan@inria.fr
- Copyright
Inria, 2022-2024
Defines
-
DEFAULT_NETWORK_ADDRESS#
Default network address.
-
DB_BLE_PAYLOAD_MAX_LENGTH#
-
DB_IEEE802154_PAYLOAD_MAX_LENGTH#
Total usable payload for IEEE 802.15.4 is 125 octets (PSDU) when CRC is activated.
Typedefs
-
typedef void (*radio_cb_t)(uint8_t *packet, uint8_t length)#
Function pointer to the callback function called on packet receive.
Enums
Functions
-
void db_radio_init(radio_cb_t callback, db_radio_mode_t mode)#
Initializes the RADIO peripheral.
After this function you must explicitly set the frequency of the radio with the db_radio_set_frequency function.
- Parameters:
callback – [in] pointer to a function that will be called each time a packet is received.
mode – [in] Mode used by the radio BLE (1MBit, 2MBit, LR125KBit, LR500Kbit) or IEEE 802.15.4 (250Kbit)
-
void db_radio_set_frequency(uint8_t freq)#
Set the tx-rx frequency of the radio, by the following formula.
Radio frequency 2400 + freq (MHz) [0, 100]
- Parameters:
freq – [in] Frequency of the radio [0, 100]
-
void db_radio_set_channel(uint8_t channel)#
Set the physical channel used of the radio.
BLE channels in the interval [0-39] Channels 37, 38 and 39 are BLE advertising channels.
IEEE 802.15.4 in the interval [11 - 26] Channels range from 2405 MHz (channel 11) to 2480 MHz (channel 26)
- Parameters:
channel – [in] Channel used by the radio
-
void db_radio_set_network_address(uint32_t addr)#
Set the network address used to send/receive radio packets.
- Parameters:
addr – [in] Network address
-
void db_radio_tx(const uint8_t *packet, uint8_t length)#
Sends a single packet through the Radio.
NOTE: Must configure the radio and the frequency before calling this function. (with the functions db_radio_init db_radio_set_frequency).
NOTE: The radio must not be receiving packets when calling this function. (first call db_radio_disable if needed)
- Parameters:
packet – [in] pointer to the array of data to send over the radio (max size = 32)
length – [in] Number of bytes to send (max size = 32)
-
void db_radio_rx(void)#
Starts Receiving packets through the Radio.
NOTE: Must configure the radio and the frequency before calling this function. (with the functions db_radio_init db_radio_set_frequency).
-
int8_t db_radio_rssi(void)#
Reads the RSSI of a received packet.
Should be called after a packet is received, e.g. in the radio callback
-
void db_radio_disable(void)#
Disables the radio, no packet can be received and energy consumption is minimal.