LoRaRadio Class Reference
Interface for the radios, contains the main functions that a radio needs, and five callback functions. More...
#include <LoRaRadio.h>
Public Member Functions | |
virtual void | init_radio (radio_events_t *events)=0 |
Registers radio events with the Mbed LoRaWAN stack and undergoes the initialization steps if any. | |
virtual void | radio_reset ()=0 |
Resets the radio module. | |
virtual void | sleep (void)=0 |
Put the RF module in the sleep mode. | |
virtual void | standby (void)=0 |
Sets the radio in the standby mode. | |
virtual void | set_rx_config (radio_modems_t modem, uint32_t bandwidth, uint32_t datarate, uint8_t coderate, uint32_t bandwidth_afc, uint16_t preamble_len, uint16_t symb_timeout, bool fix_len, uint8_t payload_len, bool crc_on, bool freq_hop_on, uint8_t hop_period, bool iq_inverted, bool rx_continuous)=0 |
Sets the reception parameters. | |
virtual void | set_tx_config (radio_modems_t modem, int8_t power, uint32_t fdev, uint32_t bandwidth, uint32_t datarate, uint8_t coderate, uint16_t preamble_len, bool fix_len, bool crc_on, bool freq_hop_on, uint8_t hop_period, bool iq_inverted, uint32_t timeout)=0 |
Sets the transmission parameters. | |
virtual void | send (uint8_t *buffer, uint8_t size)=0 |
Sends the buffer of size. | |
virtual void | receive (uint32_t timeout)=0 |
Sets the radio in reception mode for a given time. | |
virtual void | set_channel (uint32_t freq)=0 |
Sets the carrier frequency. | |
virtual uint32_t | random (void)=0 |
Generates a 32 bit random value based on the RSSI readings. | |
virtual uint8_t | get_status (void)=0 |
Gets the radio status. | |
virtual void | set_max_payload_length (radio_modems_t modem, uint8_t max)=0 |
Sets the maximum payload length. | |
virtual void | set_public_network (bool enable)=0 |
Sets the network to public or private. | |
virtual uint32_t | time_on_air (radio_modems_t modem, uint8_t pkt_len)=0 |
Computes the packet time on air for the given payload. | |
virtual bool | perform_carrier_sense (radio_modems_t modem, uint32_t freq, int16_t rssi_threshold, uint32_t max_carrier_sense_time)=0 |
Performs carrier sensing. | |
virtual void | start_cad (void)=0 |
Sets the radio in CAD mode. | |
virtual bool | check_rf_frequency (uint32_t frequency)=0 |
Checks whether the given RF is in range. | |
virtual void | set_tx_continuous_wave (uint32_t freq, int8_t power, uint16_t time)=0 |
Sets the radio in continuous wave transmission mode. | |
virtual void | lock (void)=0 |
Acquires exclusive access to this radio. | |
virtual void | unlock (void)=0 |
Releases the exclusive access to this radio. |
Detailed Description
Interface for the radios, contains the main functions that a radio needs, and five callback functions.
Definition at line 187 of file LoRaRadio.h.
Member Function Documentation
virtual bool check_rf_frequency | ( | uint32_t | frequency ) | [pure virtual] |
Checks whether the given RF is in range.
- Parameters:
-
frequency The frequency to be checked.
virtual uint8_t get_status | ( | void | ) | [pure virtual] |
Gets the radio status.
- Returns:
- The current radio status.
virtual void init_radio | ( | radio_events_t * | events ) | [pure virtual] |
Registers radio events with the Mbed LoRaWAN stack and undergoes the initialization steps if any.
- Parameters:
-
events The structure containing the driver callback functions.
virtual void lock | ( | void | ) | [pure virtual] |
Acquires exclusive access to this radio.
virtual bool perform_carrier_sense | ( | radio_modems_t | modem, |
uint32_t | freq, | ||
int16_t | rssi_threshold, | ||
uint32_t | max_carrier_sense_time | ||
) | [pure virtual] |
Performs carrier sensing.
Checks for a certain time if the RSSI is above a given threshold. This threshold determines whether or not there is a transmission going on in the channel already.
- Parameters:
-
modem The type of the radio modem. freq The carrier frequency. rssi_threshold The threshold value of RSSI. max_carrier_sense_time The time set for sensing the channel (ms).
- Returns:
- True if there is no active transmission in the channel, otherwise false.
virtual void radio_reset | ( | ) | [pure virtual] |
Resets the radio module.
virtual uint32_t random | ( | void | ) | [pure virtual] |
Generates a 32 bit random value based on the RSSI readings.
- Remarks:
- This function sets the radio in LoRa modem mode and disables all interrupts. After calling this function, either `Radio.SetRxConfig` or `Radio.SetTxConfig` functions must be called.
- Returns:
- A 32 bit random value.
virtual void receive | ( | uint32_t | timeout ) | [pure virtual] |
Sets the radio in reception mode for a given time.
If the timeout is set to 0, it essentially puts the receiver in continuous mode and it should be treated as if in continuous mode. However, an appropriate way to set the receiver in continuous mode is to use the `set_rx_config()` API.
- Parameters:
-
timeout Reception timeout [ms].
virtual void send | ( | uint8_t * | buffer, |
uint8_t | size | ||
) | [pure virtual] |
Sends the buffer of size.
Prepares the packet to be sent and sets the radio in transmission.
- Parameters:
-
buffer A pointer to the buffer. size The buffer size.
virtual void set_channel | ( | uint32_t | freq ) | [pure virtual] |
Sets the carrier frequency.
- Parameters:
-
freq Channel RF frequency.
virtual void set_max_payload_length | ( | radio_modems_t | modem, |
uint8_t | max | ||
) | [pure virtual] |
Sets the maximum payload length.
- Parameters:
-
modem The radio modem to be used [0: FSK, 1: LoRa]. max The maximum payload length in bytes.
virtual void set_public_network | ( | bool | enable ) | [pure virtual] |
Sets the network to public or private.
Updates the sync byte. Applies to LoRa modem only.
- Parameters:
-
enable If true, it enables a public network.
virtual void set_rx_config | ( | radio_modems_t | modem, |
uint32_t | bandwidth, | ||
uint32_t | datarate, | ||
uint8_t | coderate, | ||
uint32_t | bandwidth_afc, | ||
uint16_t | preamble_len, | ||
uint16_t | symb_timeout, | ||
bool | fix_len, | ||
uint8_t | payload_len, | ||
bool | crc_on, | ||
bool | freq_hop_on, | ||
uint8_t | hop_period, | ||
bool | iq_inverted, | ||
bool | rx_continuous | ||
) | [pure virtual] |
Sets the reception parameters.
- Parameters:
-
modem The radio modem to be used [0: FSK, 1: LoRa]. bandwidth Sets the bandwidth. FSK : >= 2600 and <= 250000 Hz LoRa: [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved] datarate Sets the datarate. FSK : 600..300000 bits/s LoRa: [6: 64, 7: 128, 8: 256, 9: 512, 10: 1024, 11: 2048, 12: 4096 chips] coderate Sets the coding rate (LoRa only). FSK : N/A ( set to 0 ) LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] bandwidth_afc Sets the AFC bandwidth (FSK only). FSK : >= 2600 and <= 250000 Hz LoRa: N/A (set to 0) preamble_len Sets the preamble length (LoRa only). FSK : N/A (set to 0) LoRa: Length in symbols (the hardware adds four more symbols). symb_timeout Sets the RxSingle timeout value. FSK : Timeout number of bytes LoRa: Timeout in symbols fix_len Fixed length packets [0: variable, 1: fixed]. payload_len Sets the payload length when fixed length is used. crc_on Enables/disables the CRC [0: OFF, 1: ON]. freq_hop_on Enables/disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only). hop_period The number of symbols bewteen each hop (LoRa only). iq_inverted Inverts the IQ signals (LoRa only). FSK : N/A (set to 0) LoRa: [0: not inverted, 1: inverted] rx_continuous Sets the reception in continuous mode. [false: single mode, true: continuous mode]
virtual void set_tx_config | ( | radio_modems_t | modem, |
int8_t | power, | ||
uint32_t | fdev, | ||
uint32_t | bandwidth, | ||
uint32_t | datarate, | ||
uint8_t | coderate, | ||
uint16_t | preamble_len, | ||
bool | fix_len, | ||
bool | crc_on, | ||
bool | freq_hop_on, | ||
uint8_t | hop_period, | ||
bool | iq_inverted, | ||
uint32_t | timeout | ||
) | [pure virtual] |
Sets the transmission parameters.
- Parameters:
-
modem The radio modem to be used [0: FSK, 1: LoRa]. power Sets the output power [dBm]. fdev Sets the frequency deviation (FSK only). FSK : [Hz] LoRa: 0 bandwidth Sets the bandwidth (LoRa only). FSK : 0 LoRa: [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved] datarate Sets the datarate. FSK : 600..300000 bits/s LoRa: [6: 64, 7: 128, 8: 256, 9: 512, 10: 1024, 11: 2048, 12: 4096 chips] coderate Sets the coding rate (LoRa only). FSK : N/A ( set to 0 ) LoRa: [1: 4/5, 2: 4/6, 3: 4/7, 4: 4/8] preamble_len Sets the preamble length. fix_len Fixed length packets [0: variable, 1: fixed]. crc_on Enables/disables the CRC [0: OFF, 1: ON]. freq_hop_on Enables/disables the intra-packet frequency hopping [0: OFF, 1: ON] (LoRa only). hop_period The number of symbols between each hop (LoRa only). iq_inverted Inverts IQ signals (LoRa only) FSK : N/A (set to 0). LoRa: [0: not inverted, 1: inverted] timeout The transmission timeout [us].
virtual void set_tx_continuous_wave | ( | uint32_t | freq, |
int8_t | power, | ||
uint16_t | time | ||
) | [pure virtual] |
Sets the radio in continuous wave transmission mode.
- Parameters:
-
freq The RF frequency of the channel. power The output power [dBm]. time The transmission mode timeout [s].
virtual void sleep | ( | void | ) | [pure virtual] |
Put the RF module in the sleep mode.
virtual void standby | ( | void | ) | [pure virtual] |
Sets the radio in the standby mode.
virtual void start_cad | ( | void | ) | [pure virtual] |
Sets the radio in CAD mode.
virtual uint32_t time_on_air | ( | radio_modems_t | modem, |
uint8_t | pkt_len | ||
) | [pure virtual] |
Computes the packet time on air for the given payload.
- Remarks:
- This can only be called once `SetRxConfig` or `SetTxConfig` have been called.
- Parameters:
-
modem The radio modem to be used [0: FSK, 1: LoRa]. pkt_len The packet payload length.
- Returns:
- The computed `airTime` for the given packet payload length.
virtual void unlock | ( | void | ) | [pure virtual] |
Releases the exclusive access to this radio.
Generated on Tue Jul 12 2022 12:22:45 by
