This is the Radio Interface header file which contains LoRa-specific Radio interface functions declarations and defines.
Copyright (c) 2018-2020 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include "stdbool.h"
Data Structures | |
struct | _RadioCallbackParam_t |
A structure for storing the callback parameters. More... | |
struct | _RadioConfiguration_t |
A structure for storing all the attributes of the radio and the transceiver. More... | |
struct | _RadioLBT_t |
A structure for storing all Listen Before Talk parameters. More... | |
struct | _RadioLBTParams_t |
A structure for storing the Listen Before Talk parameters for get and set. More... | |
struct | _RadioModeModulation_t |
A structure for storing the modes and modulations supported as parameters for get and set. More... | |
struct | _RadioReceiveParam_t |
A structure for storing the receive parameters. More... | |
struct | _RadioTransmitParam_t |
A structure for storing the transmit parameters. More... | |
Macros | |
#define | RADIO_DEFAULT_CALLBACK_MASK |
#define | RADIO_FHSS_NEXT_FREQ_CALLBACK_MASK (1 << 5) |
#define | RADIO_OPMODE_MASK (0x07) |
#define | RADIO_PHY_FSK_PREAMBLE_BYTES_LENGTH (5u) |
#define | RADIO_PHY_PREAMBLE_LENGTH (8u) |
#define | RADIO_RX_DONE_CALLBACK_MASK (1 << 0) |
#define | RADIO_RX_ERROR_CALLBACK_MASK (1 << 4) |
#define | RADIO_RX_TIMEOUT_CALLBACK_MASK (1 << 3) |
#define | RADIO_TX_DONE_CALLBACK_MASK (1 << 1) |
#define | RADIO_TX_TIMEOUT_CALLBACK_MASK (1 << 2) |
#define | RADIO_WATCHDOG_TIMEOUT ((uint32_t)15000) |
#define | TIME_ON_AIR_LOAD_VALUE ((uint32_t)20000) |
Typedefs | |
typedef enum _RadioAttribute_t | RadioAttribute_t |
A list of all the attributes. More... | |
typedef void(* | RadioCallback_t )(RadioCallbackID_t callback, void *param) |
The radio callback typedef used to declare callback functions from the radio layer. More... | |
typedef enum _RadioCallbackID_t | RadioCallbackID_t |
Possible callbacks that can registered to by the upper layer. More... | |
typedef struct _RadioCallbackParam_t | RadioCallbackParam_t |
A structure for storing the callback parameters. More... | |
typedef struct _RadioConfiguration_t | RadioConfiguration_t |
A structure for storing all the attributes of the radio and the transceiver. More... | |
typedef enum _RadioDataRate_t | RadioDataRate_t |
Possible spread factors supported. More... | |
typedef enum _RadioError_t | RadioError_t |
Possible error states returned by the radio. More... | |
typedef enum _RadioErrorCodingRate_t | RadioErrorCodingRate_t |
Possible error coding rate supported. More... | |
typedef enum _RadioFSKBandWidth_t | RadioFSKBandWidth_t |
Possible FSK bandWidth supported. More... | |
typedef enum _RadioFSKShaping_t | RadioFSKShaping_t |
Possible FSK shaping supported. More... | |
typedef struct _RadioLBT_t | RadioLBT_t |
A structure for storing all Listen Before Talk parameters. More... | |
typedef struct _RadioLBTParams_t | RadioLBTParams_t |
A structure for storing the Listen Before Talk parameters for get and set. More... | |
typedef enum _RadioLoRaBandWidth_t | RadioLoRaBandWidth_t |
Possible LoRa bandWidth supported. More... | |
typedef enum _RadioMode_t | RadioMode_t |
typedef struct _RadioModeModulation_t | RadioModeModulation_t |
A structure for storing the modes and modulations supported as parameters for get and set. More... | |
typedef enum _RadioModulation_t | RadioModulation_t |
Possible modulations supported. More... | |
typedef enum _RadioReceive_t | RadioReceive_t |
Attributes for starting and stopping the receive operation. More... | |
typedef struct _RadioReceiveParam_t | RadioReceiveParam_t |
A structure for storing the receive parameters. More... | |
typedef enum _RadioState_t | RadioState_t |
Possible Radio states. More... | |
typedef struct _RadioTransmitParam_t | RadioTransmitParam_t |
A structure for storing the transmit parameters. More... | |
Functions | |
void | RADIO_ClearCallbackBitmask (uint8_t bitmask) |
The function disables the callbacks by setting masks. More... | |
void | RADIO_DIO0 (void) |
This function is called when a hardware radio interrupt DIO0 occurs. More... | |
void | RADIO_DIO1 (void) |
This function is called when a hardware radio interrupt DIO1 occurs. More... | |
void | RADIO_DIO2 (void) |
This function is called when a hardware radio interrupt DIO2 occurs. More... | |
void | RADIO_DIO3 (void) |
This function is called when a hardware radio interrupt DIO3 occurs. More... | |
void | RADIO_DIO4 (void) |
This function is called when a hardware radio interrupt DIO4 occurs. More... | |
void | RADIO_DIO5 (void) |
This function is called when a hardware radio interrupt DIO5 occurs. More... | |
void | RADIO_FHSSChangeChannel (void) |
This function sets the receive frequency of the transceiver while hopping in FHSS. More... | |
void | RADIO_FSKFifoEmpty (void) |
This function is triggered when the FIFO is empty. More... | |
void | RADIO_FSKFifoLevel (void) |
This function is triggered when the FIFO is above the threshold value. More... | |
void | RADIO_FSKPacketSent (void) |
This function is triggered by hardware interrupt when a FSK is transmitted. More... | |
void | RADIO_FSKPayloadReady (void) |
This function is triggered by hardware interrupt when a FSK is received. More... | |
void | RADIO_FSKSyncAddr (void) |
This function is called when a sync address match happens or when packet collision happens. More... | |
RadioError_t | RADIO_GetAttr (RadioAttribute_t attribute, void *value) |
This function gets the radio attribute. More... | |
uint8_t | RADIO_GetCallbackBitmask (void) |
The function enables or disables the callbacks by setting masks. More... | |
RadioError_t | RADIO_GetData (uint8_t **data, uint16_t *dataLen) |
This function can be called by MAC to read radio buffer pointer and length of a receive frame(typically in rxdone) More... | |
RadioState_t | RADIO_GetState (void) |
This function gets the radio state. More... | |
void | RADIO_Init (void) |
The Radio Init initializes the transceiver. More... | |
void | RADIO_InitDefaultAttributes (void) |
The function initializes the default attributes depending on region chosen. More... | |
uint16_t | RADIO_ReadRandom (void) |
This function generates random number using the transceiver and returns it. More... | |
RadioError_t | RADIO_Receive (RadioReceiveParam_t *param) |
This function receives the data and stores it in the buffer pointer space by doing a task post to the RADIO_RxHandler. More... | |
void | RADIO_RxDone (void) |
This function is triggered by hardware interrupt when a LoRa is received. More... | |
void | RADIO_RxTimeout (void) |
This function is triggered when no packets are received within a specified Rx window. More... | |
RadioError_t | RADIO_SetAttr (RadioAttribute_t attribute, void *value) |
This function sets the radio attribute. More... | |
void | RADIO_SetCallbackBitmask (uint8_t bitmask) |
The function enables the callbacks by setting masks. More... | |
RadioError_t | RADIO_StopCW (void) |
The function stops the transmission of a CW. More... | |
RadioError_t | RADIO_Transmit (RadioTransmitParam_t *param) |
This function transmits the data by doing a task post to the RADIO_TxHandler. More... | |
RadioError_t | RADIO_TransmitCW (void) |
The function transmits a CW and is supported only in LORA mode. More... | |
void | RADIO_TxDone (void) |
This function is triggered by hardware interrupt when a LoRa is transmitted. More... | |
void | RADIO_UnhandledInterrupt (RadioModulation_t modulation) |
This function handles the rogue radio interrupts. More... | |
#define RADIO_DEFAULT_CALLBACK_MASK |
#define RADIO_FHSS_NEXT_FREQ_CALLBACK_MASK (1 << 5) |
#define RADIO_OPMODE_MASK (0x07) |
#define RADIO_PHY_FSK_PREAMBLE_BYTES_LENGTH (5u) |
#define RADIO_PHY_PREAMBLE_LENGTH (8u) |
#define RADIO_RX_DONE_CALLBACK_MASK (1 << 0) |
#define RADIO_RX_ERROR_CALLBACK_MASK (1 << 4) |
#define RADIO_RX_TIMEOUT_CALLBACK_MASK (1 << 3) |
#define RADIO_TX_DONE_CALLBACK_MASK (1 << 1) |
#define RADIO_TX_TIMEOUT_CALLBACK_MASK (1 << 2) |
#define RADIO_WATCHDOG_TIMEOUT ((uint32_t)15000) |
#define TIME_ON_AIR_LOAD_VALUE ((uint32_t)20000) |
typedef enum _RadioAttribute_t RadioAttribute_t |
A list of all the attributes.
typedef void(* RadioCallback_t)(RadioCallbackID_t callback, void *param) |
The radio callback typedef used to declare callback functions from the radio layer.
typedef enum _RadioCallbackID_t RadioCallbackID_t |
Possible callbacks that can registered to by the upper layer.
typedef struct _RadioCallbackParam_t RadioCallbackParam_t |
A structure for storing the callback parameters.
typedef struct _RadioConfiguration_t RadioConfiguration_t |
A structure for storing all the attributes of the radio and the transceiver.
typedef enum _RadioDataRate_t RadioDataRate_t |
Possible spread factors supported.
typedef enum _RadioError_t RadioError_t |
Possible error states returned by the radio.
typedef enum _RadioErrorCodingRate_t RadioErrorCodingRate_t |
Possible error coding rate supported.
typedef enum _RadioFSKBandWidth_t RadioFSKBandWidth_t |
Possible FSK bandWidth supported.
typedef enum _RadioFSKShaping_t RadioFSKShaping_t |
Possible FSK shaping supported.
typedef struct _RadioLBT_t RadioLBT_t |
A structure for storing all Listen Before Talk parameters.
typedef struct _RadioLBTParams_t RadioLBTParams_t |
A structure for storing the Listen Before Talk parameters for get and set.
typedef enum _RadioLoRaBandWidth_t RadioLoRaBandWidth_t |
Possible LoRa bandWidth supported.
typedef enum _RadioMode_t RadioMode_t |
typedef struct _RadioModeModulation_t RadioModeModulation_t |
A structure for storing the modes and modulations supported as parameters for get and set.
typedef enum _RadioModulation_t RadioModulation_t |
Possible modulations supported.
typedef enum _RadioReceive_t RadioReceive_t |
Attributes for starting and stopping the receive operation.
typedef struct _RadioReceiveParam_t RadioReceiveParam_t |
A structure for storing the receive parameters.
typedef enum _RadioState_t RadioState_t |
Possible Radio states.
typedef struct _RadioTransmitParam_t RadioTransmitParam_t |
A structure for storing the transmit parameters.
enum _RadioAttribute_t |
A list of all the attributes.
enum _RadioCallbackID_t |
enum _RadioDataRate_t |
enum _RadioError_t |
enum _RadioFSKBandWidth_t |
Possible FSK bandWidth supported.
enum _RadioFSKShaping_t |
enum _RadioMode_t |
enum _RadioModulation_t |
enum _RadioReceive_t |
enum _RadioState_t |
void RADIO_ClearCallbackBitmask | ( | uint8_t | bitmask | ) |
The function disables the callbacks by setting masks.
Setting a bit to 1 means that the callback is enabled Setting a bit to 0 means that the callback is disabled
bitmask | - The bitmask for disabling callbacks. |
void RADIO_DIO0 | ( | void | ) |
This function is called when a hardware radio interrupt DIO0 occurs.
void RADIO_DIO1 | ( | void | ) |
This function is called when a hardware radio interrupt DIO1 occurs.
void RADIO_DIO2 | ( | void | ) |
This function is called when a hardware radio interrupt DIO2 occurs.
void RADIO_DIO3 | ( | void | ) |
This function is called when a hardware radio interrupt DIO3 occurs.
void RADIO_DIO4 | ( | void | ) |
This function is called when a hardware radio interrupt DIO4 occurs.
void RADIO_DIO5 | ( | void | ) |
This function is called when a hardware radio interrupt DIO5 occurs.
void RADIO_FHSSChangeChannel | ( | void | ) |
This function sets the receive frequency of the transceiver while hopping in FHSS.
- | none |
References _RadioCallbackMask_t::BitMask, _RadioConfiguration_t::frequencyHopPeriod, RADIO_FHSS_NEXT_FREQ_CALLBACK, RADIO_RegisterRead(), RADIO_RegisterWrite(), Radio_WriteFrequency(), _RadioConfiguration_t::radioCallback, _RadioCallbackMask_t::_BitMask_::radioFhssfreqCallback, REG_LORA_IRQFLAGS, and SHIFT1.
void RADIO_FSKFifoEmpty | ( | void | ) |
This function is triggered when the FIFO is empty.
This is triggered by a hardware interrupt.
- | none |
void RADIO_FSKFifoLevel | ( | void | ) |
This function is triggered when the FIFO is above the threshold value.
This is triggered by a hardware interrupt.
- | none |
void RADIO_FSKPacketSent | ( | void | ) |
This function is triggered by hardware interrupt when a FSK is transmitted.
- | none |
void RADIO_FSKPayloadReady | ( | void | ) |
This function is triggered by hardware interrupt when a FSK is received.
- | none |
void RADIO_FSKSyncAddr | ( | void | ) |
This function is called when a sync address match happens or when packet collision happens.
In that case we clear the FSKPayload index and datalen variables to download the new packet.
- | none |
RadioError_t RADIO_GetAttr | ( | RadioAttribute_t | attribute, |
void * | value | ||
) |
This function gets the radio attribute.
attribute | - The attribute to get. |
value | - The pointer that is used to get the value. |
Referenced by MSG_IsTxPossible().
uint8_t RADIO_GetCallbackBitmask | ( | void | ) |
The function enables or disables the callbacks by setting masks.
Setting a bit to 1 means that the callback is enabled Setting a bit to 0 means that the callback is disabled
RadioError_t RADIO_GetData | ( | uint8_t ** | data, |
uint16_t * | dataLen | ||
) |
This function can be called by MAC to read radio buffer pointer and length of a receive frame(typically in rxdone)
- | place holder for data pointer, length |
RadioState_t RADIO_GetState | ( | void | ) |
This function gets the radio state.
void RADIO_Init | ( | void | ) |
The Radio Init initializes the transceiver.
void RADIO_InitDefaultAttributes | ( | void | ) |
The function initializes the default attributes depending on region chosen.
uint16_t RADIO_ReadRandom | ( | void | ) |
This function generates random number using the transceiver and returns it.
- | none |
References i, MODE_RXCONT, MODE_SLEEP, MODULATION_LORA, Radio_DisableRfControl(), Radio_EnableRfControl(), RADIO_RegisterRead(), RADIO_RegisterWrite(), Radio_ResetClockInput(), RADIO_RFCTRL_RX, Radio_SetClockInput(), Radio_WriteMode(), REG_LORA_IRQFLAGS, REG_LORA_IRQFLAGSMASK, REG_LORA_RSSIWIDEBAND, SHIFT1, and SystemBlockingWaitMs().
RadioError_t RADIO_Receive | ( | RadioReceiveParam_t * | param | ) |
This function receives the data and stores it in the buffer pointer space by doing a task post to the RADIO_RxHandler.
param | - Stores the receive parameters. |
void RADIO_RxDone | ( | void | ) |
This function is triggered by hardware interrupt when a LoRa is received.
- | none |
void RADIO_RxTimeout | ( | void | ) |
This function is triggered when no packets are received within a specified Rx window.
This is triggered by a hardware interrupt.
- | none |
RadioError_t RADIO_SetAttr | ( | RadioAttribute_t | attribute, |
void * | value | ||
) |
This function sets the radio attribute.
attribute | - The attribute to set. |
value | - The pointer that is used to set the value. |
Referenced by enddevice_cpc_execute_command().
void RADIO_SetCallbackBitmask | ( | uint8_t | bitmask | ) |
The function enables the callbacks by setting masks.
Setting a bit to 1 means that the callback is enabled Setting a bit to 0 means that the callback is disabled
bitmask | - The bitmask for enabling and disabling callbacks. |
RadioError_t RADIO_StopCW | ( | void | ) |
The function stops the transmission of a CW.
Referenced by enddevice_txcw_callback().
RadioError_t RADIO_Transmit | ( | RadioTransmitParam_t * | param | ) |
This function transmits the data by doing a task post to the RADIO_TxHandler.
param | - Stores the transmission parameters. |
RadioError_t RADIO_TransmitCW | ( | void | ) |
The function transmits a CW and is supported only in LORA mode.
Referenced by enddevice_cpc_execute_command().
void RADIO_TxDone | ( | void | ) |
This function is triggered by hardware interrupt when a LoRa is transmitted.
- | none |
void RADIO_UnhandledInterrupt | ( | RadioModulation_t | modulation | ) |
This function handles the rogue radio interrupts.
modulation | - modulation when this function is called. |