Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SxRadio1272 Class Reference
#include <SxRadio1272.h>
Inherits SxRadio.
Public Types | |
enum | RadioModems_t |
enum | RadioState_t |
Public Member Functions | |
virtual void | Init (SxRadioEvents *events) |
Initializes the radio. | |
virtual void | Terminate (void) |
Prepares the radio for destruction. | |
virtual void | SetModem (RadioModems_t modem) |
Configures the radio with the given modem. | |
virtual void | SetChannel (uint32_t freq) |
Sets the channel frequency. | |
virtual bool | IsChannelFree (RadioModems_t modem, uint32_t freq, uint8_t datarate, int16_t rssiThresh, uint8_t bandwidth, uint32_t timeout=5000, int16_t *rssiVal=NULL) |
Detect channel free using CAD. | |
virtual uint32_t | Random (void) |
Generates a 32 bits random value based on the RSSI readings. | |
virtual void | SetRxConfig (RadioModems_t modem, uint32_t bandwidth, uint32_t datarate, uint8_t coderate, uint32_t bandwidthAfc, uint16_t preambleLen, uint16_t symbTimeout, bool fixLen, uint8_t payloadLen, bool crcOn, bool FreqHopOn, uint8_t HopPeriod, bool iqInverted, bool rxContinuous) |
Sets the reception parameters. | |
virtual void | SetTxConfig (RadioModems_t modem, int8_t power, uint32_t fdev, uint32_t bandwidth, uint32_t datarate, uint8_t coderate, uint16_t preambleLen, bool fixLen, bool crcOn, bool FreqHopOn, uint8_t HopPeriod, bool iqInverted, uint32_t timeout) |
Sets the transmission parameters. | |
virtual void | SetTxContinuous (bool enable) |
Generate CW with current TX config. | |
virtual double | TimeOnAir (RadioModems_t modem, uint8_t pktLen) |
Computes the packet time on air for the given payload. | |
virtual void | Send (const uint8_t *buffer, uint8_t size) |
Sends the buffer of size. Prepares the packet to be sent and sets the radio in transmission. | |
virtual void | Sleep (void) |
Sets the radio in sleep mode. | |
virtual void | Standby (void) |
Sets the radio in standby mode. | |
virtual void | Rx (uint32_t timeout) |
Sets the radio in reception mode for the given time. | |
virtual void | StartCad (void) |
Start a Channel Activity Detection. | |
virtual int16_t | Rssi (RadioModems_t modem) |
Reads the current RSSI value. | |
virtual void | Write (uint8_t addr, uint8_t data) |
Writes the radio register at the specified address. | |
virtual uint8_t | Read (uint8_t addr) |
Reads the radio register at the specified address. | |
virtual void | WriteBuffer (uint8_t addr, const uint8_t *buffer, uint8_t size) |
Writes multiple radio registers starting at address. | |
virtual void | ReadBuffer (uint8_t addr, uint8_t *buffer, uint8_t size) |
Reads multiple radio registers starting at address. | |
virtual RadioState_t | Status (void) |
virtual bool | CheckRfFrequency (uint32_t frequency) |
Checks if the given RF frequency is supported by the hardware. | |
Protected Member Functions | |
virtual void | SetAntSwLowPower (bool status) |
Set antenna switch to low power. | |
virtual void | SetAntSw (uint8_t rxTx) |
Set antenna direction. | |
virtual uint8_t | GetPaSelect (uint32_t channel) |
Get power amp setting. | |
Protected Attributes | |
Mutex | mutex |
Detailed Description
============================================================================ Public functions prototypes ============================================================================
Definition at line 45 of file SxRadio1272.h.
Member Enumeration Documentation
enum RadioModems_t [inherited] |
enum RadioState_t [inherited] |
Member Function Documentation
virtual bool CheckRfFrequency | ( | uint32_t | frequency ) | [virtual, inherited] |
virtual uint8_t GetPaSelect | ( | uint32_t | channel ) | [protected, virtual] |
Get power amp setting.
- Parameters:
-
[IN] channel Channel RF frequency
- Return values:
-
Power amp setting
Definition at line 297 of file SxRadio1272.h.
virtual void Init | ( | SxRadioEvents * | events ) | [virtual] |
Initializes the radio.
- Parameters:
-
[IN] events Structure containing the driver callback functions
Implements SxRadio.
virtual bool IsChannelFree | ( | RadioModems_t | modem, |
uint32_t | freq, | ||
uint8_t | datarate, | ||
int16_t | rssiThresh, | ||
uint8_t | bandwidth, | ||
uint32_t | timeout = 5000 , |
||
int16_t * | rssiVal = NULL |
||
) | [virtual] |
Detect channel free using CAD.
- Parameters:
-
[IN] modem Radio modem to be used [0: FSK, 1: LoRa] [IN] freq Channel RF frequency [IN] rssiThresh RSSI threshold [IN] bandwidth 0:125k, 1:250k, 2:500k [IN] rssiVal pointer to variable to hold RSSI value if desired - ignored if NULL
- Return values:
-
isFree [true: Channel is free, false: Channel is not free]
Implements SxRadio.
virtual uint32_t Random | ( | void | ) | [virtual] |
Generates a 32 bits 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.
- Return values:
-
randomValue 32 bits random value
Implements SxRadio.
virtual uint8_t Read | ( | uint8_t | addr ) | [virtual] |
Reads the radio register at the specified address.
- Parameters:
-
[IN],: addr Register address
- Return values:
-
data Register value
Implements SxRadio.
virtual void ReadBuffer | ( | uint8_t | addr, |
uint8_t * | buffer, | ||
uint8_t | size | ||
) | [virtual] |
Reads multiple radio registers starting at address.
- Parameters:
-
[IN] addr First Radio register address [OUT] buffer Buffer where to copy the registers data [IN] size Number of registers to be read
Implements SxRadio.
virtual int16_t Rssi | ( | RadioModems_t | modem ) | [virtual] |
Reads the current RSSI value.
- Return values:
-
rssiValue Current RSSI value in [dBm]
Implements SxRadio.
virtual void Rx | ( | uint32_t | timeout ) | [virtual] |
Sets the radio in reception mode for the given time.
- Parameters:
-
[IN] timeout Reception timeout [ms] [0: continuous, others timeout]
Implements SxRadio.
virtual void Send | ( | const uint8_t * | buffer, |
uint8_t | size | ||
) | [virtual] |
Sends the buffer of size. Prepares the packet to be sent and sets the radio in transmission.
- Parameters:
-
[IN],: buffer Buffer pointer [IN],: size Buffer size
Implements SxRadio.
virtual void SetAntSw | ( | uint8_t | rxTx ) | [protected, virtual] |
Set antenna direction.
- Parameters:
-
[IN] rxTx [1: transmitter, 0: receiver]
Definition at line 288 of file SxRadio1272.h.
virtual void SetAntSwLowPower | ( | bool | status ) | [protected, virtual] |
Set antenna switch to low power.
- Parameters:
-
[IN] status [true: Antenna in low power, false: Antenna active]
Definition at line 281 of file SxRadio1272.h.
virtual void SetChannel | ( | uint32_t | freq ) | [virtual] |
virtual void SetModem | ( | RadioModems_t | modem ) | [virtual] |
Configures the radio with the given modem.
- Parameters:
-
[IN] modem Modem to be used [0: FSK, 1: LoRa]
Implements SxRadio.
virtual void SetRxConfig | ( | RadioModems_t | modem, |
uint32_t | bandwidth, | ||
uint32_t | datarate, | ||
uint8_t | coderate, | ||
uint32_t | bandwidthAfc, | ||
uint16_t | preambleLen, | ||
uint16_t | symbTimeout, | ||
bool | fixLen, | ||
uint8_t | payloadLen, | ||
bool | crcOn, | ||
bool | FreqHopOn, | ||
uint8_t | HopPeriod, | ||
bool | iqInverted, | ||
bool | rxContinuous | ||
) | [virtual] |
Sets the reception parameters.
- Parameters:
-
[IN] modem Radio modem to be used [0: FSK, 1: LoRa] [IN] bandwidth Sets the bandwidth FSK : >= 2600 and <= 250000 Hz LoRa: [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved] [IN] 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] [IN] 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] [IN] bandwidthAfc Sets the AFC Bandwidth (FSK only) FSK : >= 2600 and <= 250000 Hz LoRa: N/A ( set to 0 ) [IN] preambleLen Sets the Preamble length FSK : Number of bytes LoRa: Length in symbols (the hardware adds 4 more symbols) [IN] symbTimeout Sets the RxSingle timeout value (LoRa only) FSK : N/A ( set to 0 ) LoRa: timeout in symbols [IN] fixLen Fixed length packets [0: variable, 1: fixed] [IN] payloadLen Sets payload length when fixed length is used [IN] crcOn Enables/Disables the CRC [0: OFF, 1: ON] [IN] FreqHopOn Enables disables the intra-packet frequency hopping FSK : N/A ( set to 0 ) LoRa: [0: OFF, 1: ON] [IN] HopPeriod Number of symbols bewteen each hop FSK : N/A ( set to 0 ) LoRa: Number of symbols [IN] iqInverted Inverts IQ signals (LoRa only) FSK : N/A ( set to 0 ) LoRa: [0: not inverted, 1: inverted] [IN] rxContinuous Sets the reception in continuous mode [false: single mode, true: continuous mode]
Implements SxRadio.
virtual void SetTxConfig | ( | RadioModems_t | modem, |
int8_t | power, | ||
uint32_t | fdev, | ||
uint32_t | bandwidth, | ||
uint32_t | datarate, | ||
uint8_t | coderate, | ||
uint16_t | preambleLen, | ||
bool | fixLen, | ||
bool | crcOn, | ||
bool | FreqHopOn, | ||
uint8_t | HopPeriod, | ||
bool | iqInverted, | ||
uint32_t | timeout | ||
) | [virtual] |
Sets the transmission parameters.
- Parameters:
-
[IN] modem Radio modem to be used [0: FSK, 1: LoRa] [IN] power Sets the output power [dBm] [IN] fdev Sets the frequency deviation (FSK only) FSK : [Hz] LoRa: 0 [IN] bandwidth Sets the bandwidth (LoRa only) FSK : 0 LoRa: [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved] [IN] 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] [IN] 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] [IN] preambleLen Sets the preamble length FSK : Number of bytes LoRa: Length in symbols (the hardware adds 4 more symbols) [IN] fixLen Fixed length packets [0: variable, 1: fixed] [IN] crcOn Enables disables the CRC [0: OFF, 1: ON] [IN] FreqHopOn Enables disables the intra-packet frequency hopping FSK : N/A ( set to 0 ) LoRa: [0: OFF, 1: ON] [IN] HopPeriod Number of symbols bewteen each hop FSK : N/A ( set to 0 ) LoRa: Number of symbols [IN] iqInverted Inverts IQ signals (LoRa only) FSK : N/A ( set to 0 ) LoRa: [0: not inverted, 1: inverted] [IN] timeout Transmission timeout [us]
Implements SxRadio.
virtual void SetTxContinuous | ( | bool | enable ) | [virtual] |
Generate CW with current TX config.
Implements SxRadio.
virtual void Sleep | ( | void | ) | [virtual] |
Sets the radio in sleep mode.
Implements SxRadio.
virtual void Standby | ( | void | ) | [virtual] |
Sets the radio in standby mode.
Implements SxRadio.
virtual void StartCad | ( | void | ) | [virtual] |
Start a Channel Activity Detection.
Implements SxRadio.
virtual RadioState_t Status | ( | void | ) | [virtual, inherited] |
virtual void Terminate | ( | void | ) | [virtual] |
Prepares the radio for destruction.
Implements SxRadio.
virtual double TimeOnAir | ( | RadioModems_t | modem, |
uint8_t | pktLen | ||
) | [virtual] |
Computes the packet time on air for the given payload.
Can only be called once SetRxConfig or SetTxConfig have been called
- Parameters:
-
[IN] modem Radio modem to be used [0: FSK, 1: LoRa] [IN] pktLen Packet payload length
- Return values:
-
airTime Computed airTime for the given packet payload length
Implements SxRadio.
virtual void Write | ( | uint8_t | addr, |
uint8_t | data | ||
) | [virtual] |
Writes the radio register at the specified address.
- Parameters:
-
[IN],: addr Register address [IN],: data New register value
Implements SxRadio.
virtual void WriteBuffer | ( | uint8_t | addr, |
const uint8_t * | buffer, | ||
uint8_t | size | ||
) | [virtual] |
Writes multiple radio registers starting at address.
- Parameters:
-
[IN] addr First Radio register address [IN] buffer Buffer containing the new register's values [IN] size Number of registers to be written
Implements SxRadio.
Field Documentation
Generated on Tue Jul 12 2022 12:07:34 by
