Initial commit
This commit is contained in:
80
components/esp_lora_1121/include/esp_lora_1121.h
Executable file
80
components/esp_lora_1121/include/esp_lora_1121.h
Executable file
@@ -0,0 +1,80 @@
|
||||
#ifndef WAVESHARE_LORA_SPI_H
|
||||
#define WAVESHARE_LORA_SPI_H
|
||||
|
||||
#include <string.h>
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/spi_master.h"
|
||||
#include "esp_timer.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "lr11xx_bootloader.h"
|
||||
#include "lr11xx_hal.h"
|
||||
#include "lr11xx_system.h"
|
||||
#include "lr11xx_radio.h"
|
||||
#include "lr11xx_regmem.h"
|
||||
#include "lr11xx_lr_fhss.h"
|
||||
#include "lr11xx_driver_version.h"
|
||||
|
||||
|
||||
#include "lr1121_modem_helper.h"
|
||||
#include "lr1121_modem_system_types.h"
|
||||
|
||||
#include "lr1121_modem_common.h"
|
||||
#include "lr1121_modem_modem.h"
|
||||
#include "lr1121_modem_hal.h"
|
||||
#include "lr1121_modem_system.h"
|
||||
#include "lr1121_modem_bsp.h"
|
||||
#include "lr1121_modem_radio.h"
|
||||
|
||||
#include "lr11xx_bootloader_types_str.h"
|
||||
#include "lr11xx_crypto_engine_types_str.h"
|
||||
#include "lr11xx_lr_fhss_types_str.h"
|
||||
#include "lr11xx_radio_types_str.h"
|
||||
#include "lr11xx_rttof_types_str.h"
|
||||
#include "lr11xx_system_types_str.h"
|
||||
#include "lr11xx_types_str.h"
|
||||
#include "lr11xx_printf_info.h"
|
||||
#include "lr1121_modem_printf_info.h"
|
||||
|
||||
#include "lr1121_common.h"
|
||||
|
||||
// #define USE_LR11XX_CRC_OVER_SPI
|
||||
|
||||
typedef struct lr1121_s
|
||||
{
|
||||
int cs;
|
||||
int reset;
|
||||
int busy;
|
||||
int irq;
|
||||
int led;
|
||||
spi_device_handle_t spi;
|
||||
} lr1121_t;
|
||||
|
||||
/**
|
||||
* @brief Initializes the radio I/Os pins context
|
||||
*
|
||||
* @param [in] context Radio abstraction
|
||||
*/
|
||||
void lora_init_io_context(const void *context,int cs,int reset,int busy,int irq);
|
||||
/**
|
||||
* @brief Initializes the radio I/Os pins interface
|
||||
*
|
||||
* @param [in] context Radio abstraction
|
||||
*/
|
||||
void lora_init_io( const void* context );
|
||||
|
||||
void lora_init_irq(const void *context, gpio_isr_t handler);
|
||||
|
||||
void lora_spi_init(const void* context, spi_device_handle_t spi);
|
||||
void lora_spi_write_bytes(const void* context,const uint8_t *wirte,const uint16_t wirte_length);
|
||||
void lora_spi_read_bytes(const void* context, uint8_t *read,const uint16_t read_length);
|
||||
/**
|
||||
* @brief Flush the modem event queue
|
||||
*
|
||||
* @param [in] context Radio abstraction
|
||||
*
|
||||
* @returns Modem-E response code
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_board_event_flush( const void* context );
|
||||
|
||||
#endif
|
||||
162
components/esp_lora_1121/include/lr1121_common/lr1121_common.h
Executable file
162
components/esp_lora_1121/include/lr1121_common/lr1121_common.h
Executable file
@@ -0,0 +1,162 @@
|
||||
#ifndef LR1121_COMMON_H
|
||||
#define LR1121_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "lr11xx_driver/lr11xx_radio_types.h"
|
||||
#include "lr11xx_driver/lr11xx_radio.h"
|
||||
|
||||
#include "lr11xx_driver/lr11xx_system_types.h"
|
||||
#include "lr11xx_driver/lr11xx_regmem.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define SMTC_SHIELD_LR11XX_SUBGHZ_FREQ_MIN 150000000
|
||||
#define SMTC_SHIELD_LR11XX_SUBGHZ_FREQ_MAX 960000000
|
||||
|
||||
#define SMTC_SHIELD_LR112X_2GHZ_FREQ_MIN 2000000000
|
||||
#define SMTC_SHIELD_LR112X_2GHZ_FREQ_MAX 2100000000
|
||||
|
||||
#define SMTC_SHIELD_LR112X_2_4GHZ_FREQ_MIN 2400000000
|
||||
#define SMTC_SHIELD_LR112X_2_4GHZ_FREQ_MAX 2500000000
|
||||
|
||||
#define SMTC_SHIELD_LR11XX_MIN_PWR -9
|
||||
#define SMTC_SHIELD_LR11XX_MAX_PWR 22
|
||||
|
||||
#define SMTC_SHIELD_LR112X_MIN_PWR_HF -18
|
||||
#define SMTC_SHIELD_LR112X_MAX_PWR_HF 13
|
||||
|
||||
/*!
|
||||
* @brief Stringify constants
|
||||
*/
|
||||
#define xstr( a ) str( a )
|
||||
#define str( a ) #a
|
||||
|
||||
/*!
|
||||
* @brief Helper macro that returned a human-friendly message if a command does not return LR11XX_STATUS_OK
|
||||
*
|
||||
* @remark The macro is implemented to be used with functions returning a @ref lr11xx_status_t
|
||||
*
|
||||
* @param[in] rc Return code
|
||||
*/
|
||||
#define ASSERT_LR11XX_RC( rc ) \
|
||||
{ \
|
||||
const lr11xx_status_t status = rc; \
|
||||
if( status != LR11XX_STATUS_OK ) \
|
||||
{ \
|
||||
if( status == LR11XX_STATUS_ERROR ) \
|
||||
{ \
|
||||
printf( "In %s - %s (line %d): %s\n", __FILE__, __func__, __LINE__, \
|
||||
xstr( LR11XX_STATUS_ERROR ) ); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Power amplifier and output power configurations structure definition
|
||||
*/
|
||||
typedef struct smtc_shield_lr11xx_pa_pwr_cfg_s
|
||||
{
|
||||
int8_t power;
|
||||
lr11xx_radio_pa_cfg_t pa_config;
|
||||
} smtc_shield_lr11xx_pa_pwr_cfg_t;
|
||||
|
||||
/**
|
||||
* @brief External 32MHz oscillator configuration structure definition
|
||||
*/
|
||||
typedef struct smtc_shield_lr11xx_xosc_cfg_s
|
||||
{
|
||||
bool has_tcxo;
|
||||
lr11xx_system_tcxo_supply_voltage_t supply;
|
||||
uint32_t startup_time_in_tick;
|
||||
} smtc_shield_lr11xx_xosc_cfg_t;
|
||||
|
||||
/**
|
||||
* @brief 32kHz clock configuration structure definition
|
||||
*/
|
||||
typedef struct smtc_shield_lr11xx_lfclk_cfg_s
|
||||
{
|
||||
lr11xx_system_lfclk_cfg_t lf_clk_cfg;
|
||||
bool wait_32k_ready;
|
||||
} smtc_shield_lr11xx_lfclk_cfg_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see smtc_shield_lr11xx_get_rssi_calibration_table
|
||||
*/
|
||||
const lr11xx_radio_rssi_calibration_table_t* smtc_shield_lr11xx_get_rssi_calibration_table(
|
||||
const uint32_t rf_freq_in_hz );
|
||||
|
||||
/**
|
||||
* @see smtc_shield_lr11xx_get_rf_switch_cfg
|
||||
*/
|
||||
const lr11xx_system_rfswitch_cfg_t* smtc_shield_lr11xx_common_get_rf_switch_cfg( void );
|
||||
|
||||
/**
|
||||
* @see smtc_shield_lr11xx_get_reg_mode
|
||||
*/
|
||||
lr11xx_system_reg_mode_t smtc_shield_lr11xx_common_get_reg_mode( void );
|
||||
|
||||
/**
|
||||
* @see smtc_shield_lr11xx_get_lfclk_cfg
|
||||
*/
|
||||
const smtc_shield_lr11xx_lfclk_cfg_t* smtc_shield_lr11xx_common_get_lfclk_cfg( void );
|
||||
|
||||
/**
|
||||
* @see smtc_shield_lr11xx_get_pa_pwr_cfg
|
||||
*/
|
||||
const smtc_shield_lr11xx_pa_pwr_cfg_t* smtc_shield_lr1121mb1gis_get_pa_pwr_cfg( const uint32_t rf_freq_in_hz,
|
||||
int8_t expected_output_pwr_in_dbm );
|
||||
|
||||
const uint8_t smtc_shield_lr11xx_common_compute_lora_ldro( const lr11xx_radio_lora_sf_t sf, const lr11xx_radio_lora_bw_t bw );
|
||||
|
||||
/*!
|
||||
* \brief Given the length of a BPSK frame, in bits, calculate the space necessary to hold the frame after differential
|
||||
* encoding, in bits.
|
||||
*
|
||||
* \param [in] bpsk_pld_len_in_bits Length of a BPSK frame, in bits
|
||||
* \returns Space required for DBPSK frame, after addition of start/stop bits [bits]
|
||||
*/
|
||||
static inline int smtc_dbpsk_get_pld_len_in_bits( int bpsk_pld_len_in_bits )
|
||||
{
|
||||
// Hold the last bit one extra bit-time
|
||||
return bpsk_pld_len_in_bits + 2;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Given the length of a BPSK frame, in bits, calculate the space necessary to hold the frame after differential
|
||||
* encoding, in bytes.
|
||||
*
|
||||
* \param [in] bpsk_pld_len_in_bits Length of a BPSK frame, in bits
|
||||
* \returns Space required for DBPSK frame, after addition of start/stop bits [bytes]
|
||||
*/
|
||||
static inline int smtc_dbpsk_get_pld_len_in_bytes( int bpsk_pld_len_in_bits )
|
||||
{
|
||||
return ( smtc_dbpsk_get_pld_len_in_bits( bpsk_pld_len_in_bits ) + 7 ) >> 3;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
294
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_bsp.h
Executable file
294
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_bsp.h
Executable file
@@ -0,0 +1,294 @@
|
||||
/*!
|
||||
* @file lr1121_modem_bsp.h
|
||||
*
|
||||
* @brief BSP driver for LR1121 modem
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_BSP_H
|
||||
#define LR1121_MODEM_BSP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lr1121_modem_common.h"
|
||||
#include "lr1121_modem_bsp_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief This command gets the board-specific correction offset for transmission power to be used (signed integer in
|
||||
* dB).
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] tx_power_offset Tx power offset correction in dBm
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_tx_power_offset( const void* context, int8_t* tx_power_offset );
|
||||
|
||||
/*!
|
||||
* @brief This command sets the board-specific correction offset for transmission power to be used
|
||||
*
|
||||
* The offset depends on the board design and antenna matching and is expressed in dB (signed integer).
|
||||
* The default value is -2dB.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] tx_power_offset Tx power offset correction in dBm
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_tx_power_offset( const void* context, const int8_t tx_power_offset );
|
||||
|
||||
/*!
|
||||
* @brief Configure the Output RF per power
|
||||
*
|
||||
* This command overload the output RF configuration for the given @p expected_power.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] output_power_configs Array of Tx output power configurations to set. It is up to the user to ensure it
|
||||
* contains at least @p n_output_power_configs
|
||||
* @param [in] n_output_power_configs Number of output power configuration to set. Valid values in range [1:41]
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_output_power_config(
|
||||
const void* context, const lr1121_modem_output_power_config_t* output_power_configs,
|
||||
uint8_t n_output_power_configs );
|
||||
|
||||
/*!
|
||||
* @brief This command gets the 41 Tx output power configurations for all Tx powers
|
||||
*
|
||||
* In case an @p expected_power is not available due to hardware limitation, all corresponding values in @p
|
||||
* lr1121_modem_output_power_config_t wil be set to 0x7F.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] output_power_config Tx output power configuration block list, \see
|
||||
* lr1121_modem_output_power_config_list_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_output_power_config(
|
||||
const void* context, lr1121_modem_output_power_config_list_t output_power_config );
|
||||
|
||||
/*!
|
||||
* @brief Configure RF output configuration
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] output RF output @ref lr1121_modem_bsp_radio_pa_selection_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_rf_output( const void* context,
|
||||
const lr1121_modem_bsp_radio_pa_selection_t output );
|
||||
|
||||
/*!
|
||||
* @brief Get RF output configuration
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] output RF output @ref lr1121_modem_bsp_radio_pa_selection_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_rf_output( const void* context,
|
||||
const lr1121_modem_bsp_radio_pa_selection_t* output );
|
||||
|
||||
/*!
|
||||
* @brief Get the Crystal error
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] crystal_error_ppm Crystal error in PPM
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_crystal_error( const void* context, uint32_t* crystal_error_ppm );
|
||||
|
||||
/*!
|
||||
* @brief Set the Crystal error of the MCU to fine adjust the rx window for LoRaWAN
|
||||
*
|
||||
* The default value is:
|
||||
* - When the Low-Frequency clock selected is @ref LR1121_MODEM_SYSTEM_LFCLK_RC : 16000 PPM
|
||||
* - Otherwise: 50 PPM
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] crystal_error_ppm Crystal error in PPM
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_crystal_error( const void* context, const uint32_t crystal_error_ppm );
|
||||
|
||||
/*!
|
||||
* @brief Get the XOSC trimming capacitor
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] capa_trim_a Trimming value for capacitance XTA
|
||||
* @param [out] capa_trim_b Trimming value for capacitance XTB
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_xosc_capa_trim_a_b( const void* context, uint8_t* capa_trim_a,
|
||||
uint8_t* capa_trim_b );
|
||||
|
||||
/*!
|
||||
* @brief Set the XOSC trimming capacitor
|
||||
*
|
||||
* @p capa_trim_a and @p capa_trim_b both takes value within [0, 47]. It configures the corresponding trimming
|
||||
* capacitance following \f$ C_{x,uF} = 0.47 \times capa\_trim\_x + N_x \f$ Where:
|
||||
* - \f$ N_a = 11.3 \f$
|
||||
* - \f$ N_b = 10.1 \f$
|
||||
*
|
||||
* So that \f$ C_{a,uF} \f$ goes from 11.3pF to 33.4pF ; and \f$ C_{b,uF} \f$ goes from 10.1pF to 32.2pF.
|
||||
*
|
||||
* Default value is 0x12 for both @p capa_trim_a and @p capa_trim_b which makes respectively 19.7pF and 18.5pF.
|
||||
*
|
||||
* Note that when the chip enters sleep mode, the capacitances XTA and XTB are respectively set to 13.6pF and 12.4pF.
|
||||
* When leaving sleep mode, XTA and XTB are set to the value configured by this command (or to the default ones).
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] capa_trim_a Trimming value for capacitance XTA
|
||||
* @param [in] capa_trim_b Trimming value for capacitance XTB
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_xosc_capa_trim_a_b( const void* context, const uint8_t capa_trim_a,
|
||||
const uint8_t capa_trim_b );
|
||||
|
||||
/**
|
||||
* @brief Get the instantaneous power consumption table
|
||||
*
|
||||
* The instantaneous power consumption values are used to evaluate the power consumption statistics.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] consumption_per_power Table of instantaneous consumption
|
||||
* @return Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_tx_power_consumption_ua(
|
||||
const void* context, lr1121_modem_tx_power_consumption_list_t consumption_per_power );
|
||||
|
||||
/**
|
||||
* @brief Set the instantaneous power consumption table
|
||||
*
|
||||
* The instantaneous power consumption values are used to evaluate the power consumption statistics.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] consumption_per_power Array of the instantaneous power consumption to set. Setting the field
|
||||
* consumed_power_ua to 0 reset the instantaneous consumption corresponding to the given Tx RF power to 0. It is up to
|
||||
* the caller to ensure this array contains at least n_consumption_per_power elements
|
||||
* @param [in] n_consumption_per_power Number of elements in the array @p consumption_per_power to set. Valid values
|
||||
* in range of [1:41]
|
||||
* @return Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_tx_power_consumption_ua(
|
||||
const void* context, const lr1121_modem_tx_power_consumption_value_t* consumption_per_power,
|
||||
uint8_t n_consumption_per_power );
|
||||
|
||||
/**
|
||||
* @brief Get LoRa Rx consumption configured
|
||||
*
|
||||
* The instantaneous power consumption values are used to evaluate the power consumption statistics.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] rx_consumption The LoRa instantaneous Rx consumption configured
|
||||
* @return lr1121_modem_response_code_t
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_lora_rx_power_consumption_ua(
|
||||
const void* context, lr1121_modem_rx_power_consumption_t* rx_consumption );
|
||||
|
||||
/**
|
||||
* @brief Set the LoRa Rx power consumption configuration
|
||||
*
|
||||
* The instantaneous power consumption values are used to evaluate the power consumption statistics.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] rx_consumption The LoRa Rx consumption structure to set. Setting one field to 0 reset it to its internal
|
||||
* value.
|
||||
* @return lr1121_modem_response_code_t
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_lora_rx_power_consumption_ua(
|
||||
const void* context, const lr1121_modem_rx_power_consumption_t* rx_consumption );
|
||||
|
||||
/**
|
||||
* @brief Get GFSK Rx power consumption configured
|
||||
*
|
||||
* The instantaneous power consumption values are used to evaluate the power consumption statistics.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] rx_consumption The GFSK instantaneous Rx consumption configured
|
||||
* @return lr1121_modem_response_code_t
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_gfsk_rx_power_consumption_ua(
|
||||
const void* context, lr1121_modem_rx_power_consumption_t* rx_consumption );
|
||||
|
||||
/**
|
||||
* @brief Set the GFSK Rx power consumption configuration
|
||||
*
|
||||
* The instantaneous power consumption values are used to evaluate the power consumption statistics.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] rx_consumption The GFSK Rx consumption structure to set. Setting one field to 0 reset it to its internal
|
||||
* value.
|
||||
* @return lr1121_modem_response_code_t
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_gfsk_rx_power_consumption_ua(
|
||||
const void* context, const lr1121_modem_rx_power_consumption_t* rx_consumption );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_BSP_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
203
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_bsp_types.h
Executable file
203
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_bsp_types.h
Executable file
@@ -0,0 +1,203 @@
|
||||
/*!
|
||||
* @file lr1121_modem_bsp_types.h
|
||||
*
|
||||
* @brief BSP driver types for LR1121 modem
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_BSP_TYPES_H
|
||||
#define LR1121_MODEM_BSP_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Number of output power config blocks
|
||||
*/
|
||||
#define LR1121_MODEM_NB_OUTPUT_POWER_CONFIG_BLOCKS ( 41 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Power Amplifier Selection values
|
||||
*
|
||||
* - Low-power Power Amplifier can reach up to 14dBm
|
||||
* - High-power Power Amplifier can reach up to 22 dBm
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_BSP_RADIO_PA_SEL_LP = 0x00, //!< Low-power Power Amplifier
|
||||
LR1121_MODEM_BSP_RADIO_PA_SEL_HP = 0x01, //!< High-power Power Amplifier
|
||||
LR1121_MODEM_BSP_RADIO_PA_SEL_LP_HP_LF =
|
||||
0x02, //!< Automatic selection between Low-power and High-power depending on requested power
|
||||
LR1121_MODEM_BSP_RADIO_PA_SEL_HF = 0x03, //!< High Frequency Power Amplifier
|
||||
} lr1121_modem_bsp_radio_pa_selection_t;
|
||||
|
||||
/*!
|
||||
* @brief Ramping time for PA
|
||||
*
|
||||
* This parameter is the ramping time of the PA. A high value improves spectral quality.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RAMP_16_US = 0x00, //!< 16 us Ramp Time
|
||||
LR1121_MODEM_RAMP_32_US = 0x01, //!< 32 us Ramp Time
|
||||
LR1121_MODEM_RAMP_48_US = 0x02, //!< 48 us Ramp Time (Default)
|
||||
LR1121_MODEM_RAMP_64_US = 0x03, //!< 64 us Ramp Time
|
||||
LR1121_MODEM_RAMP_80_US = 0x04, //!< 80 us Ramp Time
|
||||
LR1121_MODEM_RAMP_96_US = 0x05, //!< 96 us Ramp Time
|
||||
LR1121_MODEM_RAMP_112_US = 0x06, //!< 112 us Ramp Time
|
||||
LR1121_MODEM_RAMP_128_US = 0x07, //!< 128 us Ramp Time
|
||||
LR1121_MODEM_RAMP_144_US = 0x08, //!< 144 us Ramp Time
|
||||
LR1121_MODEM_RAMP_160_US = 0x09, //!< 160 us Ramp Time
|
||||
LR1121_MODEM_RAMP_176_US = 0x0A, //!< 176 us Ramp Time
|
||||
LR1121_MODEM_RAMP_192_US = 0x0B, //!< 192 us Ramp Time
|
||||
LR1121_MODEM_RAMP_208_US = 0x0C, //!< 208 us Ramp Time
|
||||
LR1121_MODEM_RAMP_240_US = 0x0D, //!< 240 us Ramp Time
|
||||
LR1121_MODEM_RAMP_272_US = 0x0E, //!< 272 us Ramp Time
|
||||
LR1121_MODEM_RAMP_304_US = 0x0F, //!< 304 us Ramp Time
|
||||
} lr1121_modem_ramp_time_t;
|
||||
|
||||
/*!
|
||||
* @brief Select power amplifier supply source
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_PA_REG_SUPPLY_VREG = 0x00, //!< Power amplifier supplied by the main regulator
|
||||
LR1121_MODEM_PA_REG_SUPPLY_VBAT = 0x01 //!< Power amplifier supplied by the battery
|
||||
} lr1121_modem_pa_reg_supply_t;
|
||||
|
||||
/*!
|
||||
* @brief Power Amplifier selection for RF output configuration table
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_OUTPUT_POWER_CONFIGURATION_PA_SEL_LP = 0x00, //!< Low-power Power Amplifier
|
||||
LR1121_MODEM_OUTPUT_POWER_CONFIGURATION_PA_SEL_HP = 0x01, //!< High-power Power Amplifier
|
||||
LR1121_MODEM_OUTPUT_POWER_CONFIGURATION_PA_SEL_HF = 0x02, //!< High Frequency Power Amplifier
|
||||
} lr1121_modem_output_power_configuration_pa_sel_t;
|
||||
|
||||
/*!
|
||||
* @brief Output Power Config structure
|
||||
*
|
||||
* A power configuration for an @p expected_power can be reset to its internal configuration by setting one of the other
|
||||
* structure field to value 0x7F.
|
||||
*
|
||||
* @p pa_duty_cycle controls the duty cycle of Power Amplifier according to:
|
||||
* \f$ dutycycle = 0.2 + 0.04 \times pa\_duty\_cycle \f$
|
||||
* It can be used to adapt the TX multi-band operation using a single-matching network.
|
||||
*
|
||||
* The allowed duty cycle values for LPA are from 0.2 to 0.48 (by step of 0.04). Therefore possible values for
|
||||
* pa_duty_cycle go from 0 to 7.
|
||||
*
|
||||
* The allowed duty cycle values for HPA go from 0.2 to 0.36 (by step of 0.04). Therefore in this case, the possible
|
||||
* values for pa_duty_cycle go from 0 to 4.
|
||||
*
|
||||
* @p pa_hp_sel controls the number of slices for HPA according to: \f$ \#slices = pa\_hp\_sel + 1 \f$
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t expected_power; //!< Expected power in dBm
|
||||
uint8_t configured_power; //!< Configured power in dBm
|
||||
lr1121_modem_pa_reg_supply_t pa_supply; //!< Power Amplifier regulator supply source
|
||||
uint8_t pa_duty_cycle; //!< Power Amplifier duty cycle (Default 0x04)
|
||||
lr1121_modem_output_power_configuration_pa_sel_t pa_sel; //!< Power Amplifier selection
|
||||
uint8_t pa_hp_sel; //!< Number of slices for HPA (Default 0x07)
|
||||
lr1121_modem_ramp_time_t pa_ramp_time; //!< Power amplifier ramp time
|
||||
} lr1121_modem_output_power_config_t;
|
||||
|
||||
/*!
|
||||
* @brief Output power config type
|
||||
*/
|
||||
typedef lr1121_modem_output_power_config_t
|
||||
lr1121_modem_output_power_config_list_t[LR1121_MODEM_NB_OUTPUT_POWER_CONFIG_BLOCKS];
|
||||
|
||||
/**
|
||||
* @brief Tx power consumption mapping structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int8_t tx_power_dbm; //!< Tx RF output power
|
||||
uint32_t consumed_power_ua; //!< Corresponding instantaneous power consumption (uA)
|
||||
} lr1121_modem_tx_power_consumption_value_t;
|
||||
|
||||
/**
|
||||
* @brief Power consumption table
|
||||
*/
|
||||
typedef lr1121_modem_tx_power_consumption_value_t
|
||||
lr1121_modem_tx_power_consumption_list_t[LR1121_MODEM_NB_OUTPUT_POWER_CONFIG_BLOCKS];
|
||||
|
||||
/**
|
||||
* @brief Rx power consumption structure
|
||||
*
|
||||
* The Rx power consumption depends on the Rx boosted configuration.
|
||||
*
|
||||
* @see lr1121_modem_radio_cfg_rx_boosted
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t consumption_rx_boosted_off_ua; //!< Instantaneous consumption without Rx boosted disabled (uA)
|
||||
uint32_t consumption_rx_boosted_on_ua; //!< Instantaneous consumption without Rx boosted enable (uA)
|
||||
} lr1121_modem_rx_power_consumption_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_BSP_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
107
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_common.h
Executable file
107
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_common.h
Executable file
@@ -0,0 +1,107 @@
|
||||
/*!
|
||||
* @file lr1121_modem_common.h
|
||||
*
|
||||
* @brief modem driver common definition for LR1121
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_COMMON_H
|
||||
#define LR1121_MODEM_COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Command group identifier
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_GROUP_ID_BSP = 0x0600, //!< Group ID for BSP commands
|
||||
LR1121_MODEM_GROUP_ID_MODEM = 0x0601, //!< Group ID for modem commands
|
||||
LR1121_MODEM_GROUP_ID_LORAWAN = 0x0602, //!< Group ID for LoRaWAN commands
|
||||
LR1121_MODEM_GROUP_ID_RELAY = 0x0603, //!< Group ID for relay commands
|
||||
} lr1121_modem_api_group_id_t;
|
||||
|
||||
/*!
|
||||
* @brief Command return code (RC)
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RESPONSE_CODE_OK = 0x00, //!< Driver command executed successfully
|
||||
LR1121_MODEM_RESPONSE_CODE_UNKOWN = 0x01, //!< Command code unknown
|
||||
LR1121_MODEM_RESPONSE_CODE_NOT_IMPLEMENTED = 0x02, //!< Command not implemented
|
||||
LR1121_MODEM_RESPONSE_CODE_NOT_INITIALIZED = 0x03, //!< Command not initialized
|
||||
LR1121_MODEM_RESPONSE_CODE_INVALID = 0x04, //!< Invalid command parameters
|
||||
LR1121_MODEM_RESPONSE_CODE_BUSY = 0x05, //!< Command cannot be executed now
|
||||
LR1121_MODEM_RESPONSE_CODE_FAIL = 0x06, //!< Command execution failed
|
||||
LR1121_MODEM_RESPONSE_CODE_BAD_CRC = 0x08, //!< CRC check failed
|
||||
LR1121_MODEM_RESPONSE_CODE_BAD_SIZE = 0x0A, //!< Size check failed
|
||||
LR1121_MODEM_RESPONSE_CODE_FRAME_ERROR = 0x0F, //!< SPI command checksum failed or CRC failed
|
||||
LR1121_MODEM_RESPONSE_CODE_NO_TIME = 0x10, //!< Modem time is not synchronized
|
||||
LR1121_MODEM_RESPONSE_CODE_NO_EVENT = 0x12, //!< No Event
|
||||
} lr1121_modem_response_code_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_COMMON_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
56
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_driver_version.h
Executable file
56
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_driver_version.h
Executable file
@@ -0,0 +1,56 @@
|
||||
/*!
|
||||
* @file lr1121_modem_driver_version.h
|
||||
*
|
||||
* @brief Placeholder to keep the version of LR1121 driver.
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_DRIVER_VERSION_H
|
||||
#define LR1121_MODEM_DRIVER_VERSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Version of the driver
|
||||
*/
|
||||
#define LR1121_MODEM_DRIVER_VERSION "v1.0.0"
|
||||
|
||||
/**
|
||||
* @brief Returns version string
|
||||
*/
|
||||
const char* lr1121_modem_driver_version_get_version_string( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_DRIVER_VERSION_H
|
||||
227
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_hal.h
Executable file
227
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_hal.h
Executable file
@@ -0,0 +1,227 @@
|
||||
/*!
|
||||
* @file lr1121_modem_hal.h
|
||||
*
|
||||
* @brief Hardware Abstraction Layer (HAL) interface for LR1121 modem
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_HAL_H
|
||||
#define LR1121_MODEM_HAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "lr1121_modem_common.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Status reported by the HAL layer
|
||||
*/
|
||||
typedef enum lr1121_modem_hal_status_e
|
||||
{
|
||||
LR1121_MODEM_HAL_STATUS_OK = 0x00, //!< Operation terminated successfully
|
||||
LR1121_MODEM_HAL_STATUS_ERROR = 0x01, //!< Operation terminated with error
|
||||
LR1121_MODEM_HAL_STATUS_BAD_FRAME = 0x0F, //!< Bad frame detected in the exchange
|
||||
LR1121_MODEM_HAL_STATUS_BUSY_TIMEOUT = 0xFF, //!< Timeout occured while waiting for Busy line state
|
||||
} lr1121_modem_hal_status_t;
|
||||
|
||||
/*
|
||||
* ============================================================================
|
||||
* API definitions to be implemented by the user
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Return the computed CRC
|
||||
*
|
||||
* @param [in] crc_initial_value initial value of the CRC
|
||||
* @param [in] buffer Buffer used to compute the CRC
|
||||
* @param [out] crc CRC computed
|
||||
*
|
||||
* @returns CRC value
|
||||
*/
|
||||
inline static uint8_t lr1121_modem_compute_crc( const uint8_t crc_initial_value, const uint8_t* buffer,
|
||||
uint16_t length )
|
||||
{
|
||||
uint8_t crc = crc_initial_value;
|
||||
uint8_t extract;
|
||||
uint8_t sum;
|
||||
for( int i = 0; i < length; i++ )
|
||||
{
|
||||
extract = *buffer;
|
||||
for( uint8_t j = 8; j; j-- )
|
||||
{
|
||||
sum = ( crc ^ extract ) & 0x01;
|
||||
crc >>= 1;
|
||||
if( sum )
|
||||
{
|
||||
crc ^= 0x65;
|
||||
}
|
||||
extract >>= 1;
|
||||
}
|
||||
buffer++;
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Radio data transfer - write
|
||||
*
|
||||
* @remark Must be implemented by the upper layer
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
* @param [in] command Pointer to the buffer to be transmitted
|
||||
* @param [in] command_length Buffer size to be transmitted
|
||||
* @param [in] data Pointer to the buffer to be transmitted
|
||||
* @param [in] data_length Buffer size to be transmitted
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_hal_status_t lr1121_modem_hal_write( const void* context, const uint8_t* command,
|
||||
const uint16_t command_length, const uint8_t* data,
|
||||
const uint16_t data_length );
|
||||
|
||||
/*!
|
||||
* Radio data transfer - read
|
||||
*
|
||||
* @remark Must be implemented by the upper layer
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
* @param [in] command Pointer to the buffer to be transmitted
|
||||
* @param [in] command_length Buffer size to be transmitted
|
||||
* @param [out] data Pointer to the buffer to be received
|
||||
* @param [in] data_length Buffer size to be received
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_hal_status_t lr1121_modem_hal_read( const void* context, const uint8_t* command,
|
||||
const uint16_t command_length, uint8_t* data,
|
||||
const uint16_t data_length );
|
||||
|
||||
/*!
|
||||
* @brief Radio data transfer - write & read in single operation
|
||||
*
|
||||
* @remark Must be implemented by the upper layer
|
||||
* @remark Only required by lr1121_system_get_status command
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
* @param [in] command Pointer to the buffer to be transmitted
|
||||
* @param [out] data Pointer to the buffer to be received
|
||||
* @param [in] data_length Buffer size to be received
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_hal_status_t lr1121_modem_hal_write_read( const void* context, const uint8_t* command, uint8_t* data,
|
||||
const uint16_t data_length );
|
||||
|
||||
/*!
|
||||
* @brief Direct read from the SPI bus
|
||||
*
|
||||
* @remark Unlike @ref lr1121_modem_hal_read, this is a simple direct SPI bus SS/read/nSS operation. While reading the
|
||||
* response data, the implementation of this function must ensure that only zero bytes (NOP) are written to the SPI bus.
|
||||
*
|
||||
* @remark Only required by the @ref lr1121_modem_system_get_status command
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
* @param [out] data Pointer to the buffer to be received
|
||||
* @param [in] data_length Buffer size to be received
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_hal_status_t lr1121_modem_hal_direct_read( const void* context, uint8_t* data,
|
||||
const uint16_t data_length );
|
||||
|
||||
/*!
|
||||
* Radio data transfer - write without wait the return code - this API is dedicated to the functions which reset the
|
||||
* Modem-E
|
||||
*
|
||||
* @remark Must be implemented by the upper layer
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
* @param [in] command Pointer to the buffer to be transmitted
|
||||
* @param [in] command_length Buffer size to be transmitted
|
||||
* @param [in] data Pointer to the buffer to be transmitted
|
||||
* @param [in] data_length Buffer size to be transmitted
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_hal_status_t lr1121_modem_hal_write_without_rc( const void* context, const uint8_t* command,
|
||||
const uint16_t command_length, const uint8_t* data,
|
||||
const uint16_t data_length );
|
||||
|
||||
/*!
|
||||
* Reset the radio
|
||||
*
|
||||
* @remark Must be implemented by the upper layer
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_hal_status_t lr1121_modem_hal_reset( const void* context );
|
||||
|
||||
/*!
|
||||
* Switch the radio in DFU mode
|
||||
*
|
||||
* @remark Must be implemented by the upper layer
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
*/
|
||||
void lr1121_modem_hal_enter_dfu( const void* context );
|
||||
|
||||
/*!
|
||||
* Wake the radio up.
|
||||
*
|
||||
* @remark Must be implemented by the upper layer
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_hal_status_t lr1121_modem_hal_wakeup( const void* context );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_HAL_H
|
||||
295
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_helper.h
Executable file
295
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_helper.h
Executable file
@@ -0,0 +1,295 @@
|
||||
/*!
|
||||
* @file lr1121_modem_helper.h
|
||||
*
|
||||
* @brief helper functions definition for LR1121 modem
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_HELPER_H
|
||||
#define LR1121_MODEM_HELPER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lr1121_modem_modem_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief LR1121 Modem helper status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_HELPER_STATUS_OK = 0,
|
||||
LR1121_MODEM_HELPER_STATUS_ERROR = 3,
|
||||
} lr1121_modem_helper_status_t;
|
||||
|
||||
/*!
|
||||
* @brief TX status values
|
||||
*
|
||||
* @see LR1121_MODEM_LORAWAN_EVENT_TX_DONE
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TX_NOT_SENT = 0x00,
|
||||
LR1121_MODEM_UNCONFIRMED_TX = 0x01,
|
||||
LR1121_MODEM_CONFIRMED_TX = 0x02,
|
||||
} lr1121_modem_tx_done_event_t;
|
||||
|
||||
/*!
|
||||
* @brief Link check request values
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_LINK_CHECK_NOT_RECEIVED = 0x00, //!< Link check response has not been received
|
||||
LR1121_MODEM_LINK_CHECK_RECEIVED = 0x01, //!< Link check response has been received
|
||||
} lr1121_modem_link_check_event_t;
|
||||
|
||||
/*!
|
||||
* @brief Time request values
|
||||
*
|
||||
* @see LR1121_MODEM_LORAWAN_EVENT_LORAWAN_MAC_TIME
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TIME_NOT_VALID = 0x00, //!< Time is not valid
|
||||
LR1121_MODEM_TIME_VALID = 0x01, //!< Time is valid and has been synchronized
|
||||
LR1121_MODEM_TIME_VALID_BUT_NOT_SYNC = 0x02, //!< Time is still valid but has not been synchronized
|
||||
} lr1121_modem_mac_time_event_t;
|
||||
|
||||
/*!
|
||||
* @brief class b ping slot info
|
||||
*
|
||||
* @see LR1121_MODEM_LORAWAN_EVENT_CLASS_B_PING_SLOT_INFO
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_INFO_NOT_ANSWERED = 0x00,
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_INFO_ANSWERED = 0x01,
|
||||
} lr1121_modem_class_b_ping_slot_info_t;
|
||||
|
||||
/*!
|
||||
* @brief class b ping slot status
|
||||
*
|
||||
* @see LR1121_MODEM_LORAWAN_EVENT_CLASS_B_STATUS
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_STATUS_NOT_READY = 0x00,
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_STATUS_READY = 0x01,
|
||||
} lr1121_modem_class_b_ping_slot_status_t;
|
||||
|
||||
/*!
|
||||
* @brief Event status for Wake On Radio protocol status change
|
||||
*
|
||||
* @see LR1121_MODEM_LORAWAN_EVENT_RELAY_TX_DYNAMIC
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RELAY_TX_DYNAMIC_WOR_DISABLED = 0x00,
|
||||
LR1121_MODEM_RELAY_TX_DYNAMIC_WOR_ENABLED = 0x01,
|
||||
} lr1121_modem_relay_tx_dynamic_status_t;
|
||||
|
||||
/*!
|
||||
* @brief Event status for relay Tx activation change
|
||||
*
|
||||
* @see LR1121_MODEM_LORAWAN_EVENT_RELAY_TX_MODE
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RELAY_TX_MODE_DISABLED = 0x00,
|
||||
LR1121_MODEM_RELAY_TX_MODE_ENABLED = 0x01,
|
||||
LR1121_MODEM_RELAY_TX_MODE_DYNAMIC = 0x02,
|
||||
LR1121_MODEM_RELAY_TX_MODE_DEVICE_CONTROLLED = 0x03,
|
||||
} lr1121_modem_relay_tx_mode_status_t;
|
||||
|
||||
/*!
|
||||
* @brief Event status for relay synchronization change
|
||||
*
|
||||
* @see LR1121_MODEM_LORAWAN_EVENT_RELAY_TX_SYNC
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RELAY_TX_SYNCHRONIZATION_INIT = 0x00,
|
||||
LR1121_MODEM_RELAY_TX_UNSYNCHRONIZED = 0x01,
|
||||
LR1121_MODEM_RELAY_TX_SYNCHRONIZED = 0x02,
|
||||
} lr1121_modem_relay_tx_sync_status_t;
|
||||
|
||||
/**
|
||||
* @brief Event status on FUOTA done event
|
||||
*
|
||||
* @see LR1121_MODEM_LORAWAN_EVENT_FUOTA_DONE
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_FUOTA_STATUS_TERMINATED_SUCCESSFULLY = 0x00, //!< FUOTA terminated successfully
|
||||
LR1121_MODEM_FUOTA_STATUS_FAILED = 0x01, //!< FUOTA failed
|
||||
LR1121_MODEM_FUOTA_STATUS_ONGOING = 0xFF, //!< FUOTA is ongoing
|
||||
LR1121_MODEM_FUOTA_STATUS_NOT_STARTED = 0xFE, //!< FUOTA is not started
|
||||
} lr1121_modem_fuota_status_t;
|
||||
|
||||
/**
|
||||
* @brief Event status on test mode event
|
||||
*
|
||||
* @see LR1121_MODEM_LORAWAN_EVENT_TEST_MODE
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TEST_MODE_STATUS_TX_NOT_SENT = 0x00,
|
||||
LR1121_MODEM_TEST_MODE_STATUS_TX_SENT = 0x01,
|
||||
LR1121_MODEM_TEST_MODE_STATUS_TERMINATED_ACTION = 0x02,
|
||||
} lr1121_modem_test_mode_status_t;
|
||||
|
||||
/**
|
||||
* @brief Event status on regional duty cycle event
|
||||
*
|
||||
* The duty cycle status can be obtained by calling @ref lr1121_modem_get_duty_cycle_status.
|
||||
*
|
||||
* @see lr1121_modem_get_duty_cycle_status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_REGINAL_DUTY_CYCLE_TX_ALLOWED =
|
||||
0x00, //!< Previously duty cycle constrained transmissions are now allowed
|
||||
LR1121_MODEM_REGINAL_DUTY_CYCLE_TX_CONSTRAINED = 0x01, //!< Transmissions are constrained by regional duty cycle
|
||||
} lr1121_modem_regional_duty_cycle_status_t;
|
||||
|
||||
/**
|
||||
* @brief Structure holding event-related data
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
lr1121_modem_lorawan_event_type_t event_type; //!< Type of the event
|
||||
uint8_t missed_events; //!< Number of @p event_type events missed before the current one
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint16_t count;
|
||||
} reset;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_tx_done_event_t status;
|
||||
} txdone;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_link_check_event_t status;
|
||||
} link_check;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_mac_time_event_t status;
|
||||
} mac_time;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_class_b_ping_slot_info_t status;
|
||||
} ping_slot_info;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_class_b_ping_slot_status_t status;
|
||||
} ping_slot_status;
|
||||
struct
|
||||
{
|
||||
uint8_t mc_group_id;
|
||||
} new_multicast_class_c_groupid;
|
||||
struct
|
||||
{
|
||||
uint8_t mc_group_id;
|
||||
} new_multicast_class_b_groupid;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_relay_tx_dynamic_status_t status;
|
||||
} relay_tx_dynamic_status;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_relay_tx_mode_status_t status;
|
||||
} relay_tx_mode_status;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_relay_tx_sync_status_t status;
|
||||
} relay_tx_sync_status;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_fuota_status_t status;
|
||||
} fuota_status;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_test_mode_status_t status;
|
||||
} test_mode_status;
|
||||
struct
|
||||
{
|
||||
lr1121_modem_regional_duty_cycle_status_t status;
|
||||
} regional_duty_cycle_status;
|
||||
} event_data; //!< Status data associated to the event
|
||||
} lr1121_modem_event_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Extract the event data contained in the event field buffer
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] modem_event Struct containing the event data \see lr1121_modem_event_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_helper_status_t lr1121_modem_helper_get_event_data( const void* context,
|
||||
lr1121_modem_event_t* modem_event );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_HELPER_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
1006
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_lorawan.h
Executable file
1006
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_lorawan.h
Executable file
File diff suppressed because it is too large
Load Diff
339
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_lorawan_types.h
Executable file
339
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_lorawan_types.h
Executable file
@@ -0,0 +1,339 @@
|
||||
/*!
|
||||
* @file lr1121_modem_lorawan_types.h
|
||||
*
|
||||
* @brief LoRaWAN driver types for LR1121 modem
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_LORAWAN_TYPES_H
|
||||
#define LR1121_MODEM_LORAWAN_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a LoRaWAN device eui
|
||||
*/
|
||||
#define LR1121_MODEM_DEV_EUI_LENGTH ( 8 )
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a LoRaWAN join eui
|
||||
*/
|
||||
#define LR1121_MODEM_JOIN_EUI_LENGTH ( 8 )
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a LoRaWAN application key
|
||||
*/
|
||||
#define LR1121_MODEM_APP_KEY_LENGTH ( 16 )
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a LoRaWAN network key
|
||||
*/
|
||||
#define LR1121_MODEM_NWK_KEY_LENGTH ( 16 )
|
||||
|
||||
/*!
|
||||
* @brief Length of datarate distribution array
|
||||
*/
|
||||
#define LR1121_MODEM_DATARATE_DISTRIBUTION_LENGTH ( 16 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief LoRaWAN class type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_LORAWAN_CLASS_A = 0x00,
|
||||
LR1121_LORAWAN_CLASS_B = 0x01,
|
||||
LR1121_LORAWAN_CLASS_C = 0x02,
|
||||
} lr1121_modem_classes_t;
|
||||
|
||||
/**
|
||||
* @brief LoRaWAN network type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_LORAWAN_PRIVATE_NETWORK = 0x00, //!< LoRaWAN private network
|
||||
LR1121_MODEM_LORAWAN_PUBLIC_NETWORK = 0x01 //!< LoRaWAN public network
|
||||
} lr1121_modem_network_type_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRaWAN region type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_LORAWAN_REGION_EU868 = 0x01,
|
||||
LR1121_LORAWAN_REGION_AS923_GRP1 = 0x02,
|
||||
LR1121_LORAWAN_REGION_US915 = 0x03,
|
||||
LR1121_LORAWAN_REGION_AU915 = 0x04,
|
||||
LR1121_LORAWAN_REGION_CN470 = 0x05,
|
||||
LR1121_LORAWAN_REGION_WW2G4 = 0x06,
|
||||
LR1121_LORAWAN_REGION_AS923_GRP2 = 0x07,
|
||||
LR1121_LORAWAN_REGION_AS923_GRP3 = 0x08,
|
||||
LR1121_LORAWAN_REGION_IN865 = 0x09,
|
||||
LR1121_LORAWAN_REGION_KR920 = 0x0A,
|
||||
LR1121_LORAWAN_REGION_RU864 = 0x0B,
|
||||
LR1121_LORAWAN_REGION_CN470_RP_1_0 = 0x0C,
|
||||
LR1121_LORAWAN_REGION_AS923_GRP4 = 0x0D,
|
||||
} lr1121_modem_regions_t;
|
||||
|
||||
/*!
|
||||
* @brief Adaptative Data Rate profiles type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_ADR_PROFILE_NETWORK_SERVER_CONTROLLED = 0x00, //!< Network Server Controlled
|
||||
LR1121_MODEM_ADR_PROFILE_MOBILE_LONG_RANGE = 0x01, //!< Mobile Long Range : 50% MinDr, 25% MinDr + 1, 25% MinDr + 2
|
||||
LR1121_MODEM_ADR_PROFILE_MOBILE_LOW_POWER =
|
||||
0x02, //!< Mobile Low Power : 25% MaxDr, 25% MaxDr - 1, 25% MaxDr - 2, 25% MaxDr - 3
|
||||
LR1121_MODEM_ADR_PROFILE_CUSTOM =
|
||||
0x03, //!< Custom List A custom ADR profile consists of a list of 16 preferred data rates.
|
||||
//!< For every transmission, a random entry in that list is selected.
|
||||
} lr1121_modem_adr_profiles_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRaWAN uplink type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_UPLINK_UNCONFIRMED = 0x00,
|
||||
LR1121_MODEM_UPLINK_CONFIRMED = 0x01,
|
||||
} lr1121_modem_uplink_type_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRaWAN Duty Cycle activation type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_CERTIFICATION_MODE_DISABLE = 0x00,
|
||||
LR1121_MODEM_CERTIFICATION_MODE_ENABLE = 0x01,
|
||||
} lr1121_modem_certification_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief Listen Before Talk (LBT) activation type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_LBT_MODE_DISABLE = 0x00,
|
||||
LR1121_MODEM_LBT_MODE_ENABLE = 0x01,
|
||||
} lr1121_modem_lbt_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief Carrier Sense Multiple Access (CSMA) activation type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_CSMA_MODE_DISABLE = 0x00,
|
||||
LR1121_MODEM_CSMA_MODE_ENABLE = 0x01,
|
||||
} lr1121_modem_csma_mode_t;
|
||||
|
||||
/**
|
||||
* @brief Carrier Sense Multiple Access (CSMA) backoff activation type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_CSMA_BACKOFF_DISABLE = 0x00, //!< Disable CMSA backoff
|
||||
LR1121_MODEM_CSMA_BACKOFF_ENABLE = 0x01, //!< Enable CMSA backoff
|
||||
} lr1121_modem_csma_backoff_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRaWAN mac request field
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_MAC_REQUEST_LINK_CHECK = 0x01, //!< Enable the MAC Link Check request
|
||||
LR1121_MODEM_MAC_REQUEST_TIME = 0x02, //!< Enable the MAC Time request
|
||||
LR1121_MODEM_MAC_REQUEST_PING_SLOT_INFO = 0x04, //!< Enable the MAC Ping Slot Info request
|
||||
} lr1121_modem_mac_request_t;
|
||||
|
||||
/**
|
||||
* @brief Bit mask for lr1121_modem_mac_request_t
|
||||
*
|
||||
* @see lr1121_modem_mac_request_t
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_mac_request_bitmask_t;
|
||||
|
||||
/*!
|
||||
* @brief RX flags encoding
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RX1 = 0x01, //!< received on RX1 unicast
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RX2 = 0x02, //!< received on RX2 unicast
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXC = 0x03, //!< received on Class C RX unicast
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXC_MULTICAST_GROUP0 = 0x04, //!< received on Class C Multicast RX for group 0
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXC_MULTICAST_GROUP1 = 0x05, //!< received on Class C Multicast RX for group 1
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXC_MULTICAST_GROUP2 = 0x06, //!< received on Class C Multicast RX for group 2
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXC_MULTICAST_GROUP3 = 0x07, //!< received on Class C Multicast RX for group 3
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXB = 0x08, //!< received on Class B RX unicast
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXB_MULTICAST_GROUP0 = 0x09, //!< received on Class B Multicast RX for group 0
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXB_MULTICAST_GROUP1 = 0x0A, //!< received on Class B Multicast RX for group 1
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXB_MULTICAST_GROUP2 = 0x0B, //!< received on Class B Multicast RX for group 2
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXB_MULTICAST_GROUP3 = 0x0C, //!< received on Class B Multicast RX for group 3
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXBEACON = 0x0D, //!< received a Class B beacon
|
||||
LR1121_MODEM_DOWNLINK_WINDOW_RXRELAY = 0x0E, //!< received on Relay window
|
||||
} lr1121_modem_downlink_window_t;
|
||||
|
||||
/*!
|
||||
* @brief class b ping slot status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_1_S = 0x00, //!< 1 second ping-slot periodicity
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_2_S = 0x01, //!< 2 seconds ping-slot periodicity
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_4_S = 0x02, //!< 4 seconds ping-slot periodicity
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_8_S = 0x03, //!< 8 seconds ping-slot periodicity
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_16_S = 0x04, //!< 16 seconds ping-slot periodicity
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_32_S = 0x05, //!< 32 seconds ping-slot periodicity
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_64_S = 0x06, //!< 64 seconds ping-slot periodicity
|
||||
LR1121_MODEM_CLASS_B_PING_SLOT_128_S = 0x07, //!< 128 seconds ping-slot periodicity
|
||||
} lr1121_modem_class_b_ping_slot_t;
|
||||
|
||||
/*!
|
||||
* @brief Select the source of battery level value to use for DevStatusAns MAC command
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_BATTERY_LEVEL_FROM_INTERNAL_VALUE =
|
||||
0x00, //!< Battery level is obtained from LR1121 VBat (see @ref lr1121_modem_system_get_vbat)
|
||||
LR1121_MODEM_BATTERY_LEVEL_FROM_USER_VALUE = 0x01, //!< Battery level is provided by user application
|
||||
} lr1121_modem_battery_level_source_value_t;
|
||||
|
||||
/*!
|
||||
* @brief Join EUI type
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_join_eui_t[LR1121_MODEM_JOIN_EUI_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Device EUI type
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_dev_eui_t[LR1121_MODEM_DEV_EUI_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Application key type
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_app_key_t[LR1121_MODEM_APP_KEY_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Application key type
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_nwk_key_t[LR1121_MODEM_NWK_KEY_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief modem downlink metadata structure
|
||||
*
|
||||
* The Signal to Noise Ratio (SNR) is returned as an integer part, and a decimal part in 0.25 dB.
|
||||
* The SNR in dB is therefore obtained by: \f$ SNR_{dB} = snr\_integer + 0.25 \times snr\_quarter \f$
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t stack_id; //!< The stack identifier that receives the downlink
|
||||
int16_t rssi; //!< The RSSI of the received downlink in dBm
|
||||
int8_t snr_integer; //!< Signal to Noise Ratio of the received downlink (integer part, in dB)
|
||||
uint8_t snr_quarter; //!< Signal to Noise Ratio of the received downlink (0.25dB counts)
|
||||
lr1121_modem_downlink_window_t window; //!< Rx window of the received downlink
|
||||
uint8_t fport; //!< LoRaWAN port of the received downlink
|
||||
uint8_t fpending_bit; //!< Frame pending bit of the received downlink
|
||||
uint32_t frequency_hz; //!< RF frequency of the received downlink
|
||||
uint8_t datarate; //!< Datarate of the received downlink
|
||||
} lr1121_modem_downlink_metadata_t;
|
||||
|
||||
/*!
|
||||
* @brief multicast class c status structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t is_session_started; //!< Indicate if the multicast class C session is started
|
||||
uint32_t downlink_frequency; //!< Downlink frequency of the multicast class C session
|
||||
uint8_t downlink_datarate; //!< Datarate of the multicast class C session
|
||||
} lr1121_modem_multicast_class_c_status_t;
|
||||
|
||||
/*!
|
||||
* @brief multicast class b status structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t is_session_started; //!< Indicate if the multicast class B session is started
|
||||
uint32_t downlink_frequency; //!< Downlink frequency of the multicast class B session
|
||||
uint8_t downlink_datarate; //!< Datarate of the multicast class B session
|
||||
uint8_t is_session_waiting_for_beacon; //!< Indicates whether the multicast class B session have received a beacon
|
||||
uint8_t ping_slot_periodicity; //!< Ping slot periodicity of the multicast class B session
|
||||
} lr1121_modem_multicast_class_b_status_t;
|
||||
|
||||
/*!
|
||||
* @brief LR1121 LoRaWAN version structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t lorawan_major; //!< Major number of the LoRaWAN standard implemented
|
||||
uint8_t lorawan_minor; //!< Minor number of the LoRaWAN standard implemented
|
||||
uint8_t lorawan_patch; //!< Patch number of the LoRaWAN standard implemented
|
||||
uint8_t lorawan_revision; //!< Revision number of the LoRaWAN standard implemented
|
||||
uint8_t rp_major; //!< Major number of the regional parameters implemented
|
||||
uint8_t rp_minor; //!< Minor number of the regional parameters implemented
|
||||
uint8_t rp_patch; //!< Patch number of the regional parameters implemented
|
||||
uint8_t rp_revision; //!< Revision number of the regional parameters implemented
|
||||
} lr1121_modem_lorawan_version_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_LORAWAN_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
144
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_lr_fhss.h
Executable file
144
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_lr_fhss.h
Executable file
@@ -0,0 +1,144 @@
|
||||
/*!
|
||||
* @file lr1121_modem_lr_fhss.h
|
||||
*
|
||||
* @brief LR_FHSS driver definition for LR1121
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_LR_FHSS_H
|
||||
#define LR1121_MODEM_LR_FHSS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lr1121_modem_lr_fhss_types.h"
|
||||
#include "lr1121_modem_common.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Length, in bytes, of a LR-FHSS sync word
|
||||
*/
|
||||
#define LR_FHSS_SYNC_WORD_BYTES ( 4 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Initialize the LR_FHSS
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_lr_fhss_init( const void* context );
|
||||
|
||||
/**
|
||||
* @brief Get the delay in microsecond between the last bit sent and the TX done interrupt
|
||||
*
|
||||
* @param [in] params lr1121 LR-FHSS parameter structure
|
||||
* @param [in] payload_length Length of application-layer payload
|
||||
*
|
||||
* @returns Delay in microseconds
|
||||
*/
|
||||
uint16_t lr1121_modem_lr_fhss_get_bit_delay_in_us( const lr1121_modem_lr_fhss_params_t* params,
|
||||
uint16_t payload_length );
|
||||
|
||||
/*!
|
||||
* @brief Configure a payload to be sent with LR_FHSS
|
||||
*
|
||||
* When calling this method, lr1121_modem_radio_set_lr_fhss_sync_word is implicitely called to configure the sync word.
|
||||
* Note that the syncword must be 4 bytes long.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] lr_fhss_params Parameter configuration structure of the LRFHSS
|
||||
* @param [in] hop_sequence_id Seed used to derive the hopping sequence pattern. Only the nine LSBs are taken into
|
||||
* account
|
||||
* @param [in] payload The payload to send. It is the responsibility of the caller to ensure that this references an
|
||||
* array containing at least payload_length elements
|
||||
* @param [in] payload_length The length of the payload
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_lr_fhss_build_frame( const void* context,
|
||||
const lr1121_modem_lr_fhss_params_t* lr_fhss_params,
|
||||
uint16_t hop_sequence_id, const uint8_t* payload,
|
||||
uint8_t payload_length );
|
||||
|
||||
/*!
|
||||
* @brief Get the time on air in ms for LR-FHSS transmission
|
||||
*
|
||||
* @param [in] params LR1121 LR-FHSS parameter structure
|
||||
* @param [in] payload_length Length of application-layer payload
|
||||
*
|
||||
* @returns Time-on-air value in ms for LR-FHSS transmission
|
||||
*/
|
||||
uint32_t lr1121_modem_lr_fhss_get_time_on_air_in_ms( const lr1121_modem_lr_fhss_params_t* params,
|
||||
uint16_t payload_length );
|
||||
|
||||
/**
|
||||
* @brief Return the number of hop sequences available using the given parameters
|
||||
*
|
||||
* @param [in] lr_fhss_params Parameter configuration structure of the LRFHSS
|
||||
*
|
||||
* @return Returns the number of valid hop sequences (512 or 384)
|
||||
*/
|
||||
unsigned int lr1121_modem_lr_fhss_get_hop_sequence_count( const lr1121_modem_lr_fhss_params_t* lr_fhss_params );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_LR_FHSS_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
66
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_lr_fhss_types.h
Executable file
66
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_lr_fhss_types.h
Executable file
@@ -0,0 +1,66 @@
|
||||
/*!
|
||||
* @file lr1121_modem_lr_fhss_types.h
|
||||
*
|
||||
* @brief LR_FHSS types definition for LR1121
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_LR_FHSS_TYPES_H
|
||||
#define LR1121_MODEM_LR_FHSS_TYPES_H
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "lr_fhss_v1_base_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief LR FHSS parameter structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
lr_fhss_v1_params_t lr_fhss_params; //!< Base LR FHSS parameters
|
||||
int8_t device_offset; //!< Per device offset to avoid collisions over the air. Possible values:
|
||||
//!< - if lr_fhss_params.grid == LR_FHSS_V1_GRID_25391_HZ:
|
||||
//!< [-26, 25]
|
||||
//!< - if lr_fhss_params.grid == LR_FHSS_V1_GRID_3906_HZ:
|
||||
//!< [-4, 3]
|
||||
} lr1121_modem_lr_fhss_params_t;
|
||||
|
||||
#endif // LR1121_MODEM_LR_FHSS_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
393
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_modem.h
Executable file
393
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_modem.h
Executable file
@@ -0,0 +1,393 @@
|
||||
/*!
|
||||
* @file lr1121_modem_modem.h
|
||||
*
|
||||
* @brief Modem driver for LR1121 modem
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_MODEM_H
|
||||
#define LR1121_MODEM_MODEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "lr1121_modem_common.h"
|
||||
#include "lr1121_modem_modem_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Reset non-volatile settings to their default value
|
||||
*
|
||||
* Settings that are reset are:
|
||||
* - region
|
||||
* - devnonce
|
||||
* - joinnonce
|
||||
* - LoRaWAN certification state
|
||||
* - low frequency clock source
|
||||
* - reset counter
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_factory_reset( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Return the modem version information
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] modem_version Version of the LR1121 modem
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_modem_version( const void* context,
|
||||
lr1121_modem_version_t* modem_version );
|
||||
|
||||
/*!
|
||||
* @brief Return the modem status
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status LR1121 mode status bit mask @ref lr1121_modem_lorawan_status_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_status( const void* context,
|
||||
lr1121_modem_lorawan_status_bitmask_t* status );
|
||||
|
||||
/*!
|
||||
* @brief Return and reset the consumption statistics of the modem
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] charge Charge counter in mAh
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_charge( const void* context, lr1121_modem_charge_t* charge );
|
||||
|
||||
/*!
|
||||
* @brief Get pending events from the modem
|
||||
*
|
||||
* Pending events are indicated by the EVENT line. The EVENT line will be de-asserted after all events have been
|
||||
* retrieved and no further events are available.
|
||||
* When no event is available this command returns with empty response payload.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] event_fields \see lr1121_modem_event_fields_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_event( const void* context, lr1121_modem_event_fields_t* event_fields );
|
||||
|
||||
/*!
|
||||
* @brief Suspend or resume the modem’s radio operations
|
||||
*
|
||||
* It can be used to prevent extra power consumption by the modem in case the application MCU temporarily needs more
|
||||
* power itself and wants to prevent exceeding limits.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] suspend Operations are suspended with parameter value 0x01 and resumed with parameter value 0x00 @ref
|
||||
* lr1121_modem_suspend_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_suspend( const void* context, const lr1121_modem_suspend_t suspend );
|
||||
|
||||
/*!
|
||||
* @brief Get suspend or resume state of the the modem’s radio operations.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] suspend Operations are suspended with parameter value 0x01 and resumed with parameter value 0x00 @ref
|
||||
* lr1121_modem_suspend_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_suspend( const void* context, lr1121_modem_suspend_t* suspend );
|
||||
|
||||
/*!
|
||||
* @brief Set an application alarm timer in seconds
|
||||
*
|
||||
* When the timer has expired the event @ref LR1121_MODEM_LORAWAN_EVENT_ALARM is generated.
|
||||
* If this command is applied again before the timer has expired, the timer will be started again with the new period.
|
||||
* Value 0 immediately generates event @ref LR1121_MODEM_LORAWAN_EVENT_ALARM.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] seconds Seconds
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_set_alarm_timer( const void* context, uint32_t seconds );
|
||||
|
||||
/*!
|
||||
* @brief Clear the alarm timer
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_clear_alarm_timer( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Get the application alarm timer remaining time
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] remaining_time Remaining time in seconds
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_alarm_remaining_time( const void* context, uint32_t* remaining_time );
|
||||
|
||||
/*!
|
||||
* @brief Get the crashlog status
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status Crashlog status, see \ref lr1121_modem_crashlog_status_t
|
||||
* @param [out] crashlog Function name in ASCII. It is up to the caller to ensure this pointer is at least 242 bytes
|
||||
* long
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_get_crashlog( const void* context, lr1121_modem_crashlog_status_t* status,
|
||||
uint8_t* crashlog );
|
||||
|
||||
/*!
|
||||
* @brief Enable test functions
|
||||
*
|
||||
* With the exception of the @ref lr1121_modem_test_mode_start command, test commands are only available if test mode is
|
||||
* active. Test mode can only be activated if the modem has not yet received a command that results in a radio
|
||||
* operation. Once test mode is active, all other modem commands are disabled.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_mode_start( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief No operation. This command may be used to terminate an ongoing continuous TX operation.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_nop( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Transmit LoRa packets
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] frequency Frequency in Hz
|
||||
* @param [in] tx_power Tx power in dBm
|
||||
* @param [in] payload_length Payload length
|
||||
* @param [in] sf spreading factor @ref lr1121_modem_tst_mode_lora_sf_t
|
||||
* @param [in] bw bandwidth @ref lr1121_modem_tst_mode_lora_bw_t
|
||||
* @param [in] cr Coding Rate @ref lr1121_modem_tst_mode_lora_cr_t
|
||||
* @param [in] is_iq_inverted Enable IQ inverted
|
||||
* @param [in] is_crc_enabled Enable CRC field
|
||||
* @param [in] header_mode Configure header implicit or explicit
|
||||
* @param [in] preamble_length Number of preamble symbols
|
||||
* @param [in] number_of_tx Number of packet to send. 0 makes the chip to send packet infinitely until call to @ref
|
||||
* lr1121_modem_test_nop
|
||||
* @param [in] delay_ms Delay between two consecutive transmit
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_tx_lora(
|
||||
const void* context, uint32_t frequency, int8_t tx_power, uint8_t payload_length,
|
||||
lr1121_modem_tst_mode_lora_sf_t sf, lr1121_modem_tst_mode_lora_bw_t bw, lr1121_modem_tst_mode_lora_cr_t cr,
|
||||
bool is_iq_inverted, bool is_crc_enabled, lr1121_modem_tst_mode_lora_packet_header_mode_t header_mode,
|
||||
uint32_t preamble_length, uint32_t number_of_tx, uint32_t delay_ms );
|
||||
|
||||
/*!
|
||||
* @brief Transmit FSK packets
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] frequency Frequency in Hz
|
||||
* @param [in] tx_power Tx power in dBm
|
||||
* @param [in] payload_length Payload length
|
||||
* @param [in] number_of_tx Number of packet to send. 0 makes the chip to send packet infinitely until call to @ref
|
||||
* lr1121_modem_test_nop
|
||||
* @param [in] delay_ms Delay between two consecutive transmit
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_tx_fsk( const void* context, uint32_t frequency, int8_t tx_power,
|
||||
uint8_t payload_length, uint32_t number_of_tx,
|
||||
uint32_t delay_ms );
|
||||
|
||||
/*!
|
||||
* @brief Transmit LR-FHSS packets
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] frequency Frequency in Hz
|
||||
* @param [in] tx_power Tx power in dBm
|
||||
* @param [in] payload_length Payload length
|
||||
* @param [in] grid LR-FHSS grid
|
||||
* @param [in] bw LR-FHSS bandwidth
|
||||
* @param [in] cr LR-FHSS coding rate
|
||||
* @param [in] number_of_tx Number of packet to send. 0 makes the chip to send packet infinitely until call to @ref
|
||||
* lr1121_modem_test_nop
|
||||
* @param [in] delay_ms Delay between two consecutive transmit
|
||||
* @param [in] is_hopping_enabled Enable LR-FHSS frequency hopping
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_tx_lr_fhss( const void* context, uint32_t frequency, int8_t tx_power,
|
||||
uint8_t payload_length,
|
||||
lr1121_modem_tst_mode_lr_fhss_grid_t grid,
|
||||
lr1121_modem_tst_mode_lr_fhss_bw_t bw,
|
||||
lr1121_modem_tst_mode_lr_fhss_cr_t cr, uint32_t number_of_tx,
|
||||
uint32_t delay_ms, bool is_hopping_enabled );
|
||||
|
||||
/*!
|
||||
* @brief Transmit a continuous wave.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] frequency Frequency in Hz
|
||||
* @param [in] tx_power Tx power in dBm
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_tx_cw( const void* context, uint32_t frequency, int8_t tx_power );
|
||||
|
||||
/*!
|
||||
* @brief Continuously receive LoRa packets
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] frequency Frequency in Hz
|
||||
* @param [in] sf spreading factor @ref lr1121_modem_tst_mode_lora_sf_t
|
||||
* @param [in] bw bandwidth @ref lr1121_modem_tst_mode_lora_bw_t
|
||||
* @param [in] cr Coding Rate @ref lr1121_modem_tst_mode_lora_cr_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_rx_lora_cont( const void* context, uint32_t frequency,
|
||||
lr1121_modem_tst_mode_lora_sf_t sf,
|
||||
lr1121_modem_tst_mode_lora_bw_t bw,
|
||||
lr1121_modem_tst_mode_lora_cr_t cr );
|
||||
|
||||
/*!
|
||||
* @brief Continuously receive FSK packets
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] frequency Frequency in Hz
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_rx_fsk_cont( const void* context, uint32_t frequency );
|
||||
|
||||
/*!
|
||||
* @brief Read the packet counter received during continuously receive packets test.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] rx_packet_counter The counter of packet received during RX continuous packet test
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_test_rx_lora_cont
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_read_packet_counter_rx_cont( const void* context,
|
||||
uint32_t* rx_packet_counter );
|
||||
|
||||
/*!
|
||||
* @brief Continuously receive packets on Sub-GHz radio path.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] frequency Frequency in Hz
|
||||
* @param [in] time_ms time in millisecond of the radio acquisition
|
||||
* @param [in] bw_hz bandwidth in Hz
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_rssi_subghz( const void* context, uint32_t frequency, uint16_t time_ms,
|
||||
uint32_t bw_hz );
|
||||
|
||||
/*!
|
||||
* @brief Reset the LR1121 radio.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_radio_rst( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Exit test mode and reset LR1121 modem.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_exit( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Read RSSI after a Sub Gig / 2.4 Ghz test rssi command.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] rssi RSSI in dBm
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_test_read_rssi( const void* context, int16_t* rssi );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_MODEM_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
296
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_modem_types.h
Executable file
296
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_modem_types.h
Executable file
@@ -0,0 +1,296 @@
|
||||
/*!
|
||||
* @file lr1121_modem_modem_types.h
|
||||
*
|
||||
* @brief Modem driver types for LR1121 modem
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_MODEM_TYPES_H
|
||||
#define LR1121_MODEM_MODEM_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "lr1121_modem_common.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Modem status bits
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_LORAWAN_CRASH = 0x02,
|
||||
LR1121_LORAWAN_JOINED = 0x08,
|
||||
LR1121_LORAWAN_SUSPEND = 0x10,
|
||||
LR1121_LORAWAN_JOINING = 0x40,
|
||||
} lr1121_modem_lorawan_status_t;
|
||||
|
||||
/**
|
||||
* @brief Bit mask for lr1121_modem_lorawan_status_t
|
||||
*
|
||||
* @see lr1121_modem_lorawan_status_t
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_lorawan_status_bitmask_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa spreading factor for test mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TST_MODE_LORA_SF5 = 0x05,
|
||||
LR1121_MODEM_TST_MODE_LORA_SF6 = 0x06,
|
||||
LR1121_MODEM_TST_MODE_LORA_SF7 = 0x07,
|
||||
LR1121_MODEM_TST_MODE_LORA_SF8 = 0x08,
|
||||
LR1121_MODEM_TST_MODE_LORA_SF9 = 0x09,
|
||||
LR1121_MODEM_TST_MODE_LORA_SF10 = 0x0A,
|
||||
LR1121_MODEM_TST_MODE_LORA_SF11 = 0x0B,
|
||||
LR1121_MODEM_TST_MODE_LORA_SF12 = 0x0C,
|
||||
} lr1121_modem_tst_mode_lora_sf_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa bandwidth for test mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TST_MODE_LORA_10_KHZ = 0x01,
|
||||
LR1121_MODEM_TST_MODE_LORA_15_KHZ = 0x02,
|
||||
LR1121_MODEM_TST_MODE_LORA_20_KHZ = 0x03,
|
||||
LR1121_MODEM_TST_MODE_LORA_31_KHZ = 0x04,
|
||||
LR1121_MODEM_TST_MODE_LORA_41_KHZ = 0x05,
|
||||
LR1121_MODEM_TST_MODE_LORA_62_KHZ = 0x06,
|
||||
LR1121_MODEM_TST_MODE_LORA_125_KHZ = 0x07,
|
||||
LR1121_MODEM_TST_MODE_LORA_200_KHZ = 0x08,
|
||||
LR1121_MODEM_TST_MODE_LORA_250_KHZ = 0x09,
|
||||
LR1121_MODEM_TST_MODE_LORA_400_KHZ = 0x0A,
|
||||
LR1121_MODEM_TST_MODE_LORA_500_KHZ = 0x0B,
|
||||
LR1121_MODEM_TST_MODE_LORA_800_KHZ = 0x0C,
|
||||
} lr1121_modem_tst_mode_lora_bw_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa coding rate for test mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TST_MODE_LORA_CR_4_5 = 0x01,
|
||||
LR1121_MODEM_TST_MODE_LORA_CR_4_6 = 0x02,
|
||||
LR1121_MODEM_TST_MODE_LORA_CR_4_7 = 0x03,
|
||||
LR1121_MODEM_TST_MODE_LORA_CR_4_8 = 0x04,
|
||||
LR1121_MODEM_TST_MODE_LORA_CR_4_5_LONG_INTERLEAVING = 0x05,
|
||||
LR1121_MODEM_TST_MODE_LORA_CR_4_6_LONG_INTERLEAVING = 0x06,
|
||||
LR1121_MODEM_TST_MODE_LORA_CR_4_8_LONG_INTERLEAVING = 0x07,
|
||||
} lr1121_modem_tst_mode_lora_cr_t;
|
||||
|
||||
/**
|
||||
* @brief LR_FHSS grid for test mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_GRID_V1_25391_HZ = 0x00,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_GRID_V1_3906_HZ = 0x01,
|
||||
} lr1121_modem_tst_mode_lr_fhss_grid_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS bandwidth for test mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_39063_HZ = 0x00,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_85938_HZ = 0x01,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_136719_HZ = 0x02,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_183594_HZ = 0x03,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_335938_HZ = 0x04,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_386719_HZ = 0x05,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_722656_HZ = 0x06,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_773438_HZ = 0x07,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_1523438_HZ = 0x08,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_BW_V1_1574219_HZ = 0x09,
|
||||
} lr1121_modem_tst_mode_lr_fhss_bw_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS coding rate for test mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_CR_V1_2_3 = 0x01,
|
||||
LR1121_MODEM_TST_MODE_LR_FHSS_CR_V1_1_3 = 0x03,
|
||||
} lr1121_modem_tst_mode_lr_fhss_cr_t;
|
||||
|
||||
/*!
|
||||
* @brief Packet header mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_TST_MODE_LORA_PACKET_HEADER_EXPLICIT = 0x00,
|
||||
LR1121_MODEM_TST_MODE_LORA_PACKET_HEADER_IMPLICIT = 0x01,
|
||||
} lr1121_modem_tst_mode_lora_packet_header_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief Modem suspend type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RESUMED = 0x00,
|
||||
LR1121_MODEM_SUSPEND = 0x01,
|
||||
} lr1121_modem_suspend_t;
|
||||
|
||||
/*!
|
||||
* @brief Modem crashlog status type
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_NO_NEW_CRASHLOG = 0x00,
|
||||
LR1121_NEW_CRASHLOG = 0x01,
|
||||
} lr1121_modem_crashlog_status_t;
|
||||
|
||||
/*!
|
||||
* @brief LR1121 modem consumption details
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t tx_last_toa_ms; //!< Last Tx time-on-air (ms)
|
||||
uint32_t rx_last_toa_ms; //!< Last Rx time-on-air (ms)
|
||||
uint32_t tx_cumulated_toa_ms; //!< Cumulated Tx time-on-air (ms)
|
||||
uint32_t rx_cumulated_toa_ms; //!< Cumulated Rx time-on-air (ms)
|
||||
uint32_t none_consumption_ms; //!< Cumulated time not in Tx nor in Rx (ms)
|
||||
uint32_t tx_consumption_ma; //!< Cumulated Tx power consumption (1/1000*uA*ms)
|
||||
uint32_t rx_consumption_ma; //!< Cumulated Rx power consumption (1/1000*uA*ms)
|
||||
uint32_t none_consumption_ma; //!< Cumulated power consumption not in Tx nor in Rx (1/1000*uA*ms)
|
||||
} lr1121_modem_consumption_details_t;
|
||||
|
||||
/*!
|
||||
* @brief LR1121 modem consumption per stack action
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
lr1121_modem_consumption_details_t
|
||||
suspend; //!< Consumptions when modem is in suspend state. These will always read 0,
|
||||
//!< even if transceiver commands where called during this state
|
||||
lr1121_modem_consumption_details_t class_b_beacon; //!< Consumptions of modem related to class B beacon
|
||||
lr1121_modem_consumption_details_t lr1mac_stack; //!< Consumption of modem corresponding to LoRaWAN stack
|
||||
lr1121_modem_consumption_details_t lbt; //!< Consumptions of modem related to Listen Before Talk
|
||||
lr1121_modem_consumption_details_t cad; //!< Consumption of modem related to Channel Activity Detection
|
||||
lr1121_modem_consumption_details_t class_b_ping_slot; //!< Consumptions of modem related to class B ping slots
|
||||
lr1121_modem_consumption_details_t test_mode; //!< Consumptions of modem related to test mode
|
||||
lr1121_modem_consumption_details_t
|
||||
direct_rp_access; //!< Consumptions when modem is in direct radio planner access state. These will always read
|
||||
//!< 0, even if transceiver commands where called during this state
|
||||
lr1121_modem_consumption_details_t relay_tx; //!< Consumption of modem related to relay Tx
|
||||
lr1121_modem_consumption_details_t class_c; //!< Consumptions of modem related to Class C
|
||||
} lr1121_modem_charge_t;
|
||||
|
||||
/*!
|
||||
* @brief LR1121 modem version structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t use_case; //!< Will always read 5 for LR1121 Modem-E
|
||||
uint8_t modem_major; //!< Major number of Modem-E
|
||||
uint8_t modem_minor; //!< Minor number of Modem-E
|
||||
uint8_t modem_patch; //!< Patch number of Modem-E
|
||||
uint8_t lbm_major; //!< Major number of built-in LoRa Basics Modem
|
||||
uint8_t lbm_minor; //!< Minor number of built-in LoRa Basics Modem
|
||||
uint8_t lbm_patch; //!< Patch number of built-in LoRa Basics Modem
|
||||
} lr1121_modem_version_t;
|
||||
|
||||
/*!
|
||||
* @brief Event type for modem operation
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_LORAWAN_EVENT_RESET = 0x00, //!< Modem has reset
|
||||
LR1121_MODEM_LORAWAN_EVENT_ALARM = 0x01, //!< Alarm time expired
|
||||
LR1121_MODEM_LORAWAN_EVENT_JOINED = 0x02, //!< Network successfully joined
|
||||
LR1121_MODEM_LORAWAN_EVENT_JOIN_FAIL = 0x03, //!< Attempt to join network failed
|
||||
LR1121_MODEM_LORAWAN_EVENT_TX_DONE = 0x04, //!< Frame transmitted
|
||||
LR1121_MODEM_LORAWAN_EVENT_DOWN_DATA = 0x05, //!< Downlink data received
|
||||
LR1121_MODEM_LORAWAN_EVENT_LINK_CHECK = 0x06, //!< Modem received a LinkADR request
|
||||
LR1121_MODEM_LORAWAN_EVENT_LORAWAN_MAC_TIME = 0x07, //!< Modem received a LinkADR request
|
||||
LR1121_MODEM_LORAWAN_EVENT_CLASS_B_PING_SLOT_INFO = 0x08, //!< Ping Slot Info answered or not by network
|
||||
LR1121_MODEM_LORAWAN_EVENT_CLASS_B_STATUS = 0x09, //!< Downlink class B is ready or not
|
||||
LR1121_MODEM_LORAWAN_EVENT_NEW_MULTICAST_SESSION_CLASS_C = 0x0A, //!< New active multicast session in class C
|
||||
LR1121_MODEM_LORAWAN_EVENT_NEW_MULTICAST_SESSION_CLASS_B = 0x0B, //!< New active multicast session in class B
|
||||
LR1121_MODEM_LORAWAN_EVENT_NO_MORE_MULTICAST_SESSION_CLASS_C = 0x0C, //!< End of multicast session in class C
|
||||
LR1121_MODEM_LORAWAN_EVENT_NO_MORE_MULTICAST_SESSION_CLASS_B = 0x0D, //!< End of multicast session in class B
|
||||
LR1121_MODEM_LORAWAN_EVENT_RELAY_TX_DYNAMIC =
|
||||
0x0E, //!< Relay Tx dynamic mode has enabled or disabled the Wake On Radio
|
||||
LR1121_MODEM_LORAWAN_EVENT_RELAY_TX_MODE = 0x0F, //!< Relay Tx activation has been updated
|
||||
LR1121_MODEM_LORAWAN_EVENT_RELAY_TX_SYNC = 0x10, //!< Relay Tx synchronization has changed
|
||||
LR1121_MODEM_LORAWAN_EVENT_ALC_SYNC_TIME = 0x11, //!< Applicative Layer Clock is synchronized
|
||||
LR1121_MODEM_LORAWAN_EVENT_FUOTA_DONE = 0x12, //!< FUOTA file download terminated
|
||||
LR1121_MODEM_LORAWAN_EVENT_TEST_MODE = 0x13, //!< Test mode event
|
||||
LR1121_MODEM_LORAWAN_EVENT_REGIONAL_DUTY_CYCLE =
|
||||
0x14, //!< Transmissions are blocked or allowed per regional duty cycle limitation
|
||||
} lr1121_modem_lorawan_event_type_t;
|
||||
|
||||
/*!
|
||||
* @brief modem event fields structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
lr1121_modem_lorawan_event_type_t event_type; //!< Event type
|
||||
uint8_t missed_events_count; //!< Counter of missed events of type @p event_type
|
||||
uint16_t data; //!< Event data
|
||||
} lr1121_modem_event_fields_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_MODEM_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
1052
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_radio.h
Executable file
1052
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_radio.h
Executable file
File diff suppressed because it is too large
Load Diff
97
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_radio_timings.h
Executable file
97
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_radio_timings.h
Executable file
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* @file lr1121_modem_radio_timings.h
|
||||
*
|
||||
* @brief LR1121 timing helper functions definition
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_RADIO_TIMINGS_H
|
||||
#define LR1121_MODEM_RADIO_TIMINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lr1121_modem_radio_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the time between the last bit sent (on Tx side) and the Rx done event (on Rx side)
|
||||
*
|
||||
* @param [in] mod_params Pointer to a structure holding the LoRa modulation parameters used for the computation
|
||||
*
|
||||
* @returns Delay in microsecond
|
||||
*/
|
||||
uint32_t lr1121_modem_radio_timings_get_delay_between_last_bit_sent_and_rx_done_in_us(
|
||||
const lr1121_modem_radio_mod_params_lora_t* mod_params );
|
||||
|
||||
/**
|
||||
* @brief Get the time between the last bit sent and the Tx done event
|
||||
*
|
||||
* @param [in] ramp_time Power amplifier ramp time
|
||||
*
|
||||
* @returns Delay in microsecond
|
||||
*/
|
||||
uint32_t lr1121_modem_radio_timings_get_delay_between_last_bit_sent_and_tx_done_in_us(
|
||||
const lr1121_modem_radio_ramp_time_t ramp_time );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_RADIO_TIMINGS_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
653
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_radio_types.h
Executable file
653
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_radio_types.h
Executable file
@@ -0,0 +1,653 @@
|
||||
/*!
|
||||
* @file lr1121_modem_radio_types.h
|
||||
*
|
||||
* @brief Radio driver types for LR1121
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_RADIO_TYPES_H
|
||||
#define LR1121_MODEM_RADIO_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Bit mask to set to indicate a LR-FHSS bitrate is defined in steps of 1/256 bit per seconds
|
||||
*/
|
||||
#define LR1121_MODEM_RADIO_LR_FHSS_BITRATE_DIVIDE_BY_256 ( 0x80000000 )
|
||||
|
||||
/*!
|
||||
* @brief LR-FHSS bitrate value at 488.28125 bps defined as steps of 1/256 bitrate per seconds
|
||||
*/
|
||||
#define LR1121_MODEM_RADIO_LR_FHSS_BITRATE_IN_256_BPS_STEPS ( 125000 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Power Amplifier Selection values
|
||||
*
|
||||
* - Low-power Power Amplifier can reach up to 14dBm
|
||||
* - High-power Power Amplifier can reach up to 22 dBm
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_PA_SEL_LP = 0x00, //!< Low-power Power Amplifier
|
||||
LR1121_MODEM_RADIO_PA_SEL_HP = 0x01, //!< High-power Power Amplifier
|
||||
LR1121_MODEM_RADIO_PA_SEL_HF = 0x02, //!< High-frequency Power Amplifier
|
||||
} lr1121_modem_radio_pa_selection_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Address Filtering configurations
|
||||
*
|
||||
* If Address Filtering is enabled but a wrong address is received, therefore the reception is aborted and the address
|
||||
* error flag of packet status is set.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_GFSK_ADDRESS_FILTERING_DISABLE = 0x00, //!< Filter deactivated
|
||||
LR1121_MODEM_RADIO_GFSK_ADDRESS_FILTERING_NODE_ADDRESS = 0x01, //!< Filter on Node Address
|
||||
LR1121_MODEM_RADIO_GFSK_ADDRESS_FILTERING_NODE_AND_BROADCAST_ADDRESSES =
|
||||
0x02, //!< Filtering on Node and Broadcast addresses
|
||||
} lr1121_modem_radio_gfsk_address_filtering_t;
|
||||
|
||||
/*!
|
||||
* @brief Chip mode after successfull transmission or reception
|
||||
*
|
||||
* Unused for RX duty cycle and AutoTxRx operations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_FALLBACK_STDBY_RC = 0x01, //!< Standby RC (Default)
|
||||
LR1121_MODEM_RADIO_FALLBACK_STDBY_XOSC = 0x02, //!< Standby XOSC
|
||||
LR1121_MODEM_RADIO_FALLBACK_FS = 0x03 //!< FS
|
||||
} lr1121_modem_radio_fallback_modes_t;
|
||||
|
||||
/*!
|
||||
* @brief Ramping time for PA
|
||||
*
|
||||
* This parameter is the ramping time of the PA. A high value improves spectral quality.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_RAMP_16_US = 0x00, //!< 16 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_32_US = 0x01, //!< 32 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_48_US = 0x02, //!< 48 us Ramp Time (Default)
|
||||
LR1121_MODEM_RADIO_RAMP_64_US = 0x03, //!< 64 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_80_US = 0x04, //!< 80 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_96_US = 0x05, //!< 96 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_112_US = 0x06, //!< 112 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_128_US = 0x07, //!< 128 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_144_US = 0x08, //!< 144 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_160_US = 0x09, //!< 160 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_176_US = 0x0A, //!< 176 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_192_US = 0x0B, //!< 192 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_208_US = 0x0C, //!< 208 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_240_US = 0x0D, //!< 240 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_272_US = 0x0E, //!< 272 us Ramp Time
|
||||
LR1121_MODEM_RADIO_RAMP_304_US = 0x0F, //!< 304 us Ramp Time
|
||||
} lr1121_modem_radio_ramp_time_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa network type configuration
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LORA_NETWORK_PRIVATE = 0x00, //!< LoRa private network
|
||||
LR1121_MODEM_RADIO_LORA_NETWORK_PUBLIC = 0x01, //!< LoRa public network
|
||||
} lr1121_modem_radio_lora_network_type_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Spreading Factor configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LORA_SF5 = 0x05, //!< Spreading Factor 5
|
||||
LR1121_MODEM_RADIO_LORA_SF6 = 0x06, //!< Spreading Factor 6
|
||||
LR1121_MODEM_RADIO_LORA_SF7 = 0x07, //!< Spreading Factor 7
|
||||
LR1121_MODEM_RADIO_LORA_SF8 = 0x08, //!< Spreading Factor 8
|
||||
LR1121_MODEM_RADIO_LORA_SF9 = 0x09, //!< Spreading Factor 9
|
||||
LR1121_MODEM_RADIO_LORA_SF10 = 0x0A, //!< Spreading Factor 10
|
||||
LR1121_MODEM_RADIO_LORA_SF11 = 0x0B, //!< Spreading Factor 11
|
||||
LR1121_MODEM_RADIO_LORA_SF12 = 0x0C, //!< Spreading Factor 12
|
||||
} lr1121_modem_radio_lora_sf_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Bandwidth configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LORA_BW_10 = 0x08, //!< Bandwidth 10.42 kHz
|
||||
LR1121_MODEM_RADIO_LORA_BW_15 = 0x01, //!< Bandwidth 15.63 kHz
|
||||
LR1121_MODEM_RADIO_LORA_BW_20 = 0x09, //!< Bandwidth 20.83 kHz
|
||||
LR1121_MODEM_RADIO_LORA_BW_31 = 0x02, //!< Bandwidth 31.25 kHz
|
||||
LR1121_MODEM_RADIO_LORA_BW_41 = 0x0A, //!< Bandwidth 41.67 kHz
|
||||
LR1121_MODEM_RADIO_LORA_BW_62 = 0x03, //!< Bandwidth 62.50 kHz
|
||||
LR1121_MODEM_RADIO_LORA_BW_125 = 0x04, //!< Bandwidth 125.00 kHz
|
||||
LR1121_MODEM_RADIO_LORA_BW_250 = 0x05, //!< Bandwidth 250.00 kHz
|
||||
LR1121_MODEM_RADIO_LORA_BW_500 = 0x06, //!< Bandwidth 500.00 kHz
|
||||
LR1121_MODEM_RADIO_LORA_BW_200 = 0x0D, //!< Bandwidth 203.00 kHz, 2G4 and compatible with LR112x chips only
|
||||
LR1121_MODEM_RADIO_LORA_BW_400 = 0x0E, //!< Bandwidth 406.00 kHz, 2G4 and compatible with LR112x chips only
|
||||
LR1121_MODEM_RADIO_LORA_BW_800 = 0x0F, //!< Bandwidth 812.00 kHz, 2G4 and compatible with LR112x chips only
|
||||
} lr1121_modem_radio_lora_bw_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Coding Rate configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LORA_NO_CR = 0x00, //!< No Coding Rate
|
||||
LR1121_MODEM_RADIO_LORA_CR_4_5 = 0x01, //!< Coding Rate 4/5 Short Interleaver
|
||||
LR1121_MODEM_RADIO_LORA_CR_4_6 = 0x02, //!< Coding Rate 4/6 Short Interleaver
|
||||
LR1121_MODEM_RADIO_LORA_CR_4_7 = 0x03, //!< Coding Rate 4/7 Short Interleaver
|
||||
LR1121_MODEM_RADIO_LORA_CR_4_8 = 0x04, //!< Coding Rate 4/8 Short Interleaver
|
||||
LR1121_MODEM_RADIO_LORA_CR_LI_4_5 = 0x05, //!< Coding Rate 4/5 Long Interleaver
|
||||
LR1121_MODEM_RADIO_LORA_CR_LI_4_6 = 0x06, //!< Coding Rate 4/6 Long Interleaver
|
||||
LR1121_MODEM_RADIO_LORA_CR_LI_4_8 = 0x07, //!< Coding Rate 4/8 Long Interleaver
|
||||
} lr1121_modem_radio_lora_cr_t;
|
||||
|
||||
/*!
|
||||
* @brief Values for intermediary mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_MODE_SLEEP = 0x00, //!< Sleep
|
||||
LR1121_MODEM_RADIO_MODE_STANDBY_RC = 0x01, //!< Standby RC
|
||||
LR1121_MODEM_RADIO_MODE_STANDBY_XOSC = 0x02, //!< Standby XOSC
|
||||
LR1121_MODEM_RADIO_MODE_FS = 0x03 //!< Frequency Synthesis
|
||||
} lr1121_modem_radio_intermediary_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Cyclic Redundancy Check configurations
|
||||
*
|
||||
* If this value is set to something other than CRC_OFF, a CRC is automatically computed and added after the end of the
|
||||
* payload on transmitter side. On receiver side, the CRC check is automatically processed.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_GFSK_CRC_OFF = 0x01, //!< CRC check deactivated
|
||||
LR1121_MODEM_RADIO_GFSK_CRC_1_BYTE = 0x00,
|
||||
LR1121_MODEM_RADIO_GFSK_CRC_2_BYTES = 0x02,
|
||||
LR1121_MODEM_RADIO_GFSK_CRC_1_BYTE_INV = 0x04,
|
||||
LR1121_MODEM_RADIO_GFSK_CRC_2_BYTES_INV = 0x06,
|
||||
} lr1121_modem_radio_gfsk_crc_type_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK data whitening configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_GFSK_DC_FREE_OFF = 0x00, //!< Whitening deactivated
|
||||
LR1121_MODEM_RADIO_GFSK_DC_FREE_WHITENING = 0x01, //!< Whitening enabled
|
||||
LR1121_MODEM_RADIO_GFSK_DC_FREE_WHITENING_SX128X_COMP = 0x03, //!< Whitening enabled - SX128x compatibility
|
||||
} lr1121_modem_radio_gfsk_dc_free_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Header Type configurations
|
||||
*
|
||||
* This parameter indicates whether or not the payload length is sent and read over the air.
|
||||
*
|
||||
* If the payload length is known beforehand by both transmitter and receiver, therefore there is no need to send it
|
||||
* over the air. Otherwise, setting this parameter to LR1121_MODEM_RADIO_GFSK_PKT_VAR_LEN will make the modem to
|
||||
* automatically prepand a byte containing the payload length to the the payload on transmitter side. On receiver side,
|
||||
* this first byte is read to set the payload length to read.
|
||||
*
|
||||
* This configuration is only available for GFSK packet types.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_GFSK_PKT_FIX_LEN = 0x00, //!< Payload length is not sent/read over the air
|
||||
LR1121_MODEM_RADIO_GFSK_PKT_VAR_LEN = 0x01, //!< Payload length is sent/read over the air
|
||||
LR1121_MODEM_RADIO_GFSK_PKT_VAR_LEN_SX128X_COMP =
|
||||
0x02, //!< Payload length is sent/read over the air - SX128x compatibility
|
||||
} lr1121_modem_radio_gfsk_pkt_len_modes_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Preamble Detector Length configurations
|
||||
*
|
||||
* This parameter sets the minimum length of preamble bits to be received to continue reception of incoming packet. If a
|
||||
* packet with preamble length lower than this value is being received, the reception stops without generating IRQ.
|
||||
*
|
||||
* This parameter has no impact on TX operations.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_GFSK_PREAMBLE_DETECTOR_OFF = 0x00,
|
||||
LR1121_MODEM_RADIO_GFSK_PREAMBLE_DETECTOR_MIN_8BITS = 0x04,
|
||||
LR1121_MODEM_RADIO_GFSK_PREAMBLE_DETECTOR_MIN_16BITS = 0x05,
|
||||
LR1121_MODEM_RADIO_GFSK_PREAMBLE_DETECTOR_MIN_24BITS = 0x06,
|
||||
LR1121_MODEM_RADIO_GFSK_PREAMBLE_DETECTOR_MIN_32BITS = 0x07
|
||||
} lr1121_modem_radio_gfsk_preamble_detector_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Cyclic Redundancy Check configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LORA_CRC_OFF = 0x00, //!< CRC deactivated
|
||||
LR1121_MODEM_RADIO_LORA_CRC_ON = 0x01, //!< CRC activated
|
||||
} lr1121_modem_radio_lora_crc_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Header type configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LORA_PKT_EXPLICIT = 0x00, //!< Explicit header: transmitted over the air
|
||||
LR1121_MODEM_RADIO_LORA_PKT_IMPLICIT = 0x01, //!< Implicit header: not transmitted over the air
|
||||
} lr1121_modem_radio_lora_pkt_len_modes_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa IQ mode configurations
|
||||
*
|
||||
* LoRa IQ modes are mutually exclusives: a physical packet sent with standard IQ will not be received by a receiver
|
||||
* configured with inverted IQ.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LORA_IQ_STANDARD = 0x00, //!< IQ standard
|
||||
LR1121_MODEM_RADIO_LORA_IQ_INVERTED = 0x01, //!< IQ inverted
|
||||
} lr1121_modem_radio_lora_iq_t;
|
||||
|
||||
/*!
|
||||
* @brief Packet type values
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_PKT_NONE = 0x00, //!< State after cold start
|
||||
LR1121_MODEM_RADIO_PKT_TYPE_GFSK = 0x01, //!< GFSK modulation
|
||||
LR1121_MODEM_RADIO_PKT_TYPE_LORA = 0x02, //!< LoRa modulation
|
||||
LR1121_MODEM_RADIO_PKT_TYPE_BPSK = 0x03, //!< BPSK modulation
|
||||
LR1121_MODEM_RADIO_PKT_TYPE_LR_FHSS = 0x04, //!< LR-FHSS modulation
|
||||
} lr1121_modem_radio_pkt_type_t;
|
||||
|
||||
/*!
|
||||
* @brief Select power amplifier supply source
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_PA_REG_SUPPLY_VREG = 0x00, //!< Power amplifier supplied by the main regulator
|
||||
LR1121_MODEM_RADIO_PA_REG_SUPPLY_VBAT = 0x01 //!< Power amplifier supplied by the battery
|
||||
} lr1121_modem_radio_pa_reg_supply_t;
|
||||
|
||||
/*!
|
||||
* @brief RX Duty Cycle Modes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_RX_DUTY_CYCLE_MODE_RX = 0x00, //!< LoRa/GFSK: Uses Rx for listening to packets
|
||||
LR1121_MODEM_RADIO_RX_DUTY_CYCLE_MODE_CAD = 0x01, //!< Only in LoRa: Uses CAD to listen for over-the-air activity
|
||||
} lr1121_modem_radio_rx_duty_cycle_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Bandwidth configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_GFSK_BW_4800 = 0x1F, //!< Bandwidth 4.8 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_5800 = 0x17, //!< Bandwidth 5.8 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_7300 = 0x0F, //!< Bandwidth 7.3 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_9700 = 0x1E, //!< Bandwidth 9.7 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_11700 = 0x16, //!< Bandwidth 11.7 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_14600 = 0x0E, //!< Bandwidth 14.6 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_19500 = 0x1D, //!< Bandwidth 19.5 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_23400 = 0x15, //!< Bandwidth 23.4 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_29300 = 0x0D, //!< Bandwidth 29.3 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_39000 = 0x1C, //!< Bandwidth 39.0 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_46900 = 0x14, //!< Bandwidth 46.9 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_58600 = 0x0C, //!< Bandwidth 58.6 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_78200 = 0x1B, //!< Bandwidth 78.2 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_93800 = 0x13, //!< Bandwidth 93.8 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_117300 = 0x0B, //!< Bandwidth 117.3 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_156200 = 0x1A, //!< Bandwidth 156.2 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_187200 = 0x12, //!< Bandwidth 187.2 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_234300 = 0x0A, //!< Bandwidth 232.3 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_312000 = 0x19, //!< Bandwidth 312.0 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_373600 = 0x11, //!< Bandwidth 373.6 kHz DSB
|
||||
LR1121_MODEM_RADIO_GFSK_BW_467000 = 0x09 //!< Bandwidth 467.0 kHz DSB
|
||||
} lr1121_modem_radio_gfsk_bw_t;
|
||||
|
||||
/*!
|
||||
* @brief Possible automatic actions when Channel Activity Detection operations terminate
|
||||
*
|
||||
* For RADIO_EXIT_MODE_CAD_RX, LR1121 enters RX mode on activity detected. The timeout value for this RX operation is
|
||||
* defined as:
|
||||
*
|
||||
* \f$ 31.25us \times timeout \f$
|
||||
*
|
||||
* With \f$ timeout \f$ defined in RadioCadParams_t::timeout
|
||||
*
|
||||
* If the CAD operation is negative with RADIO_CAD_EXIT_MODE_RX or if CAD operation is positive with
|
||||
* RADIO_CAD_EXIT_MODE_TX, therefore the LR1121 enters Standby RC mode.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_CAD_EXIT_MODE_STANDBYRC = 0x00, //!< Enter standby RC mode after CAD operation
|
||||
LR1121_MODEM_RADIO_CAD_EXIT_MODE_RX = 0x01, //!< Enter in RX mode if an activity is detected
|
||||
LR1121_MODEM_RADIO_CAD_EXIT_MODE_TX = 0x10, //!< Enter in TX mode if no activity is detected
|
||||
} lr1121_modem_radio_cad_exit_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief Pulse shape configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_GFSK_PULSE_SHAPE_OFF = 0x00, //!< No filter applied
|
||||
LR1121_MODEM_RADIO_GFSK_PULSE_SHAPE_BT_03 = 0x08, //!< Gaussian BT 0.3
|
||||
LR1121_MODEM_RADIO_GFSK_PULSE_SHAPE_BT_05 = 0x09, //!< Gaussian BT 0.5
|
||||
LR1121_MODEM_RADIO_GFSK_PULSE_SHAPE_BT_07 = 0x0A, //!< Gaussian BT 0.7
|
||||
LR1121_MODEM_RADIO_GFSK_PULSE_SHAPE_BT_1 = 0x0B //!< Gaussian BT 1.0
|
||||
} lr1121_modem_radio_gfsk_pulse_shape_t;
|
||||
|
||||
/*!
|
||||
* @brief BPSK pulse shape configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_DBPSK_PULSE_SHAPE = 0x16, //!< Double OSR / RRC / BT 0.7
|
||||
} lr1121_modem_radio_bpsk_pulse_shape_t;
|
||||
|
||||
/*!
|
||||
* @brief LR-FHSS bitrate configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LR_FHSS_BITRATE_488_BPS =
|
||||
( int ) ( LR1121_MODEM_RADIO_LR_FHSS_BITRATE_DIVIDE_BY_256 +
|
||||
LR1121_MODEM_RADIO_LR_FHSS_BITRATE_IN_256_BPS_STEPS ), //!< 488.28215 bps
|
||||
} lr1121_modem_radio_lr_fhss_bitrate_t;
|
||||
|
||||
/*!
|
||||
* @brief LR-FHSS pulse shape configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LR_FHSS_PULSE_SHAPE_BT_1 = 0x0B //!< Gaussian BT 1.0
|
||||
} lr1121_modem_radio_lr_fhss_pulse_shape_t;
|
||||
|
||||
/*!
|
||||
* @brief Channel Activity Detection parameters
|
||||
*
|
||||
* Parameters detPeak and detMin are to be used for tuning the sensitivity of Channel Activity Detection. It depends on
|
||||
* Spreading Factor, Bandwidth and symbolNum.
|
||||
*
|
||||
* For detPeak, the 5 MSBits are encoding the integer part, the 3 LSBits are encoding 1/8 of the decimal part. For
|
||||
* instance, \f$detPeak = 50\f$ (= 0x32) leads to a ratio being \f$6 + 2 * 1/8 = 6.25\f$.
|
||||
*
|
||||
* detMin is unit free and represents the ratio between the minimal power of a correlation peak and measurement gain
|
||||
* that can be considered as a peak detection. It helps to avoid detection on noise. Authorized values a from 0 to 181.
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_cad_params_s
|
||||
{
|
||||
uint8_t cad_symb_nb; //!< Number of symbols used for CAD detection
|
||||
uint8_t cad_detect_peak; //!< Ratio for CAD between correlator peak and average
|
||||
//!< (Default 0x32)
|
||||
uint8_t cad_detect_min; //!< Minimum power of the correlation peak to be
|
||||
//!< considered as a positive CAD (Default 0x0A)
|
||||
lr1121_modem_radio_cad_exit_mode_t cad_exit_mode; //!< Automated action on CAD completion
|
||||
uint32_t cad_timeout; //!< Value used to compute timeout
|
||||
} lr1121_modem_radio_cad_params_t;
|
||||
|
||||
/*!
|
||||
* @brief Status of GFSK received packet
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_pkt_status_gfsk_s
|
||||
{
|
||||
int8_t rssi_sync_in_dbm; //!< RSSI value latched on detection of the last received packet Sync Address
|
||||
int8_t rssi_avg_in_dbm; //!< RSSI averaged over the payload of the last received packet
|
||||
uint8_t rx_len_in_bytes; //!< Length of the last received packet [Bytes]
|
||||
bool is_addr_err; //!< Address filtering status. Asserted if received packet address does not match node address
|
||||
//!< nor broadcast address
|
||||
bool is_crc_err; //!< CRC status of the current packet (applicable only in RX, with CRC enabled)
|
||||
bool is_len_err; //!< Asserted when the length of last received packet is greater than the maximal length
|
||||
//!< (applicable only in RX with variable length packet)
|
||||
bool is_abort_err; //!< Asserted when the current packet has been aborted (applicable in RX and TX)
|
||||
bool is_received; //!< Asserted when packet reception is done (applicable in RX)
|
||||
bool is_sent; //!< Asserted when packet transmission is done (applicable in TX)
|
||||
} lr1121_modem_radio_pkt_status_gfsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Status of received packet
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_pkt_status_lora_s
|
||||
{
|
||||
int8_t rssi_pkt_in_dbm; //!< Average RSSI over last received packet.
|
||||
int8_t snr_pkt_in_db; //!< SNR estimated on last received packet.
|
||||
int8_t signal_rssi_pkt_in_dbm; //!< RSSI of last packet latched after
|
||||
} lr1121_modem_radio_pkt_status_lora_t;
|
||||
|
||||
/*!
|
||||
* @brief Length and offset of received packet
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_rx_buffer_status_s
|
||||
{
|
||||
uint8_t pld_len_in_bytes; //!< Length of received packet [Bytes]
|
||||
uint8_t buffer_start_pointer; //!< Offset in the reception buffer of
|
||||
//!< first byte received [Bytes]
|
||||
} lr1121_modem_radio_rx_buffer_status_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK packet statistic structure
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_stats_gfsk_s
|
||||
{
|
||||
uint16_t nb_pkt_received; //!< Total number of received packets
|
||||
uint16_t nb_pkt_crc_error; //!< Total number of received packets with CRC error
|
||||
uint16_t nb_pkt_len_error; //!< Total number of received packets with a length error
|
||||
} lr1121_modem_radio_stats_gfsk_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa packet statistic structure
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_stats_lora_s
|
||||
{
|
||||
uint16_t nb_pkt_received; //!< Total number of received packets
|
||||
uint16_t nb_pkt_crc_error; //!< Total number of received packets with CRC error
|
||||
uint16_t nb_pkt_header_error; //!< Total number of packets with header error
|
||||
uint16_t nb_pkt_falsesync; //!< Total number of false sync
|
||||
} lr1121_modem_radio_stats_lora_t;
|
||||
|
||||
/*!
|
||||
* @brief Modulation configuration for GFSK packet
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_mod_params_gfsk_s
|
||||
{
|
||||
uint32_t br_in_bps; //!< GFSK bitrate [bit/s]
|
||||
lr1121_modem_radio_gfsk_pulse_shape_t pulse_shape; //!< GFSK pulse shape
|
||||
lr1121_modem_radio_gfsk_bw_t bw_dsb_param; //!< GFSK bandwidth
|
||||
uint32_t fdev_in_hz; //!< GFSK frequency deviation [Hz]
|
||||
} lr1121_modem_radio_mod_params_gfsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Modulation configuration for BPSK packet
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_mod_params_bpsk_s
|
||||
{
|
||||
uint32_t br_in_bps; //!< BPSK bitrate [bit/s]
|
||||
lr1121_modem_radio_bpsk_pulse_shape_t pulse_shape; //!< BPSK pulse shape
|
||||
} lr1121_modem_radio_mod_params_bpsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Modulation configuration for LoRa packet
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_mod_params_lora_s
|
||||
{
|
||||
lr1121_modem_radio_lora_sf_t sf; //!< LoRa spreading factor
|
||||
lr1121_modem_radio_lora_bw_t bw; //!< LoRa bandwidth
|
||||
lr1121_modem_radio_lora_cr_t cr; //!< LoRa coding rate
|
||||
uint8_t ldro; //!< LoRa LDRO
|
||||
} lr1121_modem_radio_mod_params_lora_t;
|
||||
|
||||
/*!
|
||||
* @brief Modulation configuration for LR-FHSS packets
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_mod_params_lr_fhss_s
|
||||
{
|
||||
lr1121_modem_radio_lr_fhss_bitrate_t br_in_bps; //!< LR-FHSS bitrate
|
||||
lr1121_modem_radio_lr_fhss_pulse_shape_t pulse_shape; //!< LR-FHSS pulse shape
|
||||
} lr1121_modem_radio_mod_params_lr_fhss_t;
|
||||
|
||||
/*!
|
||||
* @brief Packet parameter configuration for GFSK packets
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_pkt_params_gfsk_s
|
||||
{
|
||||
uint16_t preamble_len_in_bits; //!< GFSK Preamble length [bits]
|
||||
lr1121_modem_radio_gfsk_preamble_detector_t preamble_detector; //!< GFSK Preamble detection configuration
|
||||
uint8_t sync_word_len_in_bits; //!< GFSK Syncword length [bits]
|
||||
lr1121_modem_radio_gfsk_address_filtering_t address_filtering; //!< GFSK Address filtering/comparison configuration
|
||||
lr1121_modem_radio_gfsk_pkt_len_modes_t header_type; //!< GFSK Header type configuration
|
||||
uint8_t pld_len_in_bytes; //!< GFSK Payload length [bytes]
|
||||
lr1121_modem_radio_gfsk_crc_type_t crc_type; //!< GFSK CRC configuration
|
||||
lr1121_modem_radio_gfsk_dc_free_t dc_free; //!< GFSK Whitening configuration
|
||||
} lr1121_modem_radio_pkt_params_gfsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Packet parameter configuration for BPSK packets
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_pkt_params_bpsk_s
|
||||
{
|
||||
uint8_t pld_len_in_bytes; //!< Payload length [bytes]
|
||||
uint16_t ramp_up_delay; //!< Delay to fine tune ramp-up time, if non-zero
|
||||
uint16_t ramp_down_delay; //!< Delay to fine tune ramp-down time, if non-zero
|
||||
uint16_t pld_len_in_bits; //!< If non-zero, used to ramp down PA before end of a payload with length that is not a
|
||||
//!< multiple of 8. pld_len_in_bits <= pld_len_in_bytes * 8
|
||||
} lr1121_modem_radio_pkt_params_bpsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Packet parameter configuration for LoRa packets
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_pkt_params_lora_s
|
||||
{
|
||||
uint16_t preamble_len_in_symb; //!< LoRa Preamble length [symbols]
|
||||
lr1121_modem_radio_lora_pkt_len_modes_t header_type; //!< LoRa Header type configuration
|
||||
uint8_t pld_len_in_bytes; //!< LoRa Payload length [bytes]
|
||||
lr1121_modem_radio_lora_crc_t crc; //!< LoRa CRC configuration
|
||||
lr1121_modem_radio_lora_iq_t iq; //!< LoRa IQ configuration
|
||||
} lr1121_modem_radio_pkt_params_lora_t;
|
||||
|
||||
/*!
|
||||
* @brief Configuration of Power Amplifier
|
||||
*
|
||||
* @p pa_duty_cycle controls the duty cycle of Power Amplifier according to:
|
||||
* \f$ dutycycle = 0.2 + 0.04 \times pa\_duty\_cycle \f$
|
||||
* It can be used to adapt the TX multi-band operation using a single-matching network.
|
||||
*
|
||||
* The allowed duty cycle values for LPA are from 0.2 to 0.48 (by step of 0.04). Therefore possible values for
|
||||
* pa_duty_cycle go from 0 to 7.
|
||||
*
|
||||
* The allowed duty cycle values for HPA go from 0.2 to 0.36 (by step of 0.04). Therefore in this case, the possible
|
||||
* values for pa_duty_cycle go from 0 to 4.
|
||||
*
|
||||
* @p pa_hp_sel controls the number of slices for HPA according to: \f$ \#slices = pa\_hp\_sel + 1 \f$
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_pa_cfg_s
|
||||
{
|
||||
lr1121_modem_radio_pa_selection_t pa_sel; //!< Power Amplifier selection
|
||||
lr1121_modem_radio_pa_reg_supply_t pa_reg_supply; //!< Power Amplifier regulator supply source
|
||||
uint8_t pa_duty_cycle; //!< Power Amplifier duty cycle (Default 0x04)
|
||||
uint8_t pa_hp_sel; //!< Number of slices for HPA (Default 0x07)
|
||||
} lr1121_modem_radio_pa_cfg_t;
|
||||
|
||||
/*!
|
||||
* @brief RSSI calibration table
|
||||
*/
|
||||
typedef struct lr1121_modem_radio_rssi_calibration_table_s
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t g4;
|
||||
uint8_t g5;
|
||||
uint8_t g6;
|
||||
uint8_t g7;
|
||||
uint8_t g8;
|
||||
uint8_t g9;
|
||||
uint8_t g10;
|
||||
uint8_t g11;
|
||||
uint8_t g12;
|
||||
uint8_t g13;
|
||||
uint8_t g13hp1;
|
||||
uint8_t g13hp2;
|
||||
uint8_t g13hp3;
|
||||
uint8_t g13hp4;
|
||||
uint8_t g13hp5;
|
||||
uint8_t g13hp6;
|
||||
uint8_t g13hp7;
|
||||
} gain_tune; //!< Used to set gain tune value for RSSI calibration
|
||||
|
||||
int16_t gain_offset; //!< Used to set gain offset value for RSSI calibration
|
||||
} lr1121_modem_radio_rssi_calibration_table_t;
|
||||
|
||||
/*!
|
||||
* @brief Values to use to setup LNA LF0 configuration
|
||||
*
|
||||
* LNA can be configured in either of the 3 modes: Single N, Single P or differential (which is default)
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RADIO_LNA_MODE_SINGLE_RFI_N_LF0 = 1, //!< Use only RFI_N_LF0 antenna
|
||||
LR1121_MODEM_RADIO_LNA_MODE_SINGLE_RFI_P_LF0 = 2, //!< Use only RFI_P_LF0 antenna
|
||||
LR1121_MODEM_RADIO_LNA_MODE_DIFFERENTIAL_LF0 = 3 //!< Configure LNA LF0 in differential mode (default)
|
||||
} lr1121_modem_radio_lna_mode_t;
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_RADIO_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
209
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_regmem.h
Executable file
209
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_regmem.h
Executable file
@@ -0,0 +1,209 @@
|
||||
/*!
|
||||
* @file lr1121_modem_regmem.h
|
||||
*
|
||||
* @brief Register/memory driver definition for LR1121
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_REGMEM_H
|
||||
#define LR1121_MODEM_REGMEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lr1121_modem_common.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Maximum number of words that can be written to / read from a LR1121 chip with regmem32 commands
|
||||
*/
|
||||
#define LR1121_MODEM_REGMEM_MAX_WRITE_READ_WORDS 64
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Write up to 64 words into register memory space of LR1121.
|
||||
*
|
||||
* A word is 32-bit long. The writing operations write contiguously in register memory, starting at the address
|
||||
* provided.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to start writing operation
|
||||
* @param [in] buffer The buffer of words to write into memory. Its size must be enough to contain length words.
|
||||
* @param [in] length Number of words to write into memory
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_regmem_read_regmem32
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_regmem_write_regmem32( const void* context, const uint32_t address,
|
||||
const uint32_t* buffer, const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read up to 64 words into register memory space of LR1121.
|
||||
*
|
||||
* A word is 32-bit long. The reading operations read contiguously from register memory, starting at the address
|
||||
* provided.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to start reading operation
|
||||
* @param [in] length Number of words to read from memory
|
||||
* @param [out] buffer Pointer to a words array to be filled with content from memory. Its size must be enough to
|
||||
* contain at least length words.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_regmem_write_regmem32
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_regmem_read_regmem32( const void* context, const uint32_t address,
|
||||
uint32_t* buffer, const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Write bytes into register memory space of LR1121.
|
||||
*
|
||||
* A byte is 8-bit long. The writing operations write contiguously in register memory, starting at the address provided.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to start writing operation
|
||||
* @param [in] buffer The buffer of bytes to write into memory. Its size must be enough to contain length bytes
|
||||
* @param [in] length Number of bytes to write into memory
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_regmem_read_mem8
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_regmem_write_mem8( const void* context, const uint32_t address,
|
||||
const uint8_t* buffer, const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read bytes into register memory space of LR1121.
|
||||
*
|
||||
* A byte is 8-bit long. The reading operations read contiguously from register memory, starting at the address
|
||||
* provided.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to start reading operation
|
||||
* @param [in] length Number of bytes to read from memory
|
||||
* @param [in] buffer Pointer to a byte array to be filled with content from memory. Its size must be enough to contain
|
||||
* at least length bytes
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_regmem_write_mem8
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_regmem_read_mem8( const void* context, const uint32_t address,
|
||||
uint8_t* buffer, const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Write bytes into radio TX buffer memory space of LR1121.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] buffer The buffer of bytes to write into radio buffer. Its size must be enough to contain length bytes
|
||||
* @param [in] length Number of bytes to write into radio buffer
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_regmem_read_buffer8
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_regmem_write_buffer8( const void* context, const uint8_t* buffer,
|
||||
const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read bytes from radio RX buffer memory space of LR1121.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] buffer Pointer to a byte array to be filled with content from radio buffer. Its size must be enough to
|
||||
* contain at least length bytes
|
||||
* @param [in] offset Memory offset to start reading
|
||||
* @param [in] length Number of bytes to read from radio buffer
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_regmem_write_buffer8
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_regmem_read_buffer8( const void* context, uint8_t* buffer,
|
||||
const uint8_t offset, const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Clear radio RX buffer
|
||||
*
|
||||
* Set to 0x00 all content of the radio RX buffer
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_regmem_clear_rxbuffer( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Read-modify-write data at given register/memory address
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to be modified
|
||||
* @param [in] mask The mask to be applied on read data
|
||||
* @param [in] data The data to be written
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_regmem_write_regmem32_mask( const void* context, const uint32_t address,
|
||||
const uint32_t mask, const uint32_t data );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_REGMEM_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
99
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_relay.h
Executable file
99
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_relay.h
Executable file
@@ -0,0 +1,99 @@
|
||||
/*!
|
||||
* @file lr1121_modem_relay.h
|
||||
*
|
||||
* @brief Relay driver for LR1121 modem
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_RELAY_H
|
||||
#define LR1121_MODEM_RELAY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "lr1121_modem_common.h"
|
||||
#include "lr1121_modem_relay_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Get the Tx relay configuration
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] configuration Tx relay configuration
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_relay_get_tx_config( const void* context,
|
||||
lr1121_modem_relay_tx_configuration_t* configuration );
|
||||
|
||||
/*!
|
||||
* @brief Set the Tx relay configuration
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] configuration Tx relay configuration to set
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_relay_set_tx_config(
|
||||
const void* context, const lr1121_modem_relay_tx_configuration_t* configuration );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_RELAY_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
127
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_relay_types.h
Executable file
127
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_relay_types.h
Executable file
@@ -0,0 +1,127 @@
|
||||
/*!
|
||||
* @file lr1121_modem_relay_types.h
|
||||
*
|
||||
* @brief Relay driver types for LR1121 modem
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_RELAY_TYPES_H
|
||||
#define LR1121_MODEM_RELAY_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Relay activation
|
||||
*
|
||||
* Refer to LoRaWAN Relay specification document for details.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RELAY_ACTIVATION_DISABLE = 0x00, //!< The relay is disabled
|
||||
LR1121_MODEM_RELAY_ACTIVATION_ENABLE =
|
||||
0x01, //!< The relay is enabled, even if no WOR ack nor downlink on RxR is received
|
||||
LR1121_MODEM_RELAY_ACTIVATION_DYNAMIC =
|
||||
0x02, //!< The device automatically enable the relay if no downlink is received after several uplinks
|
||||
LR1121_MODEM_RELAY_ACTIVATION_DEVICE_CONTROLLED = 0x03, //!< The device automatically enable or disable the relay
|
||||
} lr1121_modem_relay_activation_t;
|
||||
|
||||
/**
|
||||
* @brief Smart level configuration
|
||||
*
|
||||
* Refer to LoRaWAN Relay specification document for details.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_RELAY_SMART_LEVEL_8 =
|
||||
0x00, //!< The relay shall be enabled if no valid downlink is received during 8 consecutive uplinks
|
||||
LR1121_MODEM_RELAY_SMART_LEVEL_16 =
|
||||
0x01, //!< The relay shall be enabled if no valid downlink is received during 16 consecutive uplinks
|
||||
LR1121_MODEM_RELAY_SMART_LEVEL_32 =
|
||||
0x02, //!< The relay shall be enabled if no valid downlink is received during 32 consecutive uplinks
|
||||
LR1121_MODEM_RELAY_SMART_LEVEL_64 =
|
||||
0x03, //!< The relay shall be enabled if no valid downlink is received during 64 consecutive uplinks
|
||||
} lr1121_modem_relay_smart_level_t;
|
||||
|
||||
/**
|
||||
* @brief Configuration of relay Tx
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t wor_second_channel_frequency_hz; //!< Frequency of the second Wake On Radio channel (Hz)
|
||||
uint32_t
|
||||
wor_ack_second_channel_frequency_hz; //!< Frequency of the second Wake On Radio acknowledgment channel (Hz)
|
||||
uint8_t wor_second_channel_datarate; //!< Datarate of the second Wake On Radio chanel
|
||||
uint8_t wor_second_channel_enable; //!< Wake On Radio second channel enable
|
||||
uint8_t backoff_behavior; //!< Indicate number of missed ACK tolerated before sending the LoRaWAN uplink. Possible
|
||||
//!< values in [0:63] (0 means the LoRaWAN uplink is always sent)
|
||||
lr1121_modem_relay_activation_t activation; //!< Relay activation configuration
|
||||
lr1121_modem_relay_smart_level_t smart_level; //!< Smart level configuration. Only valid if @ref activation is set
|
||||
//!< to @ref LR1121_MODEM_RELAY_ACTIVATION_DYNAMIC
|
||||
uint8_t missed_ack_to_unsynchronized_threshold; //!< Number of consecutively WOR ACK to miss before switching to
|
||||
//!< unsynchronized state
|
||||
} lr1121_modem_relay_tx_configuration_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_RELAY_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
606
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_system.h
Executable file
606
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_system.h
Executable file
@@ -0,0 +1,606 @@
|
||||
/*!
|
||||
* @file lr1121_modem_system.h
|
||||
*
|
||||
* @brief System driver definition for LR1121
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_SYSTEM_H
|
||||
#define LR1121_MODEM_SYSTEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "lr1121_modem_common.h"
|
||||
#include "lr1121_modem_system_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Frequency step in MHz used to compute the image calibration parameter
|
||||
*
|
||||
* @see lr1121_modem_system_calibrate_image_in_mhz
|
||||
*/
|
||||
#define LR1121_MODEM_SYSTEM_IMAGE_CALIBRATION_STEP_IN_MHZ 4
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Reset the radio
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_reset( const void* context );
|
||||
|
||||
/**
|
||||
* @brief Wake the radio up from sleep mode.
|
||||
*
|
||||
* @param [in] context Chip implementation context.
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_wakeup( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Return stat1, stat2, and irq_status
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] stat1 Pointer to a variable for holding stat1. Can be NULL.
|
||||
* @param [out] stat2 Pointer to a variable for holding stat2. Can be NULL.
|
||||
* @param [out] irq_status Pointer to a variable for holding irq_status. Can be NULL.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @remark To simplify system integration, this function does not actually execute the GetStatus command, which would
|
||||
* require bidirectional SPI communication. It obtains the stat1, stat2, and irq_status values by performing an ordinary
|
||||
* SPI read (which is required to send null/NOP bytes on the MOSI line). This is possible since the LR1121 returns these
|
||||
* values automatically whenever a read that does not directly follow a response-carrying command is performed.
|
||||
* Unlike with the GetStatus command, however, the reset status information is NOT cleared by this command. The function
|
||||
* @ref lr1121_modem_system_clear_reset_status_info may be used for this purpose when necessary.
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_get_status( const void* context, lr1121_modem_system_stat1_t* stat1,
|
||||
lr1121_modem_system_stat2_t* stat2,
|
||||
lr1121_modem_system_irq_mask_t* irq_status );
|
||||
|
||||
/*!
|
||||
* @brief Clear the reset status information stored in stat2
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_clear_reset_status_info( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Return irq_status
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] irq_status irq_status status variable
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
static inline lr1121_modem_response_code_t lr1121_modem_system_get_irq_status(
|
||||
const void* context, lr1121_modem_system_irq_mask_t* irq_status )
|
||||
{
|
||||
return lr1121_modem_system_get_status( context, 0, 0, irq_status );
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Return the version of the system (hardware and software)
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] version Pointer to the structure holding the system version
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_get_version( const void* context,
|
||||
lr1121_modem_system_version_t* version );
|
||||
|
||||
/*!
|
||||
* @brief Return the system errors
|
||||
*
|
||||
* Errors may be fixed following:
|
||||
* - calibration error can be fixed by attempting another RC calibration;
|
||||
* - XOsc related errors may be due to hardware problems, can be fixed by reset;
|
||||
* - PLL lock related errors can be due to not-locked PLL, or by attempting to use an out-of-band frequency, can be
|
||||
* fixed by executing a PLL calibration, or by using other frequencies.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] errors Pointer to a value holding error flags
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_calibrate, lr1121_modem_system_calibrate_image, lr1121_modem_system_clear_errors
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_get_errors( const void* context, uint16_t* errors );
|
||||
|
||||
/*!
|
||||
* @brief Clear all error flags pending.
|
||||
*
|
||||
* This function cannot be used to clear flags individually.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_get_errors
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_clear_errors( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief lr1121_modem_system_calibrate the requested blocks
|
||||
*
|
||||
* This function can be called in any mode of the chip.
|
||||
*
|
||||
* The chip will return to standby RC mode on exit. Potential calibration issues can be read out with
|
||||
* lr1121_modem_system_get_errors command.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] calib_param Structure holding the reference to blocks to be calibrated
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_get_errors
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_calibrate( const void* context, const uint8_t calib_param );
|
||||
|
||||
/*!
|
||||
* @brief Configure the regulator mode to be used in specific modes
|
||||
*
|
||||
* This function shall only be called in standby RC mode.
|
||||
*
|
||||
* The reg_mode parameter defines if the DC-DC converter is switched on in the following modes: STANDBY XOSC, FS, RX, TX
|
||||
* and RX_CAPTURE.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] reg_mode Regulator mode configuration
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_set_reg_mode( const void* context,
|
||||
const lr1121_modem_system_reg_mode_t reg_mode );
|
||||
|
||||
/*!
|
||||
* @brief Launch an image calibration valid for all frequencies inside an interval, in steps
|
||||
*
|
||||
* This function can be called in any mode of the chip.
|
||||
*
|
||||
* The chip will return to standby RC mode on exit. Potential calibration issues can be read out with
|
||||
* lr1121_modem_system_get_errors command.
|
||||
*
|
||||
* The frequencies given in parameters are defined in 4MHz step (Eg. 900MHz corresponds to 0xE1). If freq1 = freq2, only
|
||||
* one calibration is performed.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] freq1 Image calibration interval lower bound, in steps
|
||||
* @param [in] freq2 Image calibration interval upper bound, in steps
|
||||
*
|
||||
* @remark freq1 must be less than or equal to freq2
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_get_errors
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_calibrate_image( const void* context, const uint8_t freq1,
|
||||
const uint8_t freq2 );
|
||||
|
||||
/*!
|
||||
* @brief Launch an image calibration valid for all frequencies inside an interval, in MHz
|
||||
*
|
||||
* @remark This function relies on @ref lr1121_modem_system_calibrate_image
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] freq1_in_mhz Image calibration interval lower bound, in MHz
|
||||
* @param [in] freq2_in_mhz Image calibration interval upper bound, in MHz
|
||||
*
|
||||
* @remark freq1 must be less than or equal to freq2
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_calibrate_image
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_calibrate_image_in_mhz( const void* context,
|
||||
const uint16_t freq1_in_mhz,
|
||||
const uint16_t freq2_in_mhz );
|
||||
|
||||
/*!
|
||||
* @brief Set the RF switch configurations for each RF setup
|
||||
*
|
||||
* This function shall only be called in standby RC mode.
|
||||
*
|
||||
* By default, no DIO is used to control a RF switch. All DIOs are set in High-Z mode.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] rf_switch_cfg Pointer to a structure that holds the switches configuration
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_set_dio_as_rf_switch(
|
||||
const void* context, const lr1121_modem_system_rfswitch_cfg_t* rf_switch_cfg );
|
||||
|
||||
/*!
|
||||
* @brief Set which interrupt signals are redirected to the dedicated DIO pin
|
||||
*
|
||||
* By default, no interrupt signal is redirected.
|
||||
*
|
||||
* The dedicated DIO pin will remain asserted until all redirected interrupt signals are cleared with a call to
|
||||
* lr1121_modem_system_clear_irq_status.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] irqs_to_enable_dio1 Variable that holds the interrupt mask for dio1
|
||||
* @param [in] irqs_to_enable_dio2 Variable that holds the interrupt mask for dio2
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_clear_irq_status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_set_dio_irq_params(
|
||||
const void* context, const lr1121_modem_system_irq_mask_t irqs_to_enable_dio1,
|
||||
const lr1121_modem_system_irq_mask_t irqs_to_enable_dio2 );
|
||||
|
||||
/*!
|
||||
* @brief Clear requested bits in the internal pending interrupt register
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] irqs_to_clear Variable that holds the interrupts to be cleared
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_clear_irq_status( const void* context,
|
||||
const lr1121_modem_system_irq_mask_t irqs_to_clear );
|
||||
|
||||
/**
|
||||
* @brief This helper function clears any radio irq status flags that are set and returns the flags that were cleared.
|
||||
*
|
||||
* @param [in] context Chip implementation context.
|
||||
* @param [out] irq Pointer to a variable for holding the system interrupt status. Can be NULL.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_get_irq_status, lr1121_modem_system_clear_irq_status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_get_and_clear_irq_status( const void* context,
|
||||
lr1121_modem_system_irq_mask_t* irq );
|
||||
|
||||
/*!
|
||||
* @brief Defines which clock is used as Low Frequency (LF) clock
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] lfclock_cfg Low frequency clock configuration
|
||||
* @param [in] wait_for_32k_ready Tells the radio if it has to check if 32k source is ready before driving busy low
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_calibrate, lr1121_modem_system_calibrate_image
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_cfg_lfclk( const void* context,
|
||||
const lr1121_modem_system_lfclk_cfg_t lfclock_cfg,
|
||||
const bool wait_for_32k_ready );
|
||||
|
||||
/*!
|
||||
* @brief Enable and configure TCXO supply voltage and detection timeout
|
||||
*
|
||||
* This function shall only be called in standby RC mode.
|
||||
*
|
||||
* The timeout parameter is the maximum time the firmware waits for the TCXO to be ready. The timeout duration is given
|
||||
* by: \f$ timeout\_duration\_us = timeout \times 30.52 \f$
|
||||
*
|
||||
* The TCXO mode can be disabled by setting timeout parameter to 0.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] tune Supply voltage value
|
||||
* @param [in] timeout Gating time before which the radio starts its Rx / Tx operation
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_calibrate, lr1121_modem_system_calibrate_image
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_set_tcxo_mode( const void* context,
|
||||
const lr1121_modem_system_tcxo_supply_voltage_t tune,
|
||||
const uint32_t timeout );
|
||||
|
||||
/*!
|
||||
* @brief Software reset of the chip.
|
||||
*
|
||||
* This function should be used to reboot the chip in a specified mode. Rebooting in flash mode presumes that the
|
||||
* content in flash memory is not corrupted (i.e. the integrity check performed by the bootloader before executing the
|
||||
* first instruction in flash is OK).
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] stay_in_bootloader Selector to stay in bootloader or execute flash code after reboot. If true, the
|
||||
* bootloader will not execute the flash code but activate SPI interface to allow firmware upgrade
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_reboot( const void* context, const bool stay_in_bootloader );
|
||||
|
||||
/*!
|
||||
* @brief Returns the value of Vbat
|
||||
*
|
||||
* Vbat value (in V) is a function of Vana (typ. 1.35V) using the following
|
||||
* formula: \f$ Vbat_{V} = (5 \times \frac{Vbat}{255} - 1) \times Vana \f$
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] vbat A pointer to the Vbat value
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_get_vbat( const void* context, uint8_t* vbat );
|
||||
|
||||
/*!
|
||||
* @brief Returns the value of Temp
|
||||
*
|
||||
* The temperature (in °C) is a function of Vana (typ. 1.35V), Vbe25 (Vbe voltage @ 25°C, typ. 0.7295V) and VbeSlope
|
||||
* (typ. -1.7mV/°C) using the following formula:
|
||||
* \f$ Temperature_{°C} = (\frac{Temp(10:0)}{2047} \times Vana - Vbe25) \times \frac{1000}{VbeSlope} + 25 \f$
|
||||
*
|
||||
* @remark If a TCXO is used, make sure to configure it with @ref lr1121_modem_system_set_tcxo_mode before calling this
|
||||
* function
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] temp A pointer to the Temp value
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_get_temp( const void* context, uint16_t* temp );
|
||||
|
||||
/*!
|
||||
* @brief Set the device into Sleep or Deep Sleep Mode
|
||||
*
|
||||
* The \p sleep_cfg parameter defines in which sleep mode is to use.
|
||||
*
|
||||
* The \p sleep_time parameter sets the sleep duration in number of clock cycles:
|
||||
* \f$ sleep\_time\_ms = sleep\_time \times \frac{1}{32.768} \f$
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] sleep_cfg Sleep mode configuration
|
||||
* @param [in] sleep_time Value of the RTC timeout (if RtcTimeout = 1)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_set_standby, lr1121_modem_system_set_fs
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_set_sleep( const void* context,
|
||||
const lr1121_modem_system_sleep_cfg_t sleep_cfg,
|
||||
const uint32_t sleep_time );
|
||||
|
||||
/*!
|
||||
* @brief Set the device into the requested Standby mode
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] standby_cfg Stand by mode configuration (RC or XOSC)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_set_sleep, lr1121_modem_system_set_fs
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_set_standby( const void* context,
|
||||
const lr1121_modem_system_standby_cfg_t standby_cfg );
|
||||
|
||||
/*!
|
||||
* @brief Set the device into Frequency Synthesis (FS) mode
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_set_standby, lr1121_modem_system_set_sleep
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_set_fs( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Erase an info page
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] info_page_id Info page to be erased. Only LR1121_MODEM_SYSTEM_INFOPAGE_1 is allowed.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_write_infopage, lr1121_modem_system_read_infopage
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_erase_infopage( const void* context,
|
||||
const lr1121_modem_system_infopage_id_t info_page_id );
|
||||
|
||||
/*!
|
||||
* @brief Write data in an info page
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] info_page_id Info page where data are written. Only LR1121_MODEM_SYSTEM_INFOPAGE_1 is allowed.
|
||||
* @param [in] address Address within the info page (aligned on 32-bit data)
|
||||
* @param [in] data Pointer to the data to write (data buffer shall be - at least - length words long)
|
||||
* @param [in] length Number of 32-bit data to write (maximum value is 64)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_erase_infopage, lr1121_modem_system_read_infopage
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_write_infopage( const void* context,
|
||||
const lr1121_modem_system_infopage_id_t info_page_id,
|
||||
const uint16_t address, const uint32_t* data,
|
||||
const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read data from an info page
|
||||
*
|
||||
* It is possible to cross from page 0 to 1 if (address + length >= 512)
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] info_page_id Info page where data are read
|
||||
* @param [in] address Address within the info page (aligned on 32-bit data)
|
||||
* @param [out] data Pointer to the data to read (data buffer shall be - at least - length words long)
|
||||
* @param [in] length Number of 32-bit data to read (maximum value is 64)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr1121_modem_system_erase_infopage, lr1121_modem_system_write_infopage
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_read_infopage( const void* context,
|
||||
const lr1121_modem_system_infopage_id_t info_page_id,
|
||||
const uint16_t address, uint32_t* data,
|
||||
const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read and return the Unique Identifier of the LR1121
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] unique_identifier The buffer to be filled with the Unique Identifier of the LR1121. It is up to the
|
||||
* application to ensure unique_identifier is long enough to hold the unique identifier
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see LR1121_MODEM_SYSTEM_UID_LENGTH
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_read_uid( const void* context,
|
||||
lr1121_modem_system_uid_t unique_identifier );
|
||||
|
||||
/*!
|
||||
* @brief Read and return the Join EUI of the LR1121
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] join_eui The buffer to be filled with Join EUI of the LR1121. It is up to the application to ensure
|
||||
* join_eui is long enough to hold the join EUI
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see LR1121_MODEM_SYSTEM_JOIN_EUI_LENGTH
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_read_join_eui( const void* context,
|
||||
lr1121_modem_system_join_eui_t join_eui );
|
||||
|
||||
/*!
|
||||
* @brief Compute and return the PIN of the LR1121 based on factory default EUIs
|
||||
*
|
||||
* @remark Calling this command also triggers a derivation of network and application keys based on factory default EUIs
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] pin The buffer to be filled with PIN of the LR1121. It is up to the application to ensure pin is long
|
||||
* enough to hold the PIN
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see LR1121_MODEM_SYSTEM_PIN_LENGTH
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_read_pin( const void* context, lr1121_modem_system_pin_t pin );
|
||||
|
||||
/*!
|
||||
* @brief Compute and return the PIN of the LR1121 based on EUIs provided as parameters
|
||||
*
|
||||
* @remark Calling this command also triggers a derivation of network and application keys based on EUIs provided as
|
||||
* parameters
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] device_eui Custom Device EUI
|
||||
* @param [in] join_eui Custom Join EUI
|
||||
* @param [in] rfu Parameter RFU - shall be set to 0x00
|
||||
* @param [out] pin The buffer to be filled with PIN of the LR1121. It is up to the application to ensure pin is long
|
||||
* enough to hold the PIN
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see LR1121_MODEM_SYSTEM_PIN_LENGTH
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_read_pin_custom_eui( const void* context,
|
||||
lr1121_modem_system_uid_t device_eui,
|
||||
lr1121_modem_system_join_eui_t join_eui,
|
||||
uint8_t rfu, lr1121_modem_system_pin_t pin );
|
||||
|
||||
/*!
|
||||
* @brief Read and return a 32-bit random number
|
||||
*
|
||||
* @remark Radio operating mode must be set into standby.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] random_number 32-bit random number
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_get_random_number( const void* context, uint32_t* random_number );
|
||||
|
||||
/*!
|
||||
* @brief Enable the CRC on SPI transactions
|
||||
*
|
||||
* @remark This command shall always be sent with a CRC (to both enable and disable the feature). The function does not
|
||||
* take care of this additional byte - which is under the responsibility of the underlying HAL functions
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] enable_crc CRC
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_enable_spi_crc( const void* context, bool enable_crc );
|
||||
|
||||
/*!
|
||||
* @brief Configure the GPIO drive in sleep mode
|
||||
*
|
||||
* @remark GPIO stands for RF switch and IRQ line DIOs
|
||||
*
|
||||
* @note This command is available from firmware version 0x0306
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] enable_drive GPIO drive configuration (true: enabled / false: disabled)
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr1121_modem_response_code_t lr1121_modem_system_drive_dio_in_sleep_mode( const void* context, bool enable_drive );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_SYSTEM_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
348
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_system_types.h
Executable file
348
components/esp_lora_1121/include/lr1121_modem/lr1121_modem_system_types.h
Executable file
@@ -0,0 +1,348 @@
|
||||
/*!
|
||||
* @file lr1121_modem_system_types.h
|
||||
*
|
||||
* @brief System driver types for LR1121
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_MODEM_SYSTEM_TYPES_H
|
||||
#define LR1121_MODEM_SYSTEM_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Length of the LR1121 Unique Identifier in bytes
|
||||
*
|
||||
* The LR1121 Unique Identifiers is an 8 byte long buffer
|
||||
*/
|
||||
#define LR1121_MODEM_SYSTEM_UID_LENGTH ( 8 )
|
||||
|
||||
/**
|
||||
* @brief Length of Join Unique Identifier in bytes
|
||||
*/
|
||||
#define LR1121_MODEM_SYSTEM_JOIN_EUI_LENGTH ( 8 )
|
||||
|
||||
/**
|
||||
* @brief Length of PIN number in bytes
|
||||
*/
|
||||
#define LR1121_MODEM_SYSTEM_PIN_LENGTH ( 4 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Fixed-length array to store a UID
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_system_uid_t[LR1121_MODEM_SYSTEM_UID_LENGTH];
|
||||
|
||||
/**
|
||||
* @brief Fixed-length array to store a joinEUI
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_system_join_eui_t[LR1121_MODEM_SYSTEM_JOIN_EUI_LENGTH];
|
||||
|
||||
/**
|
||||
* @brief Fixed-length array to store a PIN
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_system_pin_t[LR1121_MODEM_SYSTEM_PIN_LENGTH];
|
||||
|
||||
/**
|
||||
* @brief Type to store system interrupt flags
|
||||
*/
|
||||
typedef uint32_t lr1121_modem_system_irq_mask_t;
|
||||
|
||||
/**
|
||||
* @brief Interrupt flags
|
||||
*/
|
||||
enum lr1121_modem_system_irq_e
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_IRQ_NONE = ( 0 << 0 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_TX_DONE = ( 1 << 2 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_RX_DONE = ( 1 << 3 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_PREAMBLE_DETECTED = ( 1 << 4 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_SYNC_WORD_HEADER_VALID = ( 1 << 5 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_HEADER_ERROR = ( 1 << 6 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_CRC_ERROR = ( 1 << 7 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_CAD_DONE = ( 1 << 8 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_CAD_DETECTED = ( 1 << 9 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_TIMEOUT = ( 1 << 10 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_LR_FHSS_INTRA_PKT_HOP = ( 1 << 11 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_EOL = ( 1 << 21 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_CMD_ERROR = ( 1 << 22 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_ERROR = ( 1 << 23 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_FSK_LEN_ERROR = ( 1 << 24 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_FSK_ADDR_ERROR = ( 1 << 25 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_LORA_RX_TIMESTAMP = ( 1 << 27 ),
|
||||
LR1121_MODEM_SYSTEM_IRQ_ALL_MASK =
|
||||
LR1121_MODEM_SYSTEM_IRQ_TX_DONE | LR1121_MODEM_SYSTEM_IRQ_RX_DONE | LR1121_MODEM_SYSTEM_IRQ_PREAMBLE_DETECTED |
|
||||
LR1121_MODEM_SYSTEM_IRQ_SYNC_WORD_HEADER_VALID | LR1121_MODEM_SYSTEM_IRQ_HEADER_ERROR |
|
||||
LR1121_MODEM_SYSTEM_IRQ_CRC_ERROR | LR1121_MODEM_SYSTEM_IRQ_CAD_DONE | LR1121_MODEM_SYSTEM_IRQ_CAD_DETECTED |
|
||||
LR1121_MODEM_SYSTEM_IRQ_TIMEOUT | LR1121_MODEM_SYSTEM_IRQ_LR_FHSS_INTRA_PKT_HOP | LR1121_MODEM_SYSTEM_IRQ_EOL |
|
||||
LR1121_MODEM_SYSTEM_IRQ_CMD_ERROR | LR1121_MODEM_SYSTEM_IRQ_ERROR | LR1121_MODEM_SYSTEM_IRQ_FSK_LEN_ERROR |
|
||||
LR1121_MODEM_SYSTEM_IRQ_FSK_ADDR_ERROR | LR1121_MODEM_SYSTEM_IRQ_LORA_RX_TIMESTAMP,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Calibration flags
|
||||
*/
|
||||
enum lr1121_modem_system_calibration_e
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_CALIB_LF_RC_MASK = ( 1 << 0 ),
|
||||
LR1121_MODEM_SYSTEM_CALIB_HF_RC_MASK = ( 1 << 1 ),
|
||||
LR1121_MODEM_SYSTEM_CALIB_PLL_MASK = ( 1 << 2 ),
|
||||
LR1121_MODEM_SYSTEM_CALIB_ADC_MASK = ( 1 << 3 ),
|
||||
LR1121_MODEM_SYSTEM_CALIB_IMG_MASK = ( 1 << 4 ),
|
||||
LR1121_MODEM_SYSTEM_CALIB_PLL_TX_MASK = ( 1 << 5 ),
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Type for calibration mask
|
||||
*
|
||||
* @see lr1121_modem_system_calibration_e
|
||||
*/
|
||||
typedef uint8_t lr1121_modem_system_cal_mask_t;
|
||||
|
||||
/**
|
||||
* @brief Error flags
|
||||
*/
|
||||
enum lr1121_modem_system_errors_e
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_ERRORS_LF_RC_CALIB_MASK = ( 1 << 0 ),
|
||||
LR1121_MODEM_SYSTEM_ERRORS_HF_RC_CALIB_MASK = ( 1 << 1 ),
|
||||
LR1121_MODEM_SYSTEM_ERRORS_ADC_CALIB_MASK = ( 1 << 2 ),
|
||||
LR1121_MODEM_SYSTEM_ERRORS_PLL_CALIB_MASK = ( 1 << 3 ),
|
||||
LR1121_MODEM_SYSTEM_ERRORS_IMG_CALIB_MASK = ( 1 << 4 ),
|
||||
LR1121_MODEM_SYSTEM_ERRORS_HF_XOSC_START_MASK = ( 1 << 5 ),
|
||||
LR1121_MODEM_SYSTEM_ERRORS_LF_XOSC_START_MASK = ( 1 << 6 ),
|
||||
LR1121_MODEM_SYSTEM_ERRORS_PLL_LOCK_MASK = ( 1 << 7 ),
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Type for system errors mask
|
||||
*
|
||||
* @see lr1121_modem_system_errors_e
|
||||
*/
|
||||
typedef uint16_t lr1121_modem_system_errors_t;
|
||||
|
||||
/**
|
||||
* @brief Chip modes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_CHIP_MODE_SLEEP = 0x00,
|
||||
LR1121_MODEM_SYSTEM_CHIP_MODE_STBY_RC = 0x01,
|
||||
LR1121_MODEM_SYSTEM_CHIP_MODE_STBY_XOSC = 0x02,
|
||||
LR1121_MODEM_SYSTEM_CHIP_MODE_FS = 0x03,
|
||||
LR1121_MODEM_SYSTEM_CHIP_MODE_RX = 0x04,
|
||||
LR1121_MODEM_SYSTEM_CHIP_MODE_TX = 0x05,
|
||||
LR1121_MODEM_SYSTEM_CHIP_MODE_LOC = 0x06,
|
||||
} lr1121_modem_system_chip_modes_t;
|
||||
|
||||
/**
|
||||
* @brief Reset status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_RESET_STATUS_CLEARED = 0x00,
|
||||
LR1121_MODEM_SYSTEM_RESET_STATUS_ANALOG = 0x01,
|
||||
LR1121_MODEM_SYSTEM_RESET_STATUS_EXTERNAL = 0x02,
|
||||
LR1121_MODEM_SYSTEM_RESET_STATUS_SYSTEM = 0x03,
|
||||
LR1121_MODEM_SYSTEM_RESET_STATUS_WATCHDOG = 0x04,
|
||||
LR1121_MODEM_SYSTEM_RESET_STATUS_IOCD_RESTART = 0x05,
|
||||
LR1121_MODEM_SYSTEM_RESET_STATUS_RTC_RESTART = 0x06,
|
||||
} lr1121_modem_system_reset_status_t;
|
||||
|
||||
/**
|
||||
* @brief Command status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_CMD_STATUS_FAIL = 0x00,
|
||||
LR1121_MODEM_SYSTEM_CMD_STATUS_PERR = 0x01,
|
||||
LR1121_MODEM_SYSTEM_CMD_STATUS_OK = 0x02,
|
||||
LR1121_MODEM_SYSTEM_CMD_STATUS_DATA = 0x03,
|
||||
} lr1121_modem_system_command_status_t;
|
||||
|
||||
/**
|
||||
* @brief Low-frequency clock modes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_LFCLK_RC = 0x00, //!< (Default)
|
||||
LR1121_MODEM_SYSTEM_LFCLK_XTAL = 0x01,
|
||||
LR1121_MODEM_SYSTEM_LFCLK_EXT = 0x02
|
||||
} lr1121_modem_system_lfclk_cfg_t;
|
||||
|
||||
/**
|
||||
* @brief Regulator modes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_REG_MODE_LDO = 0x00, //!< (Default)
|
||||
LR1121_MODEM_SYSTEM_REG_MODE_DCDC = 0x01,
|
||||
} lr1121_modem_system_reg_mode_t;
|
||||
|
||||
/**
|
||||
* @brief Info page ID
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_INFOPAGE_0 = 0x00, //!< Info page #0
|
||||
LR1121_MODEM_SYSTEM_INFOPAGE_1 = 0x01, //!< Info page #1
|
||||
} lr1121_modem_system_infopage_id_t;
|
||||
|
||||
/**
|
||||
* @brief RF switch configuration pin
|
||||
*/
|
||||
enum lr1121_modem_system_rfswitch_cfg_pin_e
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_RFSW0_HIGH = ( 1 << 0 ),
|
||||
LR1121_MODEM_SYSTEM_RFSW1_HIGH = ( 1 << 1 ),
|
||||
LR1121_MODEM_SYSTEM_RFSW2_HIGH = ( 1 << 2 ),
|
||||
LR1121_MODEM_SYSTEM_RFSW3_HIGH = ( 1 << 3 ),
|
||||
LR1121_MODEM_SYSTEM_RFSW4_HIGH = ( 1 << 4 ),
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief RF switch configuration structure definition
|
||||
*/
|
||||
typedef struct lr1121_modem_system_rfswitch_cfg_s
|
||||
{
|
||||
uint8_t enable; //!< Bitmask for DIO to control as RF switches
|
||||
uint8_t standby; //!< Bitmask for DIO state while chip is in standby mode
|
||||
uint8_t rx; //!< Bitmask for DIO state while chip is in reception mode
|
||||
uint8_t tx; //!< Bitmask for DIO state while chip is in transmission mode
|
||||
uint8_t tx_hp; //!< Bitmask for DIO state while chip is in high power transmission mode
|
||||
uint8_t tx_hf; //!< Bitmask for DIO state while chip is in high frequency transmission mode
|
||||
} lr1121_modem_system_rfswitch_cfg_t;
|
||||
|
||||
/**
|
||||
* @brief Stand by configuration values
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_STANDBY_CFG_RC = 0x00,
|
||||
LR1121_MODEM_SYSTEM_STANDBY_CFG_XOSC = 0x01
|
||||
} lr1121_modem_system_standby_cfg_t;
|
||||
|
||||
/**
|
||||
* @brief TCXO supply voltage values
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_TCXO_CTRL_1_6V = 0x00, //!< Supply voltage = 1.6v
|
||||
LR1121_MODEM_SYSTEM_TCXO_CTRL_1_7V = 0x01, //!< Supply voltage = 1.7v
|
||||
LR1121_MODEM_SYSTEM_TCXO_CTRL_1_8V = 0x02, //!< Supply voltage = 1.8v
|
||||
LR1121_MODEM_SYSTEM_TCXO_CTRL_2_2V = 0x03, //!< Supply voltage = 2.2v
|
||||
LR1121_MODEM_SYSTEM_TCXO_CTRL_2_4V = 0x04, //!< Supply voltage = 2.4v
|
||||
LR1121_MODEM_SYSTEM_TCXO_CTRL_2_7V = 0x05, //!< Supply voltage = 2.7v
|
||||
LR1121_MODEM_SYSTEM_TCXO_CTRL_3_0V = 0x06, //!< Supply voltage = 3.0v
|
||||
LR1121_MODEM_SYSTEM_TCXO_CTRL_3_3V = 0x07, //!< Supply voltage = 3.3v
|
||||
} lr1121_modem_system_tcxo_supply_voltage_t;
|
||||
|
||||
/**
|
||||
* @brief Status register 1 structure definition
|
||||
*/
|
||||
typedef struct lr1121_modem_system_stat1_s
|
||||
{
|
||||
lr1121_modem_system_command_status_t command_status; //!< Status of last command
|
||||
bool is_interrupt_active; //!< Indicates at least one interrupt is active
|
||||
} lr1121_modem_system_stat1_t;
|
||||
|
||||
/**
|
||||
* @brief Status register 2 structure definition
|
||||
*/
|
||||
typedef struct lr1121_modem_system_stat2_s
|
||||
{
|
||||
lr1121_modem_system_reset_status_t reset_status; //!< Source of reset
|
||||
lr1121_modem_system_chip_modes_t chip_mode; //!< Current mode the chip is running
|
||||
bool is_running_from_flash; //!< Flag indicating if the chip is currently running from flash
|
||||
} lr1121_modem_system_stat2_t;
|
||||
|
||||
/**
|
||||
* @brief Chip type values
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR1121_MODEM_SYSTEM_VERSION_TYPE_LR1121 = 0x03,
|
||||
} lr1121_modem_system_version_type_t;
|
||||
|
||||
/**
|
||||
* @brief Version structure definition
|
||||
*/
|
||||
typedef struct lr1121_modem_system_version_s
|
||||
{
|
||||
uint8_t hw; //!< Hardware field of system version
|
||||
lr1121_modem_system_version_type_t type; //!< Type field of system version
|
||||
uint16_t fw; //!< Software field of system version
|
||||
} lr1121_modem_system_version_t;
|
||||
|
||||
/**
|
||||
* @brief Sleep configuration structure definition
|
||||
*/
|
||||
typedef struct lr1121_modem_system_sleep_cfg_s
|
||||
{
|
||||
bool is_warm_start; //!< Keep configuration and state in retention memory, allowing warm start
|
||||
} lr1121_modem_system_sleep_cfg_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR1121_MODEM_SYSTEM_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
75
components/esp_lora_1121/include/lr1121_modem/lr1121_types.h
Executable file
75
components/esp_lora_1121/include/lr1121_modem/lr1121_types.h
Executable file
@@ -0,0 +1,75 @@
|
||||
/*!
|
||||
* @file lr1121_types.h
|
||||
*
|
||||
* @brief Type definitions for LR1121
|
||||
*
|
||||
* @copyright Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* @license{The Clear BSD License
|
||||
* @par
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* @par
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.}
|
||||
*/
|
||||
|
||||
#ifndef LR1121_TYPES_H
|
||||
#define LR1121_TYPES_H
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief LR1121 status
|
||||
*/
|
||||
typedef enum lr1121_status_e
|
||||
{
|
||||
LR1121_STATUS_OK = 0, //!< Operation terminated successfully
|
||||
LR1121_STATUS_ERROR = 3, //!< Operation terminated with error
|
||||
} lr1121_status_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#endif // LR1121_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
127
components/esp_lora_1121/include/lr1121_modem/lr_fhss_v1_base_types.h
Executable file
127
components/esp_lora_1121/include/lr1121_modem/lr_fhss_v1_base_types.h
Executable file
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
* @file lr_fhss_v1_base_types.h
|
||||
*
|
||||
* @brief Radio-independent LR-FHSS base type definitions, version 1
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR_FHSS_V1_BASE_TYPES_H__
|
||||
#define LR_FHSS_V1_BASE_TYPES_H__
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS modulation type
|
||||
*/
|
||||
typedef enum lr_fhss_v1_modulation_type_e
|
||||
{
|
||||
LR_FHSS_V1_MODULATION_TYPE_GMSK_488 = 0,
|
||||
} lr_fhss_v1_modulation_type_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS coding rate
|
||||
*/
|
||||
typedef enum lr_fhss_v1_cr_e
|
||||
{
|
||||
LR_FHSS_V1_CR_5_6 = 0x00,
|
||||
LR_FHSS_V1_CR_2_3 = 0x01,
|
||||
LR_FHSS_V1_CR_1_2 = 0x02,
|
||||
LR_FHSS_V1_CR_1_3 = 0x03,
|
||||
} lr_fhss_v1_cr_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS grid
|
||||
*/
|
||||
typedef enum lr_fhss_v1_grid_e
|
||||
{
|
||||
LR_FHSS_V1_GRID_25391_HZ = 0x00,
|
||||
LR_FHSS_V1_GRID_3906_HZ = 0x01,
|
||||
} lr_fhss_v1_grid_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS bandwidth
|
||||
*/
|
||||
typedef enum lr_fhss_v1_bw_e
|
||||
{
|
||||
LR_FHSS_V1_BW_39063_HZ = 0x00,
|
||||
LR_FHSS_V1_BW_85938_HZ = 0x01,
|
||||
LR_FHSS_V1_BW_136719_HZ = 0x02,
|
||||
LR_FHSS_V1_BW_183594_HZ = 0x03,
|
||||
LR_FHSS_V1_BW_335938_HZ = 0x04,
|
||||
LR_FHSS_V1_BW_386719_HZ = 0x05,
|
||||
LR_FHSS_V1_BW_722656_HZ = 0x06,
|
||||
LR_FHSS_V1_BW_773438_HZ = 0x07,
|
||||
LR_FHSS_V1_BW_1523438_HZ = 0x08,
|
||||
LR_FHSS_V1_BW_1574219_HZ = 0x09,
|
||||
} lr_fhss_v1_bw_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS parameter structure
|
||||
*/
|
||||
typedef struct lr_fhss_v1_params_s
|
||||
{
|
||||
const uint8_t* sync_word; /**< 4-byte sync word */
|
||||
lr_fhss_v1_modulation_type_t modulation_type;
|
||||
lr_fhss_v1_cr_t cr;
|
||||
lr_fhss_v1_grid_t grid;
|
||||
lr_fhss_v1_bw_t bw;
|
||||
bool enable_hopping;
|
||||
uint8_t header_count; /**< Number of header blocks */
|
||||
} lr_fhss_v1_params_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#endif // LR_FHSS_V1_BASE_TYPES_H__
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
141
components/esp_lora_1121/include/lr1121_printers/lr1121_modem_printf_info.h
Executable file
141
components/esp_lora_1121/include/lr1121_printers/lr1121_modem_printf_info.h
Executable file
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* @file lr1121_modem_printf_info.h
|
||||
*
|
||||
* @brief Common Application Helper functions
|
||||
*
|
||||
* @copyright
|
||||
* @parblock
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2024. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* @endparblock
|
||||
*/
|
||||
#ifndef LR1121_MODEM_PRINTF_INFO_H
|
||||
#define LR1121_MODEM_PRINTF_INFO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lr1121_modem/lr1121_modem_lorawan.h"
|
||||
#include "lr1121_modem/lr1121_modem_modem.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Prints the provided buffer in HEX
|
||||
*
|
||||
* @param [in] buffer Buffer to be printed
|
||||
* @param [in] size Buffer size to be printed
|
||||
*/
|
||||
void print_hex_buffer( const uint8_t* buffer, uint8_t size );
|
||||
|
||||
/**
|
||||
* @brief Prints the LoRaWAN keys
|
||||
*
|
||||
* @param [in] dev_eui Device EUI to be printed
|
||||
* @param [in] join_eui Join EUI to be printed
|
||||
* @param [in] use_internal_credentials specify if the internal credentials are used
|
||||
*/
|
||||
void print_lorawan_credentials( const uint8_t* dev_eui, const uint8_t* join_eui, const uint8_t* pin,
|
||||
const bool use_internal_credentials );
|
||||
|
||||
/**
|
||||
* @brief Prints the LoRaWAN version
|
||||
*
|
||||
* @param [in] modem_version Modem version to be printed
|
||||
*/
|
||||
void print_version( lr1121_modem_version_t modem_version );
|
||||
|
||||
/**
|
||||
* @brief convert lr1121 modem-e status to string
|
||||
*/
|
||||
void modem_status_to_string( lr1121_modem_lorawan_status_t modem_status );
|
||||
|
||||
/**
|
||||
* @brief Get the lorawan region from modem and print it
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] modem_region The LoRaWAN region returned by the modem. This pointer can be NULL: in this case the region
|
||||
* is only printed, and not returned to caller
|
||||
*/
|
||||
void get_and_print_lorawan_region_from_modem( const void* context, lr1121_modem_regions_t* modem_region );
|
||||
|
||||
/**
|
||||
* @brief Prints the LoRaWAN region
|
||||
*
|
||||
* @param [in] region Region to be printed
|
||||
*/
|
||||
void print_lorawan_region( lr1121_modem_regions_t region );
|
||||
|
||||
/**
|
||||
* @brief Prints the state of certification mode
|
||||
*
|
||||
* @param [in] certif_running State of certification mode
|
||||
*/
|
||||
void print_certification( lr1121_modem_certification_mode_t certif_running );
|
||||
|
||||
/**
|
||||
* @brief Gets and prints the crashlog if the crashlog status bit is set
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*/
|
||||
void get_and_print_crashlog( const void* context );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // APPS_UTILITIES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
@@ -0,0 +1,48 @@
|
||||
/*!
|
||||
* @file lr11xx_bootloader_types_str.h
|
||||
*
|
||||
* @brief Printer helper functions for LR11xx bootloader types
|
||||
*
|
||||
* @copyright
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2023. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_BOOTLOADER_TYPES_STR_H
|
||||
#define LR11XX_BOOTLOADER_TYPES_STR_H
|
||||
#include "lr11xx_driver/lr11xx_bootloader_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
const char* lr11xx_bootloader_chip_modes_to_str( const lr11xx_bootloader_chip_modes_t value );
|
||||
const char* lr11xx_bootloader_reset_status_to_str( const lr11xx_bootloader_reset_status_t value );
|
||||
const char* lr11xx_bootloader_command_status_to_str( const lr11xx_bootloader_command_status_t value );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // LR11XX_BOOTLOADER_TYPES_STR_H
|
||||
@@ -0,0 +1,49 @@
|
||||
/*!
|
||||
* @file lr11xx_crypto_engine_types_str.h
|
||||
*
|
||||
* @brief Printer helper functions for LR11xx crypto engine types
|
||||
*
|
||||
* @copyright
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2023. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_CRYPTO_ENGINE_TYPES_STR_H
|
||||
#define LR11XX_CRYPTO_ENGINE_TYPES_STR_H
|
||||
#include "lr11xx_driver/lr11xx_crypto_engine_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
const char* lr11xx_crypto_element_to_str( const lr11xx_crypto_element_t value );
|
||||
const char* lr11xx_crypto_status_to_str( const lr11xx_crypto_status_t value );
|
||||
const char* lr11xx_crypto_lorawan_version_to_str( const lr11xx_crypto_lorawan_version_t value );
|
||||
const char* lr11xx_crypto_keys_idx_to_str( const lr11xx_crypto_keys_idx_t value );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // LR11XX_CRYPTO_ENGINE_TYPES_STR_H
|
||||
49
components/esp_lora_1121/include/lr1121_printers/lr11xx_lr_fhss_types_str.h
Executable file
49
components/esp_lora_1121/include/lr1121_printers/lr11xx_lr_fhss_types_str.h
Executable file
@@ -0,0 +1,49 @@
|
||||
/*!
|
||||
* @file lr11xx_lr_fhss_types_str.h
|
||||
*
|
||||
* @brief Printer helper functions for LR11xx LRFHSS types
|
||||
*
|
||||
* @copyright
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2023. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_LR_FHSS_TYPES_STR_H
|
||||
#define LR11XX_LR_FHSS_TYPES_STR_H
|
||||
#include "lr11xx_driver/lr11xx_lr_fhss_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
const char* lr_fhss_v1_modulation_type_to_str( const lr_fhss_v1_modulation_type_t value );
|
||||
const char* lr_fhss_v1_cr_to_str( const lr_fhss_v1_cr_t value );
|
||||
const char* lr_fhss_v1_grid_to_str( const lr_fhss_v1_grid_t value );
|
||||
const char* lr_fhss_v1_bw_to_str( const lr_fhss_v1_bw_t value );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // LR11XX_LR_FHSS_TYPES_STR_H
|
||||
14
components/esp_lora_1121/include/lr1121_printers/lr11xx_printf_info.h
Executable file
14
components/esp_lora_1121/include/lr1121_printers/lr11xx_printf_info.h
Executable file
@@ -0,0 +1,14 @@
|
||||
#ifndef LR11XX_VER_TEMP_H
|
||||
#define LR11XX_VER_TEMP_H
|
||||
#include "lr11xx_driver/lr11xx_system.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void lora_print_version( const void* context );
|
||||
void lora_print_temp( const void* context );
|
||||
void lora_print_vbat( const void* context );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // LR11XX_VER_TEMP_H
|
||||
70
components/esp_lora_1121/include/lr1121_printers/lr11xx_radio_types_str.h
Executable file
70
components/esp_lora_1121/include/lr1121_printers/lr11xx_radio_types_str.h
Executable file
@@ -0,0 +1,70 @@
|
||||
/*!
|
||||
* @file lr11xx_radio_types_str.h
|
||||
*
|
||||
* @brief Printer helper functions for LR11xx radio types
|
||||
*
|
||||
* @copyright
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2023. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_RADIO_TYPES_STR_H
|
||||
#define LR11XX_RADIO_TYPES_STR_H
|
||||
#include "lr11xx_driver/lr11xx_radio_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
const char* lr11xx_radio_pa_selection_to_str( const lr11xx_radio_pa_selection_t value );
|
||||
const char* lr11xx_radio_gfsk_address_filtering_to_str( const lr11xx_radio_gfsk_address_filtering_t value );
|
||||
const char* lr11xx_radio_fallback_modes_to_str( const lr11xx_radio_fallback_modes_t value );
|
||||
const char* lr11xx_radio_ramp_time_to_str( const lr11xx_radio_ramp_time_t value );
|
||||
const char* lr11xx_radio_lora_network_type_to_str( const lr11xx_radio_lora_network_type_t value );
|
||||
const char* lr11xx_radio_lora_sf_to_str( const lr11xx_radio_lora_sf_t value );
|
||||
const char* lr11xx_radio_lora_bw_to_str( const lr11xx_radio_lora_bw_t value );
|
||||
const char* lr11xx_radio_lora_cr_to_str( const lr11xx_radio_lora_cr_t value );
|
||||
const char* lr11xx_radio_intermediary_mode_to_str( const lr11xx_radio_intermediary_mode_t value );
|
||||
const char* lr11xx_radio_gfsk_crc_type_to_str( const lr11xx_radio_gfsk_crc_type_t value );
|
||||
const char* lr11xx_radio_gfsk_dc_free_to_str( const lr11xx_radio_gfsk_dc_free_t value );
|
||||
const char* lr11xx_radio_gfsk_pkt_len_modes_to_str( const lr11xx_radio_gfsk_pkt_len_modes_t value );
|
||||
const char* lr11xx_radio_gfsk_preamble_detector_to_str( const lr11xx_radio_gfsk_preamble_detector_t value );
|
||||
const char* lr11xx_radio_lora_crc_to_str( const lr11xx_radio_lora_crc_t value );
|
||||
const char* lr11xx_radio_lora_pkt_len_modes_to_str( const lr11xx_radio_lora_pkt_len_modes_t value );
|
||||
const char* lr11xx_radio_lora_iq_to_str( const lr11xx_radio_lora_iq_t value );
|
||||
const char* lr11xx_radio_pkt_type_to_str( const lr11xx_radio_pkt_type_t value );
|
||||
const char* lr11xx_radio_pa_reg_supply_to_str( const lr11xx_radio_pa_reg_supply_t value );
|
||||
const char* lr11xx_radio_rx_duty_cycle_mode_to_str( const lr11xx_radio_rx_duty_cycle_mode_t value );
|
||||
const char* lr11xx_radio_gfsk_bw_to_str( const lr11xx_radio_gfsk_bw_t value );
|
||||
const char* lr11xx_radio_cad_exit_mode_to_str( const lr11xx_radio_cad_exit_mode_t value );
|
||||
const char* lr11xx_radio_gfsk_pulse_shape_to_str( const lr11xx_radio_gfsk_pulse_shape_t value );
|
||||
const char* lr11xx_radio_bpsk_pulse_shape_to_str( const lr11xx_radio_bpsk_pulse_shape_t value );
|
||||
const char* lr11xx_radio_lr_fhss_bitrate_to_str( const lr11xx_radio_lr_fhss_bitrate_t value );
|
||||
const char* lr11xx_radio_lr_fhss_pulse_shape_to_str( const lr11xx_radio_lr_fhss_pulse_shape_t value );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // LR11XX_RADIO_TYPES_STR_H
|
||||
46
components/esp_lora_1121/include/lr1121_printers/lr11xx_rttof_types_str.h
Executable file
46
components/esp_lora_1121/include/lr1121_printers/lr11xx_rttof_types_str.h
Executable file
@@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* @file lr11xx_rttof_types_str.h
|
||||
*
|
||||
* @brief Printer helper functions for LR11xx RTToF types
|
||||
*
|
||||
* @copyright
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2023. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_RTTOF_TYPES_STR_H
|
||||
#define LR11XX_RTTOF_TYPES_STR_H
|
||||
#include "lr11xx_driver/lr11xx_rttof_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
const char* lr11xx_rttof_result_type_to_str( const lr11xx_rttof_result_type_t value );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // LR11XX_RTTOF_TYPES_STR_H
|
||||
54
components/esp_lora_1121/include/lr1121_printers/lr11xx_system_types_str.h
Executable file
54
components/esp_lora_1121/include/lr1121_printers/lr11xx_system_types_str.h
Executable file
@@ -0,0 +1,54 @@
|
||||
/*!
|
||||
* @file lr11xx_system_types_str.h
|
||||
*
|
||||
* @brief Printer helper functions for LR11xx system types
|
||||
*
|
||||
* @copyright
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2023. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_SYSTEM_TYPES_STR_H
|
||||
#define LR11XX_SYSTEM_TYPES_STR_H
|
||||
#include "lr11xx_driver/lr11xx_system_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
const char* lr11xx_system_chip_modes_to_str( const lr11xx_system_chip_modes_t value );
|
||||
const char* lr11xx_system_reset_status_to_str( const lr11xx_system_reset_status_t value );
|
||||
const char* lr11xx_system_command_status_to_str( const lr11xx_system_command_status_t value );
|
||||
const char* lr11xx_system_lfclk_cfg_to_str( const lr11xx_system_lfclk_cfg_t value );
|
||||
const char* lr11xx_system_reg_mode_to_str( const lr11xx_system_reg_mode_t value );
|
||||
const char* lr11xx_system_infopage_id_to_str( const lr11xx_system_infopage_id_t value );
|
||||
const char* lr11xx_system_standby_cfg_to_str( const lr11xx_system_standby_cfg_t value );
|
||||
const char* lr11xx_system_tcxo_supply_voltage_to_str( const lr11xx_system_tcxo_supply_voltage_t value );
|
||||
const char* lr11xx_system_version_type_to_str( const lr11xx_system_version_type_t value );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // LR11XX_SYSTEM_TYPES_STR_H
|
||||
46
components/esp_lora_1121/include/lr1121_printers/lr11xx_types_str.h
Executable file
46
components/esp_lora_1121/include/lr1121_printers/lr11xx_types_str.h
Executable file
@@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* @file lr11xx_types_str.h
|
||||
*
|
||||
* @brief Printer helper functions for LR11xx types
|
||||
*
|
||||
* @copyright
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2023. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_TYPES_STR_H
|
||||
#define LR11XX_TYPES_STR_H
|
||||
#include "lr11xx_driver/lr11xx_types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
const char* lr11xx_status_to_str( const lr11xx_status_t value );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // LR11XX_TYPES_STR_H
|
||||
213
components/esp_lora_1121/include/lr11xx_driver/lr11xx_bootloader.h
Executable file
213
components/esp_lora_1121/include/lr11xx_driver/lr11xx_bootloader.h
Executable file
@@ -0,0 +1,213 @@
|
||||
/*!
|
||||
* @file lr11xx_bootloader.h
|
||||
*
|
||||
* @brief Bootloader driver definition for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_BOOTLOADER_H
|
||||
#define LR11XX_BOOTLOADER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "lr11xx_bootloader_types.h"
|
||||
#include "lr11xx_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
typedef uint32_t lr11xx_bootloader_irq_mask_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Return the status registers and interrupt flags
|
||||
*
|
||||
* @remark To simplify system integration, this function does not actually execute the GetStatus command, which would
|
||||
* require bidirectional SPI communication. It obtains the stat1, stat2, and irq_status values by performing an ordinary
|
||||
* SPI read (which is required to send null/NOP bytes on the MOSI line). This is possible since the LR11XX returns these
|
||||
* values automatically whenever a read that does not directly follow a response-carrying command is performed. Unlike
|
||||
* with the GetStatus command, however, the reset status information is NOT cleared by this command. The function @ref
|
||||
* lr11xx_bootloader_clear_reset_status_info may be used for this purpose when necessary.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] stat1 Content of status register 1
|
||||
* @param [out] stat2 Content of status register 2
|
||||
* @param [out] irq_status Interrupt flags
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_get_status( const void* context, lr11xx_bootloader_stat1_t* stat1,
|
||||
lr11xx_bootloader_stat2_t* stat2,
|
||||
lr11xx_bootloader_irq_mask_t* irq_status );
|
||||
|
||||
/*!
|
||||
* @brief Clear the reset status information stored in stat2
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_clear_reset_status_info( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Return the version of the system (hardware and software)
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] version Pointer to the structure holding the system version
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_get_version( const void* context, lr11xx_bootloader_version_t* version );
|
||||
|
||||
/*!
|
||||
* @brief Erase the whole flash memory of the chip
|
||||
*
|
||||
* This function shall be called before any attempt to write a new firmware in flash memory
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_erase_flash( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Write encrypted data in program flash memory of the chip
|
||||
*
|
||||
* This function shall be used when updating the encrypted flash content of the LR11XX.
|
||||
* The encrypted flash payload to transfer shall be represented as an array of words (i.e. 4-byte values).
|
||||
*
|
||||
* Updating flash code of the chip with this function MUST respect the following constraints:
|
||||
* - the complete flash image MUST be splitted into chunks of 64 words each, except the last one that can be shorter
|
||||
* - the chunks MUST be sent to the chip in-order, starting with @p offset_in_byte = 0
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] offset_in_byte The offset from start register of flash in byte
|
||||
* @param [in] buffer Buffer holding the encrypted content. Its size in words must be at least length
|
||||
* @param [in] length_in_word Number of words (i.e. 4 bytes) in the buffer to transfer. MUST be 64 for all chunks except
|
||||
* the last one where it can be lower.
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_write_flash_encrypted( const void* context, const uint32_t offset_in_byte,
|
||||
const uint32_t* buffer, const uint8_t length_in_word );
|
||||
|
||||
/*!
|
||||
* @brief Write encrypted data in program flash memory of the chip
|
||||
*
|
||||
* This function shall be used when updating the encrypted flash content of the LR11XX.
|
||||
* The encrypted flash payload to transfer shall be represented as an array of words (ie 4-byte values).
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] offset_in_byte The offset from start register of flash in byte
|
||||
* @param [in] buffer Buffer holding the encrypted content. Its size in words must be at least length
|
||||
* @param [in] length_in_word Number of words (i.e. 4 bytes) in the buffer to transfer
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_write_flash_encrypted_full( const void* context, const uint32_t offset_in_byte,
|
||||
const uint32_t* buffer, const uint32_t length_in_word );
|
||||
|
||||
/*!
|
||||
* @brief Software reset of the chip.
|
||||
*
|
||||
* This method should be used to reboot the chip in a specified mode.
|
||||
* Rebooting in flash mode presumes that the content in flash memory is not corrupted (i.e. the integrity check
|
||||
* performed by the bootloader before executing the first instruction in flash is OK).
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] stay_in_bootloader Selector to stay in bootloader or execute flash code after reboot. If true, the
|
||||
* bootloader will not execute the flash code but activate SPI interface to allow firmware upgrade
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_reboot( const void* context, const bool stay_in_bootloader );
|
||||
|
||||
/*!
|
||||
* @brief Returns the 4-byte PIN which can be used to claim a device on cloud services.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] pin Pointer to the array to be populated with the PIN
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_read_pin( const void* context, lr11xx_bootloader_pin_t pin );
|
||||
|
||||
/*!
|
||||
* @brief Read and return the Chip EUI
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] chip_eui The buffer to be filled with chip EUI of the LR11XX. It is up to the application to ensure
|
||||
* chip_eui is long enough to hold the chip EUI
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_read_chip_eui( const void* context, lr11xx_bootloader_chip_eui_t chip_eui );
|
||||
|
||||
/*!
|
||||
* @brief Read and return the Join EUI
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] join_eui The buffer to be filled with Join EUI of the LR11XX. It is up to the application to ensure
|
||||
* join_eui is long enough to hold the join EUI
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_bootloader_read_join_eui( const void* context, lr11xx_bootloader_join_eui_t join_eui );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_BOOTLOADER_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
179
components/esp_lora_1121/include/lr11xx_driver/lr11xx_bootloader_types.h
Executable file
179
components/esp_lora_1121/include/lr11xx_driver/lr11xx_bootloader_types.h
Executable file
@@ -0,0 +1,179 @@
|
||||
/*!
|
||||
* @file lr11xx_bootloader_types.h
|
||||
*
|
||||
* @brief Bootloader driver types for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_BOOTLOADER_TYPES_H
|
||||
#define LR11XX_BOOTLOADER_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Length in byte of the LR11XX version blob
|
||||
*/
|
||||
#define LR11XX_BL_VERSION_LENGTH ( 4 )
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a PIN
|
||||
*/
|
||||
#define LR11XX_BL_PIN_LENGTH ( 4 )
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a chip EUI
|
||||
*/
|
||||
#define LR11XX_BL_CHIP_EUI_LENGTH ( 8 )
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a join EUI
|
||||
*/
|
||||
#define LR11XX_BL_JOIN_EUI_LENGTH ( 8 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Fixed-length array to store a PIN
|
||||
*/
|
||||
typedef uint8_t lr11xx_bootloader_pin_t[LR11XX_BL_PIN_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Fixed-length array to store a chipEUI
|
||||
*/
|
||||
typedef uint8_t lr11xx_bootloader_chip_eui_t[LR11XX_BL_CHIP_EUI_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Fixed-length array to store a joinEUI
|
||||
*/
|
||||
typedef uint8_t lr11xx_bootloader_join_eui_t[LR11XX_BL_JOIN_EUI_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Chip modes
|
||||
*/
|
||||
typedef enum lr11xx_bootloader_chip_modes_e
|
||||
{
|
||||
LR11XX_BOOTLOADER_CHIP_MODE_SLEEP = 0x00,
|
||||
LR11XX_BOOTLOADER_CHIP_MODE_STBY_RC = 0x01,
|
||||
LR11XX_BOOTLOADER_CHIP_MODE_STBY_XOSC = 0x02,
|
||||
LR11XX_BOOTLOADER_CHIP_MODE_FS = 0x03,
|
||||
LR11XX_BOOTLOADER_CHIP_MODE_RX = 0x04,
|
||||
LR11XX_BOOTLOADER_CHIP_MODE_TX = 0x05,
|
||||
LR11XX_BOOTLOADER_CHIP_MODE_LOC = 0x06,
|
||||
} lr11xx_bootloader_chip_modes_t;
|
||||
|
||||
/*!
|
||||
* @brief Reset status
|
||||
*/
|
||||
typedef enum lr11xx_bootloader_reset_status_e
|
||||
{
|
||||
LR11XX_BOOTLOADER_RESET_STATUS_CLEARED = 0x00,
|
||||
LR11XX_BOOTLOADER_RESET_STATUS_ANALOG = 0x01,
|
||||
LR11XX_BOOTLOADER_RESET_STATUS_EXTERNAL = 0x02,
|
||||
LR11XX_BOOTLOADER_RESET_STATUS_SYSTEM = 0x03,
|
||||
LR11XX_BOOTLOADER_RESET_STATUS_WATCHDOG = 0x04,
|
||||
LR11XX_BOOTLOADER_RESET_STATUS_IOCD_RESTART = 0x05,
|
||||
LR11XX_BOOTLOADER_RESET_STATUS_RTC_RESTART = 0x06,
|
||||
} lr11xx_bootloader_reset_status_t;
|
||||
|
||||
/*!
|
||||
* @brief Command status
|
||||
*/
|
||||
typedef enum lr11xx_bootloader_command_status_e
|
||||
{
|
||||
LR11XX_BOOTLOADER_CMD_STATUS_FAIL = 0x00,
|
||||
LR11XX_BOOTLOADER_CMD_STATUS_PERR = 0x01,
|
||||
LR11XX_BOOTLOADER_CMD_STATUS_OK = 0x02,
|
||||
LR11XX_BOOTLOADER_CMD_STATUS_DATA = 0x03,
|
||||
} lr11xx_bootloader_command_status_t;
|
||||
|
||||
/*!
|
||||
* @brief Status register 1 structure definition
|
||||
*/
|
||||
typedef struct lr11xx_bootloader_stat1_s
|
||||
{
|
||||
lr11xx_bootloader_command_status_t command_status;
|
||||
bool is_interrupt_active;
|
||||
} lr11xx_bootloader_stat1_t;
|
||||
|
||||
/*!
|
||||
* @brief Status register 2 structure definition
|
||||
*/
|
||||
typedef struct lr11xx_bootloader_stat2_s
|
||||
{
|
||||
lr11xx_bootloader_reset_status_t reset_status;
|
||||
lr11xx_bootloader_chip_modes_t chip_mode;
|
||||
bool is_running_from_flash;
|
||||
} lr11xx_bootloader_stat2_t;
|
||||
|
||||
/*!
|
||||
* @brief Bootloader version structure definition
|
||||
*/
|
||||
typedef struct lr11xx_bootloader_version_s
|
||||
{
|
||||
uint8_t hw;
|
||||
uint8_t type;
|
||||
uint16_t fw;
|
||||
} lr11xx_bootloader_version_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_BOOTLOADER_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
342
components/esp_lora_1121/include/lr11xx_driver/lr11xx_crypto_engine.h
Executable file
342
components/esp_lora_1121/include/lr11xx_driver/lr11xx_crypto_engine.h
Executable file
@@ -0,0 +1,342 @@
|
||||
/*!
|
||||
* @file lr11xx_crypto_engine.h
|
||||
*
|
||||
* @brief Cryptographic engine driver definition for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_CRYPTO_ENGINE_H
|
||||
#define LR11XX_CRYPTO_ENGINE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "lr11xx_crypto_engine_types.h"
|
||||
#include "lr11xx_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Select the crypto element to be used
|
||||
*
|
||||
* By default, the internal crypto engine is selected. It is not needed to call this command if one plans to use the
|
||||
* internal crypto engine.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] element The type of crypto element to use
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_select( const void* context, const lr11xx_crypto_element_t element );
|
||||
|
||||
/*!
|
||||
* @brief Set a key in the previously selected crypto element.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] key_id The identifier of the key to be set
|
||||
* @param [in] key The key to be set
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_derive_key
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_set_key( const void* context, lr11xx_crypto_status_t* status, const uint8_t key_id,
|
||||
const lr11xx_crypto_key_t key );
|
||||
|
||||
/*!
|
||||
* @brief Derive a key previously set.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] src_key_id The identifier of the key to be derived
|
||||
* @param [in] dest_key_id The identifier where the derived key will be stored after call to @ref
|
||||
* lr11xx_crypto_store_to_flash
|
||||
* @param [in] nonce The nonce to be used to perform the derivation
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_set_key
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_derive_key( const void* context, lr11xx_crypto_status_t* status, const uint8_t src_key_id,
|
||||
const uint8_t dest_key_id, const lr11xx_crypto_nonce_t nonce );
|
||||
|
||||
/*!
|
||||
* @brief Perform the needed operations to extract the payload from a join accept message.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] dec_key_id The identifier of the key used for message decryption
|
||||
* @param [in] ver_key_id The identifier of the key used for MIC verification
|
||||
* @param [in] lorawan_version LoRaWAN version to know the size of the header
|
||||
* @param [in] header The header to compute (length linked to lorawan_version)
|
||||
* @param [in] data The data to compute
|
||||
* @param [in] length The length in bytes of the data to compute
|
||||
* @param [out] data_out Placeholder for the decrypted data
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_process_join_accept( const void* context, lr11xx_crypto_status_t* status,
|
||||
const uint8_t dec_key_id, const uint8_t ver_key_id,
|
||||
const lr11xx_crypto_lorawan_version_t lorawan_version,
|
||||
const uint8_t* header, const uint8_t* data, const uint8_t length,
|
||||
uint8_t* data_out );
|
||||
|
||||
/*!
|
||||
* @brief Compute an AES-CMAC.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] key_id The identifier of the keyused for the computation
|
||||
* @param [in] data The data to compute
|
||||
* @param [in] length The length in bytes of the data to compute
|
||||
* @param [out] mic Placeholder for the computed MIC (first 4 bytes of the AES-CMAC)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_verify_aes_cmac
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_compute_aes_cmac( const void* context, lr11xx_crypto_status_t* status,
|
||||
const uint8_t key_id, const uint8_t* data, const uint16_t length,
|
||||
lr11xx_crypto_mic_t mic );
|
||||
|
||||
/*!
|
||||
* @brief Compute an AES-CMAC and make a comparison with a value given as parameter.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] key_id The identifier of the key to be used for the computation
|
||||
* @param [in] data The data to compute
|
||||
* @param [in] length The length in bytes of the data to compute
|
||||
* @param [in] mic The MIC value (first 4 bytes of the CMAC) use for comparison
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_compute_aes_cmac
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_verify_aes_cmac( const void* context, lr11xx_crypto_status_t* status,
|
||||
const uint8_t key_id, const uint8_t* data, const uint16_t length,
|
||||
const lr11xx_crypto_mic_t mic );
|
||||
|
||||
/*!
|
||||
* @brief Compute an AES encryption with a key ID specified in parameter.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] key_id The identifier of the key to be used for the computation
|
||||
* @param [in] data The data to encrypt
|
||||
* @param [in] length The length in bytes of the data to encrypt - this value shall be a multiple of 16
|
||||
* @param [out] result A pointer to a data buffer that will be filled with the encrypted data. Values of this buffer are
|
||||
* meaningful if and only if the return status is LR11XX_CRYPTO_STATUS_SUCCESS
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_set_key, lr11xx_crypto_derive_key
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_aes_encrypt_01( const void* context, lr11xx_crypto_status_t* status, const uint8_t key_id,
|
||||
const uint8_t* data, const uint16_t length, uint8_t* result );
|
||||
|
||||
/*!
|
||||
* @brief Compute an AES encryption with a key ID specified in parameter.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] key_id The identifier of the key to be used for the computation
|
||||
* @param [in] data The data to encrypt
|
||||
* @param [in] length The length in bytes of the data to encrypt - this value shall be a multiple of 16
|
||||
* @param [out] result A pointer to a data buffer that will be filled with the encrypted data. Values of this buffer are
|
||||
* meaningful if and only if the return status is LR11XX_CRYPTO_STATUS_SUCCESS
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_set_key, lr11xx_crypto_derive_key
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_aes_encrypt( const void* context, lr11xx_crypto_status_t* status, const uint8_t key_id,
|
||||
const uint8_t* data, const uint16_t length, uint8_t* result );
|
||||
|
||||
/*!
|
||||
* @brief Compute an AES decryption with a key ID specified in parameter.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] key_id The identifier of the key to be used for the computation
|
||||
* @param [in] data The data to decrypt
|
||||
* @param [in] length The length in bytes of the data to decrypt - this value shall be a multiple of 16
|
||||
* @param [out] result A pointer to a data buffer that will be filled with the decrypted data. Values of this buffer are
|
||||
* meaningful if and only if the return status is LR11XX_CRYPTO_STATUS_SUCCESS
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_set_key, lr11xx_crypto_derive_key
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_aes_decrypt( const void* context, lr11xx_crypto_status_t* status, const uint8_t key_id,
|
||||
const uint8_t* data, const uint16_t length, uint8_t* result );
|
||||
|
||||
/*!
|
||||
* @brief Store the crypto data (keys, parameters) from RAM into the flash memory.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_restore_from_flash
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_store_to_flash( const void* context, lr11xx_crypto_status_t* status );
|
||||
|
||||
/*!
|
||||
* @brief Restore the crypto data (keys, parameters) from flash memory into RAM.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_store_to_flash
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_restore_from_flash( const void* context, lr11xx_crypto_status_t* status );
|
||||
|
||||
/*!
|
||||
* @brief Set a specific parameter identified by param_id in the crypto RAM.
|
||||
*
|
||||
* This function does not store a parameter in the flash memory. The parameters shall be stored after using @ref
|
||||
* lr11xx_crypto_store_to_flash command.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] param_id The identifier of the parameter to be set
|
||||
* @param [in] parameter The parameter to be set
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_get_parameter
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_set_parameter( const void* context, lr11xx_crypto_status_t* status,
|
||||
const uint8_t param_id, const lr11xx_crypto_param_t parameter );
|
||||
|
||||
/*!
|
||||
* @brief Get a specific parameter identified by paramID from the crypto RAM.
|
||||
*
|
||||
* This function does not fetch a parameter from the flash memory. The parameters shall be restored before using @ref
|
||||
* lr11xx_crypto_restore_from_flash command.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] status The status returned by the execution of this cryptographic function
|
||||
* @param [in] param_id The identifier of the parameter to get
|
||||
* @param [out] parameter The placeholder to store the parameter
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_crypto_set_parameter
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_get_parameter( const void* context, lr11xx_crypto_status_t* status,
|
||||
const uint8_t param_id, lr11xx_crypto_param_t parameter );
|
||||
|
||||
/*!
|
||||
* @brief Check if an encrypted firmware image is suitable for the transceiver on which the check is done
|
||||
*
|
||||
* @remark The result can be read by calling @ref lr11xx_crypto_get_check_encrypted_firmware_image_result
|
||||
*
|
||||
* @remark A user checks the suitability of a firmware image by calling this function with 64-word long chunk of data
|
||||
* sent in-order (except for the last one that can be shorter).
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] offset_in_byte Offset of data buffer in firmware image - has to be a multiple of 4
|
||||
* @param [in] data Buffer holding the encrypted content. Its size in words must be at least length
|
||||
* @param [in] length_in_word Number of words (i.e. 4 bytes) in the buffer to transfer. This value must be in the range
|
||||
* [0:64]
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_check_encrypted_firmware_image( const void* context, const uint32_t offset_in_byte,
|
||||
const uint32_t* data, const uint8_t length_in_word );
|
||||
|
||||
/*!
|
||||
* @brief Check if an encrypted firmware image is suitable for the transceiver on which the check is done
|
||||
*
|
||||
* @remark The result can be read by calling @ref lr11xx_crypto_get_check_encrypted_firmware_image_result
|
||||
*
|
||||
* @remark This function is developed on top of @ref lr11xx_crypto_check_encrypted_firmware_image and takes care of the
|
||||
* whole firmware image transfer
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] offset_in_byte Offset of data buffer in firmware image - has to be a multiple of 4
|
||||
* @param [in] data Buffer holding the encrypted content. Its size in words must be at least length
|
||||
* @param [in] length_in_word Number of words (i.e. 4 bytes) in the buffer to transfer
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_check_encrypted_firmware_image_full( const void* context, const uint32_t offset_in_byte,
|
||||
const uint32_t* data,
|
||||
const uint32_t length_in_word );
|
||||
|
||||
/*!
|
||||
* @brief Get the result of the encrypted firmware image check
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] is_encrypted_fw_image_ok Result of the encrypted firmware image check
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_crypto_get_check_encrypted_firmware_image_result( const void* context,
|
||||
bool* is_encrypted_fw_image_ok );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_CRYPTO_ENGINE_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
199
components/esp_lora_1121/include/lr11xx_driver/lr11xx_crypto_engine_types.h
Executable file
199
components/esp_lora_1121/include/lr11xx_driver/lr11xx_crypto_engine_types.h
Executable file
@@ -0,0 +1,199 @@
|
||||
/*!
|
||||
* @file lr11xx_crypto_engine_types.h
|
||||
*
|
||||
* @brief Cryptographic engine driver types for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_CRYPTO_ENGINE_TYPES_H
|
||||
#define LR11XX_CRYPTO_ENGINE_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a MIC
|
||||
*/
|
||||
#define LR11XX_CRYPTO_MIC_LENGTH 0x04
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a AES CMAC
|
||||
*/
|
||||
#define LR11XX_CRYPTO_AES_CMAC_LENGTH 0x10
|
||||
|
||||
/*!
|
||||
* @brief Maximum length in bytes of data to be encrypted / decrypted
|
||||
*/
|
||||
#define LR11XX_CRYPTO_DATA_MAX_LENGTH 0x0100
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a key for AES computation
|
||||
*/
|
||||
#define LR11XX_CRYPTO_KEY_LENGTH 0x10
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a nonce
|
||||
*/
|
||||
#define LR11XX_CRYPTO_NONCE_LENGTH 0x10
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of a crypto parameter
|
||||
*/
|
||||
#define LR11XX_CRYPTO_PARAMETER_LENGTH 0x04
|
||||
|
||||
/*!
|
||||
* @brief Length in bytes of the status returned by an API
|
||||
*/
|
||||
#define LR11XX_CRYPTO_STATUS_LENGTH 0x01
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Fixed-length array to store an AES CMAC
|
||||
*/
|
||||
typedef uint8_t lr11xx_crypto_mic_t[LR11XX_CRYPTO_MIC_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Fixed-length array to store an AES CMAC
|
||||
*/
|
||||
typedef uint8_t lr11xx_crypto_aes_cmac_t[LR11XX_CRYPTO_AES_CMAC_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Fixed-length array to store a crypto key
|
||||
*/
|
||||
typedef uint8_t lr11xx_crypto_key_t[LR11XX_CRYPTO_KEY_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Fixed-length array to store a crypto nonce
|
||||
*/
|
||||
typedef uint8_t lr11xx_crypto_nonce_t[LR11XX_CRYPTO_NONCE_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Fixed-length array to store a crypto parameter
|
||||
*/
|
||||
typedef uint8_t lr11xx_crypto_param_t[LR11XX_CRYPTO_PARAMETER_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief The supported crypto elements
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_CRYPTO_ELEMENT_CRYPTO_ENGINE = 0x00, //!< Internal crypto engine (default)
|
||||
LR11XX_CRYPTO_ELEMENT_SECURE_ELEMENT = 0x01, //!< External secure element
|
||||
} lr11xx_crypto_element_t;
|
||||
|
||||
/*!
|
||||
* @brief The status returned by the crypto API
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_CRYPTO_STATUS_SUCCESS = 0x00, //!< The API command was successful
|
||||
LR11XX_CRYPTO_STATUS_ERROR_FAIL_CMAC = 0x01, //!< AES-CMAC invalid or comparison failed
|
||||
LR11XX_CRYPTO_STATUS_ERROR_INVALID_KEY_ID = 0x03, //!< Invalid key ID (source, destination)
|
||||
LR11XX_CRYPTO_STATUS_ERROR_BUFFER_SIZE = 0x05, //!< Invalid data buffer size
|
||||
LR11XX_CRYPTO_STATUS_ERROR = 0x06, //!< Other error
|
||||
} lr11xx_crypto_status_t;
|
||||
|
||||
/*!
|
||||
* @brief The supported LoRaWAN versions
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_CRYPTO_LORAWAN_VERSION_1_0_X = 0x00,
|
||||
LR11XX_CRYPTO_LORAWAN_VERSION_1_1_X = 0x01,
|
||||
} lr11xx_crypto_lorawan_version_t;
|
||||
|
||||
/*!
|
||||
* @brief Crypto keys table index definition.
|
||||
*/
|
||||
typedef enum lr11xx_crypto_keys_idx_e
|
||||
{
|
||||
LR11XX_CRYPTO_KEYS_IDX_MOTHER_KEY = 1,
|
||||
LR11XX_CRYPTO_KEYS_IDX_NWK_KEY = 2,
|
||||
LR11XX_CRYPTO_KEYS_IDX_APP_KEY = 3,
|
||||
LR11XX_CRYPTO_KEYS_IDX_J_S_ENC_KEY = 4,
|
||||
LR11XX_CRYPTO_KEYS_IDX_J_S_INT_KEY = 5,
|
||||
LR11XX_CRYPTO_KEYS_IDX_GP_KE_KEY_0 = 6,
|
||||
LR11XX_CRYPTO_KEYS_IDX_GP_KE_KEY_1 = 7,
|
||||
LR11XX_CRYPTO_KEYS_IDX_GP_KE_KEY_2 = 8,
|
||||
LR11XX_CRYPTO_KEYS_IDX_GP_KE_KEY_3 = 9,
|
||||
LR11XX_CRYPTO_KEYS_IDX_GP_KE_KEY_4 = 10,
|
||||
LR11XX_CRYPTO_KEYS_IDX_GP_KE_KEY_5 = 11,
|
||||
LR11XX_CRYPTO_KEYS_IDX_APP_S_KEY = 12,
|
||||
LR11XX_CRYPTO_KEYS_IDX_F_NWK_S_INT_KEY = 13,
|
||||
LR11XX_CRYPTO_KEYS_IDX_S_NWK_S_INT_KEY = 14,
|
||||
LR11XX_CRYPTO_KEYS_IDX_NWK_S_ENC_KEY = 15,
|
||||
LR11XX_CRYPTO_KEYS_IDX_RFU_0 = 16,
|
||||
LR11XX_CRYPTO_KEYS_IDX_RFU_1 = 17,
|
||||
LR11XX_CRYPTO_KEYS_IDX_MC_APP_S_KEY_0 = 18,
|
||||
LR11XX_CRYPTO_KEYS_IDX_MC_APP_S_KEY_1 = 19,
|
||||
LR11XX_CRYPTO_KEYS_IDX_MC_APP_S_KEY_2 = 20,
|
||||
LR11XX_CRYPTO_KEYS_IDX_MC_APP_S_KEY_3 = 21,
|
||||
LR11XX_CRYPTO_KEYS_IDX_MC_NWK_S_KEY_0 = 22,
|
||||
LR11XX_CRYPTO_KEYS_IDX_MC_NWK_S_KEY_1 = 23,
|
||||
LR11XX_CRYPTO_KEYS_IDX_MC_NWK_S_KEY_2 = 24,
|
||||
LR11XX_CRYPTO_KEYS_IDX_MC_NWK_S_KEY_3 = 25,
|
||||
LR11XX_CRYPTO_KEYS_IDX_GP0 = 26,
|
||||
LR11XX_CRYPTO_KEYS_IDX_GP1 = 27,
|
||||
} lr11xx_crypto_keys_idx_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_CRYPTO_ENGINE_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
90
components/esp_lora_1121/include/lr11xx_driver/lr11xx_driver_version.h
Executable file
90
components/esp_lora_1121/include/lr11xx_driver/lr11xx_driver_version.h
Executable file
@@ -0,0 +1,90 @@
|
||||
/*!
|
||||
* @file lr11xx_driver_version.h
|
||||
*
|
||||
* @brief Placeholder to keep the version of LR11XX driver.
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_DRIVER_VERSION_H
|
||||
#define LR11XX_DRIVER_VERSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define LR11XX_DRIVER_VERSION_MAJOR 2
|
||||
#define LR11XX_DRIVER_VERSION_MINOR 4
|
||||
#define LR11XX_DRIVER_VERSION_PATCH 1
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Compare version information with current ones
|
||||
*
|
||||
* This macro expands to true boolean value if the version information provided in argument is compatible or
|
||||
* retro-compatible with the version of this code base
|
||||
*/
|
||||
#define LR11XX_DRIVER_VERSION_CHECK( x, y, z ) \
|
||||
( x == LR11XX_DRIVER_VERSION_MAJOR && \
|
||||
( y < LR11XX_DRIVER_VERSION_MINOR || \
|
||||
( y == LR11XX_DRIVER_VERSION_MINOR && z <= LR11XX_DRIVER_VERSION_PATCH ) ) )
|
||||
|
||||
const char* lr11xx_driver_version_get_version_string( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_DRIVER_VERSION_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
757
components/esp_lora_1121/include/lr11xx_driver/lr11xx_gnss.h
Executable file
757
components/esp_lora_1121/include/lr11xx_driver/lr11xx_gnss.h
Executable file
@@ -0,0 +1,757 @@
|
||||
/*!
|
||||
* @file lr11xx_gnss.h
|
||||
*
|
||||
* @brief GNSS scan driver definition for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_GNSS_H
|
||||
#define LR11XX_GNSS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "lr11xx_gnss_types.h"
|
||||
#include "lr11xx_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Get the size of results
|
||||
*
|
||||
* This method returns the size in bytes of the results available in LR11XX result buffer.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] result_size Result size
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_get_result_size( const void* context, uint16_t* result_size );
|
||||
|
||||
/*!
|
||||
* @brief Read GNSS results
|
||||
*
|
||||
* The GNSS results are pushed into a buffer directly. This buffer is provided by the application using the driver. It
|
||||
* MUST be long enough to contains at least result_buffer_size bytes.
|
||||
*
|
||||
* @warning No check is done on result_buffer size. If this application provided buffer is too small, there will be a
|
||||
* buffer overflow bug!
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] result_buffer Application provided buffer to be filled with result
|
||||
* @param [in] result_buffer_size The number of bytes to read from the LR11XX
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_results( const void* context, uint8_t* result_buffer,
|
||||
const uint16_t result_buffer_size );
|
||||
|
||||
/*!
|
||||
* @brief Update almanacs given as parameter
|
||||
*
|
||||
* @remark Note that information header and almanacs for all 128 SV (i.e. 129 20-byte long blocks) must be updated in a
|
||||
* row for the whole operation to be successful. Therefore, this function must be called as many times as needed without
|
||||
* any other operations in between.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] blocks Buffer containing at least (nb_of_blocks * LR11XX_GNSS_SINGLE_ALMANAC_WRITE_SIZE) bytes of almanac
|
||||
* @param [in] nb_of_blocks Number of blocks to transfer
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_almanac_update( const void* context, const uint8_t* blocks, const uint8_t nb_of_blocks );
|
||||
|
||||
/*!
|
||||
* @brief Read the almanac
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] almanac_bytestream The bytestream of the almanac
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_almanac( const void* context,
|
||||
lr11xx_gnss_almanac_full_read_bytestream_t almanac_bytestream );
|
||||
|
||||
/*!
|
||||
* @brief Function to read the frequency search space around the Doppler frequency
|
||||
*
|
||||
* @param [in] radio Radio abstraction
|
||||
* @param [out] freq_search_space Frequency search space configuration read from the chip
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_freq_search_space( const void* radio,
|
||||
lr11xx_gnss_freq_search_space_t* freq_search_space );
|
||||
|
||||
/*!
|
||||
* @brief Function to set the frequency search space around the Doppler frequency
|
||||
*
|
||||
* @param [in] radio Radio abstraction
|
||||
* @param [in] freq_search_space Frequency search space configuration to be applied
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_set_freq_search_space( const void* radio,
|
||||
const lr11xx_gnss_freq_search_space_t freq_search_space );
|
||||
|
||||
/*!
|
||||
* @brief Get almanac age for a satellite
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] sv_id ID of the satellite corresponding the to almanac requested
|
||||
* @param [out] almanac_age Almanac age in days since last GPS time overlap
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_get_almanac_age_for_satellite( const void* context, const lr11xx_gnss_satellite_id_t sv_id,
|
||||
uint16_t* almanac_age );
|
||||
|
||||
/*!
|
||||
* @brief Push data received from solver to LR11XX
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] payload Payload received from solver
|
||||
* @param [in] payload_size Size of the payload received from solver (in bytes)
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_push_solver_msg( const void* context, const uint8_t* payload, const uint16_t payload_size );
|
||||
|
||||
/**
|
||||
* @brief Return the theoretical number of visible satellites based on the given parameters.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] date The actual date of scan. Its format is the number of seconds elapsed since January the 6th 1980
|
||||
* 00:00:00 with leap seconds included.
|
||||
* @param [in] assistance_position, latitude 12 bits and longitude 12 bits
|
||||
* @param [in] constellation Bit mask of the constellations to use. See @ref lr11xx_gnss_constellation_t for
|
||||
* the possible values
|
||||
* @param [out] nb_visible_sv theoretical number of visible satellites
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_get_nb_visible_satellites(
|
||||
const void* context, const lr11xx_gnss_date_t date,
|
||||
const lr11xx_gnss_solver_assistance_position_t* assistance_position,
|
||||
const lr11xx_gnss_constellation_t constellation, uint8_t* nb_visible_sv );
|
||||
|
||||
/**
|
||||
* @brief Return the theoretical doppler information of theoretical visible satellites, this function shall be called
|
||||
* after lr11xx_gnss_get_nb_visible_satellites function.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] nb_visible_satellites number of visible satellites returned by lr11xx_gnss_get_nb_visible_satellites
|
||||
* function,
|
||||
* @param [out] visible_satellite_id_doppler Doppler information of each satellite.
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_get_visible_satellites( const void* context, const uint8_t nb_visible_satellites,
|
||||
lr11xx_gnss_visible_satellite_t* visible_satellite_id_doppler );
|
||||
|
||||
/*!
|
||||
* @brief Activate the GNSS scan constellation
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] constellation_mask Bit mask of the constellations to use. See @ref lr11xx_gnss_constellation_t for
|
||||
* the possible values
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_gnss_read_used_constellations
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_set_constellations_to_use( const void* context,
|
||||
const lr11xx_gnss_constellation_mask_t constellation_mask );
|
||||
|
||||
/*!
|
||||
* @brief Read constellation used by the GNSS scanner from the almanac update configuration
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] constellations_used Bit mask of the constellations used. See @ref lr11xx_gnss_constellation_t for the
|
||||
* possible values
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_gnss_set_constellations_to_use
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_used_constellations( const void* context,
|
||||
lr11xx_gnss_constellation_mask_t* constellations_used );
|
||||
|
||||
/*!
|
||||
* @brief Activate the almanac update
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] constellations_to_update Bit mask of the constellations to mark to update. See @ref
|
||||
* lr11xx_gnss_constellation_t for the possible values
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_set_almanac_update( const void* context,
|
||||
const lr11xx_gnss_constellation_mask_t constellations_to_update );
|
||||
|
||||
/*!
|
||||
* @brief Function to read the almanac update configuration
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] constellations_to_update Bit mask of the constellations to mark to update. See @ref
|
||||
* lr11xx_gnss_constellation_t for the possible values
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_almanac_update( const void* context,
|
||||
lr11xx_gnss_constellation_mask_t* constellations_to_update );
|
||||
|
||||
/*!
|
||||
* @brief Function to read the GNSS firmware version
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] version GNSS Firmware version currently running on the chip
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_firmware_version( const void* context, lr11xx_gnss_version_t* version );
|
||||
|
||||
/*!
|
||||
* @brief Function to read the supported constellation, GPS or BEIDOU other constellations
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] supported_constellations Bit mask of the constellations used. See @ref lr11xx_gnss_constellation_t for
|
||||
* the possible values
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_supported_constellations( const void* context,
|
||||
lr11xx_gnss_constellation_mask_t* supported_constellations );
|
||||
|
||||
/*!
|
||||
* @brief Function to set the GNSS scan mode configuration
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] scan_mode GNSS scan mode
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_gnss_scan_mode_t
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_set_scan_mode( const void* context, const lr11xx_gnss_scan_mode_t scan_mode );
|
||||
|
||||
/*!
|
||||
* @brief Start the gnss scan
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] effort_mode Effort mode @ref lr11xx_gnss_search_mode_t
|
||||
* @param [in] gnss_input_parameters Bit mask indicating which information is added in the output payload @ref
|
||||
* lr11xx_gnss_result_fields_e
|
||||
* @param [in] nb_sat The expected number of satellite to provide. This value must be in the range [0:128]
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_scan( const void* context, const lr11xx_gnss_search_mode_t effort_mode,
|
||||
const uint8_t gnss_input_parameters, const uint8_t nb_sat );
|
||||
|
||||
/*!
|
||||
* @brief Function to set the assistance position.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] assistance_position, latitude 12 bits and longitude 12 bits
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_gnss_solver_assistance_position_t
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_set_assistance_position(
|
||||
const void* context, const lr11xx_gnss_solver_assistance_position_t* assistance_position );
|
||||
|
||||
/*!
|
||||
* @brief Function to read the assistance position.
|
||||
*
|
||||
* The assistance position read may be different from the one set beforehand with @ref
|
||||
* lr11xx_gnss_set_assistance_position due to a scaling computation.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] assistance_position, latitude 12 bits and longitude 12 bits
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_gnss_solver_assistance_position_t
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_assistance_position( const void* context,
|
||||
lr11xx_gnss_solver_assistance_position_t* assistance_position );
|
||||
|
||||
/*!
|
||||
* @brief Host receives an update from the network or assembles itself the update message and send it to the LR11XX.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] dmc_msg buffer containing the update the network
|
||||
* @param [in] dmc_msg_len length of this buffer
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_push_dmc_msg( const void* context, uint8_t* dmc_msg, uint16_t dmc_msg_len );
|
||||
|
||||
/*!
|
||||
* @brief Get the GNSS context status
|
||||
*
|
||||
* This function returns the GNSS context status as a raw buffer. It is possible to use
|
||||
* lr11xx_gnss_parse_context_status_buffer to obtain the details of the context status.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] context_status_buffer Pointer to a buffer to be filled with context status information. Must be at least
|
||||
* 7 bytes long. It is up to the caller to ensure there is enough place in this buffer.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_gnss_parse_context_status_buffer
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_get_context_status( const void* context,
|
||||
lr11xx_gnss_context_status_bytestream_t context_status_buffer );
|
||||
|
||||
/*!
|
||||
* @brief Get the number of detected satellites during last scan
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] nb_detected_satellites Number of satellites detected
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_get_nb_detected_satellites( const void* context, uint8_t* nb_detected_satellites );
|
||||
|
||||
/*!
|
||||
* @brief Get the satellites detected on last scan with their IDs, C/N (aka CNR) and doppler
|
||||
*
|
||||
* @note Doppler is returned with 6ppm accuracy.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] nb_detected_satellites Number of detected satellites on last scan (obtained by calling
|
||||
* lr11xx_gnss_get_nb_detected_satellites)
|
||||
* @param [out] detected_satellite_id_snr_doppler Pointer to an array of structures of size big enough to contain
|
||||
* nb_detected_satellites elements
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_get_detected_satellites(
|
||||
const void* context, const uint8_t nb_detected_satellites,
|
||||
lr11xx_gnss_detected_satellite_t* detected_satellite_id_snr_doppler );
|
||||
|
||||
/*!
|
||||
* @brief Read almanacs per satellite range
|
||||
*
|
||||
* @note Doppler is returned with 6ppm accuracy.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] sv_id_init Index of the satellite to start reading almanac from
|
||||
* @param [in] n_sv Number of satellite almanac to read from sv_id_init
|
||||
* @param [out] almanacs Pointer to an array to be filled by almanac data. It is up to the caller to ensure the
|
||||
* available length of almanacs buffer is at least (n_sv * LR11XX_GNSS_SINGLE_ALMANAC_READ_SIZE)
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_almanac_per_satellites( const void* context, uint8_t sv_id_init, uint8_t n_sv,
|
||||
uint8_t* almanacs );
|
||||
|
||||
/*!
|
||||
* @brief Read RSSI on GNSS path
|
||||
*
|
||||
* This is a test function to read RSSI on GNSS path.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] rssi_gnss_dbm RSSI read on GNSS path in dbm
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_gnss_rssi_test( const void* context, int8_t* rssi_gnss_dbm );
|
||||
|
||||
/**
|
||||
* @brief Parse a raw buffer of context status
|
||||
*
|
||||
* @param [in] context_status_bytestream The raw buffer of context status to parse. It is up to the caller to ensure the
|
||||
* buffer is at least LR11XX_GNSS_CONTEXT_STATUS_LENGTH bytes long
|
||||
* @param [out] context_status Pointer to a structure of lr11xx_gnss_context_status_t to be filled with information from
|
||||
* context_status_bytestream
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_gnss_get_context_status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_parse_context_status_buffer(
|
||||
const lr11xx_gnss_context_status_bytestream_t context_status_bytestream,
|
||||
lr11xx_gnss_context_status_t* context_status );
|
||||
|
||||
/**
|
||||
* @brief Extract the destination from the result returned by a GNSS scan
|
||||
*
|
||||
* @param [in] result_buffer Pointer to the buffer holding the result
|
||||
* @param [in] result_buffer_size Size of the result in byte
|
||||
* @param [out] destination Destination of the result
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_get_result_destination( const uint8_t* result_buffer, const uint16_t result_buffer_size,
|
||||
lr11xx_gnss_destination_t* destination );
|
||||
|
||||
/**
|
||||
* @brief Helper function that computes the age of an almanac.
|
||||
*
|
||||
* This function does not call the LR11XX.
|
||||
* The almanac age is computed based on the following elements:
|
||||
* - almanac age as obtained from lr11xx_gnss_get_almanac_age_for_satellite
|
||||
* - the number of days elapsed between Epoch (January 6th 1980) and the GPS rollover reference of the current
|
||||
* almanac
|
||||
* - the GPS date of today expressed in number of days elapsed since Epoch
|
||||
*
|
||||
* @remark It is important to use for nb_days_between_epoch_and_corresponding_gps_time_rollover the GPS time rollover
|
||||
* corresponding to the reference of the almanac_date. This is especially true when current date is just after a GPS
|
||||
* time rollover.
|
||||
*
|
||||
* @param [in] almanac_date Almanac date as obtained from lr11xx_gnss_get_almanac_age_for_satellite
|
||||
* @param [in] nb_days_between_epoch_and_corresponding_gps_time_rollover Number of days elapsed between GPS Epoch and
|
||||
* the GPS rollover corresponding to the almanac_date
|
||||
* @param [in] nb_days_since_epoch Number of days elapsed between January 6th 1980 and now
|
||||
*
|
||||
* @returns Age of the almanac expressed in number of days between its start valid instant and now
|
||||
*/
|
||||
uint16_t lr11xx_gnss_compute_almanac_age( uint16_t almanac_date,
|
||||
uint16_t nb_days_between_epoch_and_corresponding_gps_time_rollover,
|
||||
uint16_t nb_days_since_epoch );
|
||||
|
||||
/*!
|
||||
* @brief Start the time acquisition/domulation.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] effort_mode Effort mode @ref lr11xx_gnss_search_mode_t, note that LR11XX_GNSS_OPTION_HIGH_EFFORT is not
|
||||
* supported here
|
||||
* @param [in] option Fetch time option @ref lr11xx_gnss_fetch_time_option_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_fetch_time( const void* context, const lr11xx_gnss_search_mode_t effort_mode,
|
||||
const lr11xx_gnss_fetch_time_option_t option );
|
||||
/*!
|
||||
* @brief Read time from LR11XX.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] time Structure containing the time \ref lr11xx_gnss_time_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_time( const void* context, lr11xx_gnss_time_t* time );
|
||||
|
||||
/*!
|
||||
* @brief Reset the internal time.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_reset_time( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Reset the location and the history Doppler buffer.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_reset_position( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Read the week number rollover.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] wn_rollover_status Week number rollover status \ref lr11xx_gnss_week_number_rollover_status_t
|
||||
* @param [out] wn_number_rollover Week number rollover since 1980
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_week_number_rollover( const void* context,
|
||||
lr11xx_gnss_week_number_rollover_status_t* wn_rollover_status,
|
||||
uint8_t* wn_number_rollover );
|
||||
|
||||
/*!
|
||||
* @brief Read demod status.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] demod_status Demodulation status \ref lr11xx_gnss_demod_status_t
|
||||
* @param [out] demod_info Demodulation info \ref lr11xx_gnss_demod_info_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_demod_status( const void* context, lr11xx_gnss_demod_status_t* demod_status,
|
||||
lr11xx_gnss_demod_info_t* demod_info );
|
||||
|
||||
/*!
|
||||
* @brief Read cumulative timing.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] cumulative_timing Cumulative timing status \ref lr11xx_gnss_cumulative_timing_t, The value of time is in
|
||||
* counter of 32KhZ, to have it in second, the counter must be divided by 32768
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_cumulative_timing( const void* context,
|
||||
lr11xx_gnss_cumulative_timing_t* cumulative_timing );
|
||||
|
||||
/*!
|
||||
* @brief Compute power consumption based on timings and instantaneous power consumption.
|
||||
*
|
||||
* @param [in] cumulative_timing Timings read from lr11xx_gnss_read_cumulative_timing API \ref
|
||||
* lr11xx_gnss_cumulative_timing_t
|
||||
* @param [in] instantaneous_power_consumption_ua Instantaneous power consumption associated to each timings \ref
|
||||
* lr11xx_gnss_instantaneous_power_consumption_ua_t
|
||||
* @param [out] power_consumption_nah Power consumption computed in nAh
|
||||
* @param [out] power_consumption_nwh Power consumption computed in nWh
|
||||
*/
|
||||
void lr11xx_gnss_compute_power_consumption(
|
||||
const lr11xx_gnss_cumulative_timing_t* cumulative_timing,
|
||||
const lr11xx_gnss_instantaneous_power_consumption_ua_t* instantaneous_power_consumption_ua,
|
||||
uint32_t* power_consumption_nah, uint32_t* power_consumption_nwh );
|
||||
|
||||
/*!
|
||||
* @brief Set the GPS time.
|
||||
*
|
||||
* This command is to be used when the 32kHz clock feeding the LR11xx is turned off.
|
||||
* The LR11xx needs the 32kHz clock to track the absolute time. However if the clock is turned off, it will attempt to
|
||||
* get the absolute time from GNSS SV demodulation on next GNSS scan, which is power consuming.
|
||||
* However, if the MCU has capability to keep the absolute time when 32kHz clock is turned off, then it can use this
|
||||
* command to configure the LR11xx, so that the LR11xx is more power efficient when fetching time from SV signal.
|
||||
*
|
||||
* Typical usage is:
|
||||
* 1. MCU get absolute GPS time from any (possibly not accurate) source (like LoRaWAN network for instance)
|
||||
* 2. On next scan, the MCU turns on the 32kHz clock, uses lr11xx_gnss_set_time to set the time, with an accuracy that
|
||||
* depends on its crystal drift, and start the scan
|
||||
* 3. MCU reads the time from LR11xx (lr11xx_gnss_read_time) and stores it internally
|
||||
* 4. MCU turns off 32kHz clock of the LR11xx
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] time GPS time in sec from 6 January 1980 00:00:00
|
||||
* @param [in] time_accuracy Accuracy in millisecond of the time given. If set to 0, the accuracy of time given is
|
||||
* considered to be unknown
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_set_time( const void* context, const uint32_t time, const uint16_t time_accuracy );
|
||||
|
||||
/*!
|
||||
* @brief Configures the time delay in sec. If the time elapsed from last Assistance position update is larger than this
|
||||
* delay and there is always no SV detected, LR11xx will reset the Assistance position and the GNSS scan switches from
|
||||
* assisted scan to autonomous scan.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] delay Delay in second on 3 bytes
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_config_delay_reset_assistance_position( const void* context, const uint32_t delay );
|
||||
|
||||
/*!
|
||||
* @brief Read the assisted position based on the internal doppler solver executed during lr11xx_gnss_scan or
|
||||
* lr11xx_gnss_almanac_update_from_sat functions.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] results \ref lr11xx_gnss_doppler_solver_result_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_doppler_solver_result( const void* context,
|
||||
lr11xx_gnss_doppler_solver_result_t* results );
|
||||
|
||||
/*!
|
||||
* @brief Read the time delay in sec. If the time elapsed from last Assistance position update is larger than this
|
||||
* delay and there is always no SV detected, LR11xx will reset the Assistance position and the GNSS scan switches from
|
||||
* assisted scan to autonomous scan.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] delay Delay in second on 3 bytes
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_delay_reset_assistance_position( const void* context, uint32_t* delay );
|
||||
|
||||
/*!
|
||||
* @brief This command launches one scan to download from satellite almanac parameters broadcasted in one page by one
|
||||
* constellation.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] constellation_mask Bit mask of the constellations to use. See @ref lr11xx_gnss_constellation_t for
|
||||
* the possible values
|
||||
* @param [in] effort_mode Effort mode @ref lr11xx_gnss_search_mode_t, note that LR11XX_GNSS_OPTION_HIGH_EFFORT is not
|
||||
* supported here
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_almanac_update_from_sat( const void* context,
|
||||
const lr11xx_gnss_constellation_mask_t constellation_mask,
|
||||
const lr11xx_gnss_search_mode_t effort_mode );
|
||||
|
||||
/*!
|
||||
* @brief This command read the number of visible satellites and the time elapsed from last detected satellite list
|
||||
* update of this constellation.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] constellation_mask Bit mask of the constellations to use. See @ref lr11xx_gnss_constellation_t for
|
||||
* the possible values. Only one constellation shall be selected otherwise the command will return an error
|
||||
* @param [out] nb_visible_sat number of visible satellites
|
||||
* @param [out] time_elapsed elapsed from last sv list update in ms
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_keep_sync_status( const void* context,
|
||||
const lr11xx_gnss_constellation_mask_t constellation_mask,
|
||||
uint8_t* nb_visible_sat, uint32_t* time_elapsed );
|
||||
|
||||
/*!
|
||||
* @brief This command returns the actual state of almanac GPS and Beidou.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] almanac_status almanac status for GPS and Beidou @ref lr11xx_gnss_read_almanac_status_t
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_almanac_status( const void* context,
|
||||
lr11xx_gnss_read_almanac_status_t* almanac_status );
|
||||
|
||||
/*!
|
||||
* @brief Configures the almanac update period.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] constellation_mask Bit mask of the constellations to use. See @ref lr11xx_gnss_constellation_t for
|
||||
* the possible values. Only one constellation shall be selected otherwise the command will return an error
|
||||
* @param [in] sv_type sv type to configure. See @ref lr11xx_gnss_sv_type_t for
|
||||
* the possible values. This parameter has no impact when constellation_mask is set to LR11XX_GNSS_GPS_MASK but is value
|
||||
* must be a valid lr11xx_gnss_sv_type_t one
|
||||
* @param [in] period delta in day computed between age of almanac in flash and current day and compared to this period
|
||||
* to indicate to the application during a lr11xx_gnss_read_almanac_status if it must be downloaded
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_config_almanac_update_period( const void* context,
|
||||
const lr11xx_gnss_constellation_mask_t constellation_mask,
|
||||
const lr11xx_gnss_sv_type_t sv_type, const uint16_t period );
|
||||
|
||||
/*!
|
||||
* @brief Read the almanac update period.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] constellation_mask Bit mask of the constellations to use. See @ref lr11xx_gnss_constellation_t for
|
||||
* the possible values. Only one constellation shall be selected otherwise the command will return an error
|
||||
* @param [in] sv_type sv type of satellites to read period from. See @ref lr11xx_gnss_sv_type_t for
|
||||
* the possible values. This parameter has no impact when constellation_mask is set to LR11XX_GNSS_GPS_MASK but is value
|
||||
* must be a valid lr11xx_gnss_sv_type_t one
|
||||
* @param [out] period delta in day computed between age of almanac in flash and current day and compared to this period
|
||||
* to indicate to the application during a lr11xx_gnss_read_almanac_status if it must be downloaded
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_almanac_update_period( const void* context,
|
||||
const lr11xx_gnss_constellation_mask_t constellation_mask,
|
||||
const lr11xx_gnss_sv_type_t sv_type, uint16_t* period );
|
||||
|
||||
/*!
|
||||
* @brief Returns the list of satellite for the next keep sync scan.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] constellation_mask Bit mask of the constellations to use. See @ref lr11xx_gnss_constellation_t for
|
||||
* the possible values. Only one constellation shall be selected otherwise the command will return an error
|
||||
* @param [in] nb_sv_to_get Number of sv to read, the user must call lr11xx_gnss_read_keep_sync_status to know exactly
|
||||
* the number of satellites in the list
|
||||
* @param [out] sv_sync_list list of sync. It is up to the caller to ensure it is at least nb_sv_to_get byte long
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_get_sv_sync( const void* context, const lr11xx_gnss_constellation_mask_t constellation_mask,
|
||||
const uint8_t nb_sv_to_get, uint8_t* sv_sync_list );
|
||||
|
||||
/*!
|
||||
* @brief Configures the ability of the LR11xx to search almanac for each GPS satellites.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] gps_sat_activated_1_32 32-bit bit mask sat activated: sat 1-32 activated (default value: 0xFFFFFFFF)
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_set_gps_bit_mask_sat_activated( const void* context,
|
||||
const uint32_t gps_sat_activated_1_32 );
|
||||
|
||||
/*!
|
||||
* @brief Configures the ability of the LR11xx to search almanac for each Beidou satellites.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] beidou_sat_activated_1_32 32-bit bit mask sat activated: sat 1-32 activated (default value: 0xBFFCBFFF))
|
||||
* @param [in] beidou_sat_activated_33_63 32-bit bit mask sat activated: sat 33-63 activated (default value: 0xC0007FF))
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_set_beidou_bit_mask_sat_activated( const void* context,
|
||||
const uint32_t beidou_sat_activated_1_32,
|
||||
const uint32_t beidou_sat_activated_33_63 );
|
||||
|
||||
/*!
|
||||
* @brief Get the type of scan launched during the last scan
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] last_scan_mode last scan launched. See @ref lr11xx_gnss_scan_mode_launched_t for
|
||||
* the possible values.
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_gnss_read_last_scan_mode_launched( const void* context,
|
||||
lr11xx_gnss_scan_mode_launched_t* last_scan_mode );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_GNSS_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
573
components/esp_lora_1121/include/lr11xx_driver/lr11xx_gnss_types.h
Executable file
573
components/esp_lora_1121/include/lr11xx_driver/lr11xx_gnss_types.h
Executable file
@@ -0,0 +1,573 @@
|
||||
/*!
|
||||
* @file lr11xx_gnss_types.h
|
||||
*
|
||||
* @brief GNSS scan driver types for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_GNSS_TYPES_H
|
||||
#define LR11XX_GNSS_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Maximal buffer size
|
||||
*/
|
||||
#define LR11XX_GNSS_MAX_SIZE_ARRAY 2820 //!< (128sv * 22bytes + 4bytes for CRC)
|
||||
|
||||
/*!
|
||||
* @brief Number of almanacs in full update payload
|
||||
*/
|
||||
#define LR11XX_GNSS_FULL_UPDATE_N_ALMANACS ( 128 )
|
||||
|
||||
/*!
|
||||
* @brief Size of the almanac of a single satellite when reading
|
||||
*/
|
||||
#define LR11XX_GNSS_SINGLE_ALMANAC_READ_SIZE ( 22 )
|
||||
|
||||
/*!
|
||||
* @brief Size of the almanac of a single satellite when writing
|
||||
*/
|
||||
#define LR11XX_GNSS_SINGLE_ALMANAC_WRITE_SIZE ( 20 )
|
||||
|
||||
/*!
|
||||
* @brief Size of the almanac of the GNSS context status buffer
|
||||
*/
|
||||
#define LR11XX_GNSS_CONTEXT_STATUS_LENGTH ( 9 )
|
||||
|
||||
/*!
|
||||
* @brief Size of the whole almanac when reading
|
||||
*/
|
||||
#define LR11XX_GNSS_FULL_ALMANAC_READ_BUFFER_SIZE \
|
||||
( ( LR11XX_GNSS_FULL_UPDATE_N_ALMANACS * LR11XX_GNSS_SINGLE_ALMANAC_READ_SIZE ) + 4 )
|
||||
|
||||
#define LR11XX_GNSS_DMC_ALMANAC_UPDATE_POS ( 1U )
|
||||
#define LR11XX_GNSS_DMC_ALMANAC_UPDATE_GPS_MASK ( 0x01UL << LR11XX_GNSS_DMC_ALMANAC_UPDATE_POS )
|
||||
#define LR11XX_GNSS_DMC_ALMANAC_UPDATE_BEIDOU_MASK ( 0x02UL << LR11XX_GNSS_DMC_ALMANAC_UPDATE_POS )
|
||||
|
||||
#define LR11XX_GNSS_DMC_FREQUENCY_SEARCH_SPACE_MSB_POS ( 0U )
|
||||
#define LR11XX_GNSS_DMC_FREQUENCY_SEARCH_SPACE_MSB_MASK ( 0x01UL << LR11XX_GNSS_DMC_FREQUENCY_SEARCH_SPACE_MSB_POS )
|
||||
|
||||
#define LR11XX_GNSS_DMC_FREQUENCY_SEARCH_SPACE_LSB_POS ( 7U )
|
||||
#define LR11XX_GNSS_DMC_FREQUENCY_SEARCH_SPACE_LSB_MASK ( 0x01UL << LR11XX_GNSS_DMC_FREQUENCY_SEARCH_SPACE_LSB_POS )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Satellite ID type
|
||||
*/
|
||||
typedef uint8_t lr11xx_gnss_satellite_id_t;
|
||||
|
||||
/*!
|
||||
* @brief bit mask indicating which information is added in the output payload
|
||||
*/
|
||||
enum lr11xx_gnss_result_fields_e
|
||||
{
|
||||
LR11XX_GNSS_RESULTS_DOPPLER_ENABLE_MASK = ( 1 << 0 ), //!< Add Doppler information if set
|
||||
LR11XX_GNSS_RESULTS_DOPPLER_MASK = ( 1 << 1 ), //!< Add up to 14 Doppler if set - up to 7 if not. Valid if @ref
|
||||
//!< LR11XX_GNSS_RESULTS_DOPPLER_ENABLE_MASK is set
|
||||
LR11XX_GNSS_RESULTS_BIT_CHANGE_MASK =
|
||||
( 1 << 2 ), //!< Add bit change if set, LR11XX_GNSS_SCAN_MODE_3_SINGLE_SCAN_AND_5_FAST_SCANS mode only
|
||||
LR11XX_GNSS_RESULTS_DEMODULATE_TIME_MASK =
|
||||
( 1 << 3 ), //!< Add time demodulation if set, LR11XX_GNSS_SCAN_MODE_3_SINGLE_SCAN_AND_5_FAST_SCANS mode only
|
||||
LR11XX_GNSS_RESULTS_REMOVE_TIME_FROM_NAV_MASK = ( 1 << 4 ), //!< Remove time from NAV if set
|
||||
LR11XX_GNSS_RESULTS_REMOVE_AP_FROM_NAV_MASK = ( 1 << 5 ), //!< Remove aiding position from NAV if set
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Constellation identifiers
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_GNSS_GPS_MASK = 0x01,
|
||||
LR11XX_GNSS_BEIDOU_MASK = 0x02,
|
||||
} lr11xx_gnss_constellation_t;
|
||||
|
||||
/*!
|
||||
* @brief Bit mask of constellation configurations
|
||||
*
|
||||
* @see lr11xx_gnss_constellation_t
|
||||
*/
|
||||
typedef uint8_t lr11xx_gnss_constellation_mask_t;
|
||||
|
||||
/*!
|
||||
* @brief Search mode for GNSS scan
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_GNSS_OPTION_LOW_EFFORT = 0x00, //!< Search all requested satellites or fail, scan duration is low
|
||||
LR11XX_GNSS_OPTION_MID_EFFORT =
|
||||
0x01, //!< Add additional search if not all satellites are found, scan duration is standard
|
||||
LR11XX_GNSS_OPTION_HIGH_EFFORT =
|
||||
0x02, //!< Add additional search if not all satellites are found, scan duration is very high
|
||||
} lr11xx_gnss_search_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS response type indicates the destination: Host MCU, GNSS solver or GNSS DMC
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_GNSS_DESTINATION_HOST = 0x00, //!< Host MCU
|
||||
LR11XX_GNSS_DESTINATION_SOLVER = 0x01, //!< GNSS Solver
|
||||
LR11XX_GNSS_DESTINATION_DMC = 0x02, //!< GNSS DMC
|
||||
} lr11xx_gnss_destination_t;
|
||||
|
||||
/*!
|
||||
* @brief Message to host indicating the status of the message
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_GNSS_HOST_OK = 0x00,
|
||||
LR11XX_GNSS_HOST_UNEXPECTED_CMD = 0x01,
|
||||
LR11XX_GNSS_HOST_UNIMPLEMENTED_CMD = 0x02,
|
||||
LR11XX_GNSS_HOST_INVALID_PARAMETERS = 0x03,
|
||||
LR11XX_GNSS_HOST_MESSAGE_SANITY_CHECK_ERROR = 0x04,
|
||||
LR11XX_GNSS_HOST_IQ_CAPTURE_FAILS = 0x05,
|
||||
LR11XX_GNSS_HOST_NO_TIME = 0x06,
|
||||
LR11XX_GNSS_HOST_NO_SATELLITE_DETECTED = 0x07,
|
||||
LR11XX_GNSS_HOST_ALMANAC_IN_FLASH_TOO_OLD = 0x08,
|
||||
LR11XX_GNSS_HOST_ALMANAC_UPDATE_FAILS_CRC_ERROR = 0x09,
|
||||
LR11XX_GNSS_HOST_ALMANAC_UPDATE_FAILS_FLASH_INTEGRITY_ERROR = 0x0A,
|
||||
LR11XX_GNSS_HOST_ALMANAC_UPDATE_NOT_ALLOWED = 0x0C,
|
||||
LR11XX_GNSS_HOST_ALMANAC_CRC_ERROR = 0x0D,
|
||||
LR11XX_GNSS_HOST_ALMANAC_VERSION_NOT_SUPPORTED = 0x0E,
|
||||
LR11XX_GNSS_HOST_NOT_ENOUGH_SV_DETECTED_TO_BUILD_A_NAV_MESSAGE = 0x10,
|
||||
LR11XX_GNSS_HOST_TIME_DEMODULATION_FAIL = 0x11,
|
||||
LR11XX_GNSS_HOST_ALMANAC_DEMODULATION_FAIL = 0x12,
|
||||
LR11XX_GNSS_HOST_AT_LEAST_THE_DETECTED_SV_OF_ONE_CONSTELLATION_ARE_DEACTIVATED = 0x13,
|
||||
LR11XX_GNSS_HOST_ASSISTANCE_POSITION_POSSIBLY_WRONG_BUT_FAILS_TO_UPDATE = 0x14,
|
||||
LR11XX_GNSS_HOST_SCAN_ABORTED = 0x15,
|
||||
LR11XX_GNSS_HOST_NAV_MESSAGE_CANNOT_BE_GENERATED_INTERVAL_GREATER_THAN_63_SEC = 0x16,
|
||||
} lr11xx_gnss_message_host_status_t;
|
||||
|
||||
/*!
|
||||
* @brief Message to DMC operation code
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_GNSS_DMC_STATUS = 0x18, //!< Status message in payload
|
||||
} lr11xx_gnss_message_dmc_opcode_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS single or double scan mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_GNSS_SCAN_MODE_0_SINGLE_SCAN_LEGACY = 0x00, //!< Generated NAV message format = NAV3
|
||||
LR11XX_GNSS_SCAN_MODE_3_SINGLE_SCAN_AND_5_FAST_SCANS = 0x03, //!< Generated NAV message format = NAV3
|
||||
} lr11xx_gnss_scan_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS error codes
|
||||
*/
|
||||
typedef enum lr11xx_gnss_error_code_e
|
||||
{
|
||||
LR11XX_GNSS_NO_ERROR = 0,
|
||||
LR11XX_GNSS_ERROR_ALMANAC_TOO_OLD = 1,
|
||||
LR11XX_GNSS_ERROR_UPDATE_CRC_MISMATCH = 2,
|
||||
LR11XX_GNSS_ERROR_UPDATE_FLASH_MEMORY_INTEGRITY = 3,
|
||||
LR11XX_GNSS_ERROR_ALMANAC_UPDATE_NOT_ALLOWED = 4, //!< Impossible to update more than one constellation at a time
|
||||
} lr11xx_gnss_error_code_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS frequency search space
|
||||
*/
|
||||
typedef enum lr11xx_gnss_freq_search_space_e
|
||||
{
|
||||
LR11XX_GNSS_FREQUENCY_SEARCH_SPACE_250_HZ = 0,
|
||||
LR11XX_GNSS_FREQUENCY_SEARCH_SPACE_500_HZ = 1,
|
||||
LR11XX_GNSS_FREQUENCY_SEARCH_SPACE_1_KHZ = 2,
|
||||
LR11XX_GNSS_FREQUENCY_SEARCH_SPACE_2_KHZ = 3,
|
||||
} lr11xx_gnss_freq_search_space_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS fetch time option
|
||||
*/
|
||||
typedef enum lr11xx_gnss_fetch_time_option_e
|
||||
{
|
||||
LR11XX_GNSS_SEARCH_TOW = 0, //!< Fetch the time of week. This option can only be used either after a successful
|
||||
//!< GNSS scan, or after a successful call to lr11xx_gnss_fetch_time with option
|
||||
//!< LR11XX_GNSS_SEARCH_TOW_WN or LR11XX_GNSS_SEARCH_TOW_WN_ROLLOVER
|
||||
LR11XX_GNSS_SEARCH_TOW_WN = 1, //!< Fetch the time of week and the week number
|
||||
LR11XX_GNSS_SEARCH_TOW_WN_ROLLOVER =
|
||||
2, //!< Fetch the time of week, week number and week number rollover since 1980
|
||||
} lr11xx_gnss_fetch_time_option_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS time status
|
||||
*/
|
||||
typedef enum lr11xx_gnss_read_time_status_e
|
||||
{
|
||||
LR11XX_GNSS_READ_TIME_STATUS_NO_ERROR = 0,
|
||||
LR11XX_GNSS_READ_TIME_STATUS_32K_STOPPED = 1,
|
||||
LR11XX_GNSS_READ_TIME_STATUS_WN_TOW_NOT_SET = 2
|
||||
} lr11xx_gnss_read_time_status_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS week number number rollover status
|
||||
*/
|
||||
typedef enum lr11xx_gnss_week_number_rollover_status_e
|
||||
{
|
||||
LR11XX_GNSS_WN_ROLLOVER_ROLLOVER_NEVER_SET = 0,
|
||||
LR11XX_GNSS_WN_ROLLOVER_ROLLOVER_SET_BY_SCAN = 1,
|
||||
} lr11xx_gnss_week_number_rollover_status_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS demod status
|
||||
*/
|
||||
typedef enum lr11xx_gnss_demod_status_e
|
||||
{
|
||||
LR11XX_GNSS_NO_DEMOD_BDS_ALMANAC_SV31_43 = -21,
|
||||
LR11XX_GNSS_SV_SELECTED_FOR_DEMOD_LOST = -20,
|
||||
LR11XX_GNSS_ALMANAC_DEMOD_ERROR = -19,
|
||||
LR11XX_GNSS_WAKE_UP_AFTER_PREAMBLE = -18,
|
||||
LR11XX_GNSS_20MS_REAL_TIME_FAILURE = -17,
|
||||
LR11XX_GNSS_WAKE_UP_SYNC_FAILURE = -16,
|
||||
LR11XX_GNSS_WEEK_NUMBER_NOT_VALIDATED = -15,
|
||||
LR11XX_GNSS_NO_ACTIVATED_SAT_IN_SV_LIST = -14,
|
||||
LR11XX_GNSS_SLEEP_TIME_TOO_LONG = -13,
|
||||
LR11XX_GNSS_WRONG_TIME_OF_WEEK_DEMOD = -12,
|
||||
LR11XX_GNSS_PREAMBLE_NOT_VALIDATED = -11,
|
||||
LR11XX_GNSS_DEMOD_DISABLE = -10,
|
||||
LR11XX_GNSS_DEMOD_EXTRACTION_FAILURE = -9,
|
||||
LR11XX_GNSS_NO_BIT_CHANGE_FOUND_DURING_START_DEMOD = -8,
|
||||
LR11XX_GNSS_NO_BIT_CHANGE_FOUND_DURING_MULTISCAN = -7,
|
||||
LR11XX_GNSS_NO_SAT_FOUND = -6,
|
||||
LR11XX_GNSS_WORD_SYNC_LOST = -5,
|
||||
LR11XX_GNSS_NOT_ENOUGH_PARITY_CHECK_FOUND = -3,
|
||||
LR11XX_GNSS_TOO_MANY_PARITY_CHECK_FOUND = -2,
|
||||
LR11XX_GNSS_NO_PARITY_CHECK_FOUND = -1,
|
||||
LR11XX_GNSS_WORD_SYNC_SEARCH_NOT_STARTED = 0,
|
||||
LR11XX_GNSS_WORD_SYNC_POTENTIALLY_FOUND = 1,
|
||||
LR11XX_GNSS_WORD_SYNC_FOUND = 2,
|
||||
LR11XX_GNSS_TIME_OF_WEEK_FOUND = 3,
|
||||
LR11XX_GNSS_WEEK_NUMBER_FOUND = 4,
|
||||
LR11XX_GNSS_ALMANAC_FOUND_BUT_NO_SAVED = 5,
|
||||
LR11XX_GNSS_HALF_ALMANAC_FOUND_AND_SAVED = 6,
|
||||
LR11XX_GNSS_ALMANAC_FOUND_AND_SAVED = 7,
|
||||
} lr11xx_gnss_demod_status_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS doppler solver error code
|
||||
*/
|
||||
typedef enum lr11xx_gnss_doppler_solver_error_code_e
|
||||
{
|
||||
LR11XX_GNSS_DOPPLER_SOLVER_NO_ERROR = 0,
|
||||
LR11XX_GNSS_DOPPLER_SOLVER_ERROR_RESIDUE_HIGH = 1,
|
||||
LR11XX_GNSS_DOPPLER_SOLVER_ERROR_NOT_CONVERGED = 2,
|
||||
LR11XX_GNSS_DOPPLER_SOLVER_ERROR_NOT_ENOUGH_SV = 3,
|
||||
LR11XX_GNSS_DOPPLER_SOLVER_ERROR_ILL_MATRIX = 4,
|
||||
LR11XX_GNSS_DOPPLER_SOLVER_ERROR_TIME_ERROR = 5,
|
||||
LR11XX_GNSS_DOPPLER_SOLVER_ERROR_PARTIAL_ALMANAC_TOO_OLD = 6,
|
||||
LR11XX_GNSS_DOPPLER_SOLVER_ERROR_NOT_CONSISTENT_WITH_HISTORY = 7,
|
||||
LR11XX_GNSS_DOPPLER_SOLVER_ERROR_ALL_ALMANAC_TOO_OLD = 8,
|
||||
} lr11xx_gnss_doppler_solver_error_code_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS almanac status
|
||||
*/
|
||||
typedef enum lr11xx_gnss_almanac_status_e
|
||||
{
|
||||
LR11XX_GNSS_INTERNAL_ACCURACY_TOO_LOW = -4,
|
||||
LR11XX_GNSS_NO_TIME_SET = -3,
|
||||
LR11XX_GNSS_IMPOSSIBLE_TO_FIND_NEXT_TIME = -2,
|
||||
LR11XX_GNSS_NO_PAGE_ID_KNOWN = -1,
|
||||
LR11XX_GNSS_NO_SAT_TO_UPDATE = 0,
|
||||
LR11XX_GNSS_AT_LEAST_ONE_SAT_MUST_BE_UPDATED = 1,
|
||||
} lr11xx_gnss_almanac_status_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS SV type
|
||||
*/
|
||||
typedef enum lr11xx_gnss_sv_type_e
|
||||
{
|
||||
LR11XX_GNSS_MEO_SAT = 0,
|
||||
LR11XX_GNSS_IGSO_SAT = 1,
|
||||
} lr11xx_gnss_sv_type_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_GNSS_LAST_SCAN_MODE_ASSISTED = 3,
|
||||
LR11XX_GNSS_LAST_SCAN_MODE_AUTONOMOUS_NO_TIME_NO_AP = 4,
|
||||
LR11XX_GNSS_LAST_SCAN_MODE_AUTONOMOUS_NO_AP = 5,
|
||||
LR11XX_GNSS_LAST_SCAN_FETCH_TIME_OR_DOPPLER_SOLVER = 6,
|
||||
LR11XX_GNSS_LAST_SCAN_ALMANAC_UPDATE = 7,
|
||||
LR11XX_GNSS_LAST_SCAN_KEEP_SYNC = 8,
|
||||
LR11XX_GNSS_LAST_SCAN_ALMANAC_UPDATE_1_CONSTELLATION = 9,
|
||||
LR11XX_GNSS_LAST_SCAN_ALMANAC_UPDATE_2_CONSTELLATIONS = 10,
|
||||
} lr11xx_gnss_scan_mode_launched_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS time structure
|
||||
*/
|
||||
typedef struct lr11xx_gnss_time_s
|
||||
{
|
||||
lr11xx_gnss_read_time_status_t error_code;
|
||||
uint32_t gps_time_s;
|
||||
uint32_t nb_us_in_s;
|
||||
uint32_t time_accuracy;
|
||||
} lr11xx_gnss_time_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS demod info structure
|
||||
*/
|
||||
typedef struct lr11xx_gnss_demod_info_s
|
||||
{
|
||||
bool word_sync_found; //!< 0: no word synchronization found / 1: a word synchronization has been found
|
||||
bool first_tow_found; //!< 0: no Time Of Week found / 1: a Time Of Week has been found
|
||||
bool wn_demodulated; //!< 0: no Week number demodulated / 1: a Week Number has been demodulated
|
||||
bool wn_found; //!< 0: no Week number found / 1: a Week Number has been found
|
||||
bool sub1_found; //!< 0: subframe ID not found / 1: subframe ID found
|
||||
bool sub4_found; //!< 0: subframe ID not found / 1: subframe ID found
|
||||
bool sub5_found; //!< 0: subframe ID not found / 1: subframe ID found
|
||||
} lr11xx_gnss_demod_info_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS cumulative_timing
|
||||
*/
|
||||
typedef struct lr11xx_gnss_cumulative_timing_s
|
||||
{
|
||||
uint32_t init;
|
||||
uint32_t phase1_gps_capture;
|
||||
uint32_t phase1_gps_process;
|
||||
uint32_t multiscan_gps_capture;
|
||||
uint32_t multiscan_gps_process;
|
||||
uint32_t multiscan_gps_sleep_32k;
|
||||
uint32_t phase1_beidou_capture;
|
||||
uint32_t phase1_beidou_process;
|
||||
uint32_t multiscan_beidou_capture;
|
||||
uint32_t multiscan_beidou_process;
|
||||
uint32_t multiscan_beidou_sleep_32k;
|
||||
uint32_t demod_capture;
|
||||
uint32_t demod_process;
|
||||
uint32_t demod_sleep_32k;
|
||||
uint32_t demod_sleep_32m;
|
||||
uint32_t total_gps_capture;
|
||||
uint32_t total_gps_process;
|
||||
uint32_t total_gps_sleep_32k;
|
||||
uint32_t total_gps_sleep_32m;
|
||||
uint32_t total_gps;
|
||||
uint32_t total_beidou_capture;
|
||||
uint32_t total_beidou_process;
|
||||
uint32_t total_beidou_sleep_32k;
|
||||
uint32_t total_beidou_sleep_32m;
|
||||
uint32_t total_beidou;
|
||||
uint32_t total_capture;
|
||||
uint32_t total_process;
|
||||
uint32_t total_sleep_32k;
|
||||
uint32_t total_sleep_32m;
|
||||
uint32_t total;
|
||||
uint32_t last_capture_size_32k_cnt;
|
||||
uint8_t constellation_demod;
|
||||
} lr11xx_gnss_cumulative_timing_t;
|
||||
|
||||
/*!
|
||||
* @brief GNSS instantaneous power consumption in ua
|
||||
*/
|
||||
typedef struct lr11xx_gnss_instantaneous_power_consumption_ua_s
|
||||
{
|
||||
uint16_t board_voltage_mv;
|
||||
uint16_t init_ua;
|
||||
uint16_t phase1_gps_capture_ua;
|
||||
uint16_t phase1_gps_process_ua;
|
||||
uint16_t multiscan_gps_capture_ua;
|
||||
uint16_t multiscan_gps_process_ua;
|
||||
uint16_t phase1_beidou_capture_ua;
|
||||
uint16_t phase1_beidou_process_ua;
|
||||
uint16_t multiscan_beidou_capture_ua;
|
||||
uint16_t multiscan_beidou_process_ua;
|
||||
uint16_t sleep_32k_ua;
|
||||
uint16_t demod_sleep_32m_ua;
|
||||
} lr11xx_gnss_instantaneous_power_consumption_ua_t;
|
||||
|
||||
/*!
|
||||
* @brief
|
||||
*/
|
||||
typedef struct lr11xx_gnss_doppler_solver_result_s
|
||||
{
|
||||
lr11xx_gnss_doppler_solver_error_code_t error_code;
|
||||
uint8_t nb_sv_used;
|
||||
uint16_t one_shot_latitude;
|
||||
uint16_t one_shot_longitude;
|
||||
uint16_t one_shot_accuracy;
|
||||
uint16_t one_shot_xtal_ppb;
|
||||
uint16_t filtered_latitude;
|
||||
uint16_t filtered_longitude;
|
||||
uint16_t filtered_accuracy;
|
||||
uint16_t filtered_xtal_ppb;
|
||||
} lr11xx_gnss_doppler_solver_result_t;
|
||||
|
||||
/*!
|
||||
* @brief
|
||||
*/
|
||||
typedef struct lr11xx_gnss_read_almanac_status_s
|
||||
{
|
||||
lr11xx_gnss_almanac_status_t status_gps;
|
||||
uint32_t next_gps_time_sat_to_update; //!< Next gps time sat to update: give the duration in milliseconds before
|
||||
//!< the next start subframe where to catch the new almanac
|
||||
uint8_t next_gps_nb_subframe_to_demodulate;
|
||||
uint8_t next_gps_sat_id_to_update_in_sub_4; //!< Next gps sat id to update in subframe 4: satellite number that can
|
||||
//!< be demodulated in next subframe 4
|
||||
uint8_t next_gps_sat_id_to_update_in_sub_5; //!< Next gps sat id to update in subframe 5: satellite number that can
|
||||
//!< be demodulated in next subframe 5
|
||||
uint8_t nb_sat_gps_to_update; //!< the number total gps and bds that needs almanac update
|
||||
uint8_t next_gps_subframe_id_start; //!< Next gps subframe ID start: can be equal to 4, 5 or 0
|
||||
uint32_t sat_id_gps_to_update; //!< Sat id gps to update: bit mask indicating which sat id almanac must be updated.
|
||||
//!< bit at 0 : almanac is already updated, bit at 1: almanac sat must be updated
|
||||
uint32_t sat_id_gps_activated; //!< Sat id gps activated : bit mask indicating which sat id is activated . bit at 0
|
||||
//!< : sat id is not activated, bit at 1: sat id is activated
|
||||
lr11xx_gnss_almanac_status_t status_beidou;
|
||||
uint32_t next_beidou_time_sat_to_update; //!< Next beidou time sat to update: give the duration in milliseconds
|
||||
//!< before the next start subframe where to catch the new almanac
|
||||
uint8_t next_beidou_nb_subframe_to_demodulate;
|
||||
uint8_t next_beidou_sat_id_to_update_in_sub_4; //!< Next beidou sat id to update in subframe 4: satellite number
|
||||
//!< that can be demodulated in next subframe 4
|
||||
uint8_t next_beidou_sat_id_to_update_in_sub_5; //!< Next beidou sat id to update in subframe 5: satellite number
|
||||
//!< that can be demodulated in next subframe 5
|
||||
uint8_t nb_sat_beidou_to_update; //!< the number total gps and bds that needs almanac update
|
||||
uint8_t next_beidou_subframe_id_start; //!< Next beidou subframe ID start: can be equal to 4, 5 or 0
|
||||
uint32_t sat_id_beidou_to_update[2]; //!< Sat id beidou to update: bit mask indicating which sat id almanac must be
|
||||
//!< updated. bit at 0 : almanac is already updated, bit at 1: almanac sat
|
||||
//!< must be updated
|
||||
uint32_t sat_id_beidou_activated[2]; //!< Sat id gps activated : bit mask indicating which sat id is activated .
|
||||
//!< bit at 0 : sat id is not activated, bit at 1: sat id is activated
|
||||
uint32_t sat_id_beidou_black_list[2]; //!< Sat id bds black list: bit mask indicating which bds sv does not
|
||||
//!< broadcast the almanac
|
||||
//!< bit at 0 : sat id is not black listed, bit at 1: sat id is black listed
|
||||
uint8_t next_am_id; //!< Next AmID: For beidou only. Page 11-24 of subframe 5 are used to broadcast almanac of sat
|
||||
//!< 31 to 63
|
||||
} lr11xx_gnss_read_almanac_status_t;
|
||||
|
||||
/*!
|
||||
* @brief Representation of absolute time for GNSS operations
|
||||
*
|
||||
* The GNSS absolute time is represented as a 32 bits word that is the number of seconds elapsed since January 6th
|
||||
* 1980, 00:00:00
|
||||
*
|
||||
* The GNSS absolute time must take into account the Leap Seconds between UTC time and GPS time.
|
||||
*/
|
||||
typedef uint32_t lr11xx_gnss_date_t;
|
||||
|
||||
/*!
|
||||
* @brief Buffer that holds data for all almanacs full update - when reading
|
||||
*/
|
||||
typedef uint8_t lr11xx_gnss_almanac_full_read_bytestream_t[LR11XX_GNSS_FULL_ALMANAC_READ_BUFFER_SIZE];
|
||||
|
||||
/*!
|
||||
* @brief Buffer that holds data for context status
|
||||
*/
|
||||
typedef uint8_t lr11xx_gnss_context_status_bytestream_t[LR11XX_GNSS_CONTEXT_STATUS_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Assistance position.
|
||||
*/
|
||||
typedef struct lr11xx_gnss_solver_assistance_position_s
|
||||
{
|
||||
float latitude; //!< Latitude 12 bits (latitude in degree * 2048/90) with resolution 0.044°
|
||||
float longitude; //!< Longitude 12 bits (longitude in degree * 2048/180) with resolution 0.088°
|
||||
} lr11xx_gnss_solver_assistance_position_t;
|
||||
|
||||
/*!
|
||||
* @brief Detected SV structure
|
||||
*/
|
||||
typedef struct lr11xx_gnss_detected_satellite_s
|
||||
{
|
||||
lr11xx_gnss_satellite_id_t satellite_id;
|
||||
int8_t cnr; //!< Carrier-to-noise ration (C/N) in dB
|
||||
int16_t doppler; //!< SV doppler in Hz
|
||||
} lr11xx_gnss_detected_satellite_t;
|
||||
|
||||
/*!
|
||||
* @brief Version structure of the LR11XX GNSS firmware
|
||||
*/
|
||||
typedef struct lr11xx_gnss_version_s
|
||||
{
|
||||
uint8_t gnss_firmware; //!< Version of the firmware
|
||||
uint8_t gnss_almanac; //!< Version of the almanac format
|
||||
} lr11xx_gnss_version_t;
|
||||
|
||||
/*!
|
||||
* @brief Structure for GNSS context status
|
||||
*/
|
||||
typedef struct lr11xx_gnss_context_status_s
|
||||
{
|
||||
uint8_t firmware_version;
|
||||
uint32_t global_almanac_crc;
|
||||
lr11xx_gnss_error_code_t error_code;
|
||||
bool almanac_update_gps;
|
||||
bool almanac_update_beidou;
|
||||
lr11xx_gnss_freq_search_space_t freq_search_space;
|
||||
} lr11xx_gnss_context_status_t;
|
||||
|
||||
/*!
|
||||
* @brief Structure for information about visible SV
|
||||
*/
|
||||
typedef struct lr11xx_gnss_visible_satellite_s
|
||||
{
|
||||
lr11xx_gnss_satellite_id_t satellite_id; //!< SV ID
|
||||
int16_t doppler; //!< SV doppler in Hz
|
||||
int16_t doppler_error; //!< SV doppler error - step of 125Hz
|
||||
} lr11xx_gnss_visible_satellite_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_GNSS_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
211
components/esp_lora_1121/include/lr11xx_driver/lr11xx_hal.h
Executable file
211
components/esp_lora_1121/include/lr11xx_driver/lr11xx_hal.h
Executable file
@@ -0,0 +1,211 @@
|
||||
/*!
|
||||
* @file lr11xx_hal.h
|
||||
*
|
||||
* @brief Hardware Abstraction Layer (HAL) interface for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_HAL_H
|
||||
#define LR11XX_HAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Write this to SPI bus while reading data, or as a dummy/placeholder
|
||||
*/
|
||||
#define LR11XX_NOP ( 0x00 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief LR11XX HAL status
|
||||
*/
|
||||
typedef enum lr11xx_hal_status_e
|
||||
{
|
||||
LR11XX_HAL_STATUS_OK = 0,
|
||||
LR11XX_HAL_STATUS_ERROR = 3,
|
||||
} lr11xx_hal_status_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Radio data transfer - write
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
* @param [in] command Pointer to the buffer to be transmitted
|
||||
* @param [in] command_length Buffer size to be transmitted
|
||||
* @param [in] data Pointer to the buffer to be transmitted
|
||||
* @param [in] data_length Buffer size to be transmitted
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_hal_status_t lr11xx_hal_write( const void* context, const uint8_t* command, const uint16_t command_length,
|
||||
const uint8_t* data, const uint16_t data_length );
|
||||
|
||||
/*!
|
||||
* @brief Radio data transfer - read
|
||||
*
|
||||
* @remark This is a two-step radio read operation. It consists of writing the command, releasing then re-asserting the
|
||||
* NSS line, then reading a discarded dummy byte followed by data_length bytes of response data from the transceiver.
|
||||
* While reading the dummy bytes and the response data, the implementation of this function must ensure that only zero
|
||||
* bytes (NOP) are written to the SPI bus.
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
* @param [in] command Pointer to the buffer to be transmitted
|
||||
* @param [in] command_length Buffer size to be transmitted
|
||||
* @param [out] data Pointer to the buffer to be received
|
||||
* @param [in] data_length Buffer size to be received
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @remark Some hardware SPI implementations write arbitary values on the MOSI line while reading. If this is done on
|
||||
* the LR11XX, non-zero values may be interpreted as commands. This driver does not exploit this functionality, and
|
||||
* expects that zeros be sent on the MOSI line when this command is reading the command response data.
|
||||
*/
|
||||
lr11xx_hal_status_t lr11xx_hal_read( const void* context, const uint8_t* command, const uint16_t command_length,
|
||||
uint8_t* data, const uint16_t data_length );
|
||||
|
||||
/*!
|
||||
* @brief Direct read from the SPI bus
|
||||
*
|
||||
* @remark Unlike @ref lr11xx_hal_read, this is a simple direct SPI bus SS/read/nSS operation. While reading the
|
||||
* response data, the implementation of this function must ensure that only zero bytes (NOP) are written to the SPI bus.
|
||||
*
|
||||
* @remark Formerly, that function depended on a lr11xx_hal_write_read API function, which required bidirectional SPI
|
||||
* communication. Given that all other radio functionality can be implemented with unidirectional SPI, it has been
|
||||
* decided to make this HAL API change to simplify implementation requirements.
|
||||
*
|
||||
* @remark Only required by the @ref lr11xx_system_get_status and @ref lr11xx_bootloader_get_status commands
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
* @param [out] data Pointer to the buffer to be received
|
||||
* @param [in] data_length Buffer size to be received
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_hal_status_t lr11xx_hal_direct_read( const void* context, uint8_t* data, const uint16_t data_length );
|
||||
|
||||
/*!
|
||||
* @brief Reset the radio
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_hal_status_t lr11xx_hal_reset( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Wake the radio up.
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_hal_status_t lr11xx_hal_wakeup( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Abort a blocking command
|
||||
*
|
||||
* @param [in] context Radio implementation parameters
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_hal_status_t lr11xx_hal_abort_blocking_cmd( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Return the computed CRC
|
||||
*
|
||||
* @param [in] initial_value initial value of the CRC
|
||||
* @param [in] buffer Buffer containing data used to compute the CRC
|
||||
* @param [in] length Length of buffer
|
||||
*
|
||||
* @returns CRC value
|
||||
*/
|
||||
inline static uint8_t lr11xx_hal_compute_crc( const uint8_t initial_value, const uint8_t* buffer, uint16_t length )
|
||||
{
|
||||
uint8_t crc = initial_value;
|
||||
if (buffer == NULL) {
|
||||
printf("Error: buffer is NULL!\n");
|
||||
return 0;
|
||||
}
|
||||
for( uint16_t i = 0; i < length; i++ )
|
||||
{
|
||||
// printf("%d %d %d\r\n",i,length,sizeof(buffer) / sizeof(buffer[0]));
|
||||
uint8_t extract = buffer[i];
|
||||
uint8_t sum;
|
||||
|
||||
for( uint8_t j = 8; j > 0; j-- )
|
||||
{
|
||||
sum = ( crc ^ extract ) & 0x01;
|
||||
crc >>= 1;
|
||||
|
||||
if( sum != 0 )
|
||||
{
|
||||
crc ^= 0x65;
|
||||
}
|
||||
|
||||
extract >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_HAL_H
|
||||
138
components/esp_lora_1121/include/lr11xx_driver/lr11xx_lr_fhss.h
Executable file
138
components/esp_lora_1121/include/lr11xx_driver/lr11xx_lr_fhss.h
Executable file
@@ -0,0 +1,138 @@
|
||||
/*!
|
||||
* @file lr11xx_lr_fhss.h
|
||||
*
|
||||
* @brief LR_FHSS driver definition for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_LR_FHSS_H
|
||||
#define LR11XX_LR_FHSS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "lr11xx_lr_fhss_types.h"
|
||||
#include "lr11xx_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Length, in bytes, of a LR-FHSS sync word
|
||||
*/
|
||||
#define LR_FHSS_SYNC_WORD_BYTES ( 4 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Initialize the LR_FHSS
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_lr_fhss_init( const void* context );
|
||||
|
||||
/**
|
||||
* @brief Get the delay in microsecond between the last bit sent and the TX done interrupt
|
||||
*
|
||||
* @param [in] params lr11xx LR-FHSS parameter structure
|
||||
* @param [in] payload_length Length of application-layer payload
|
||||
*
|
||||
* @returns Delay in microseconds
|
||||
*/
|
||||
uint16_t lr11xx_lr_fhss_get_bit_delay_in_us( const lr11xx_lr_fhss_params_t* params, uint16_t payload_length );
|
||||
|
||||
/*!
|
||||
* @brief Configure a payload to be sent with LR_FHSS
|
||||
*
|
||||
* When calling this method, lr11xx_radio_set_lr_fhss_sync_word is implicitely called to configure the sync word.
|
||||
* Note that the syncword must be 4 bytes long.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] lr_fhss_params Parameter configuration structure of the LRFHSS
|
||||
* @param [in] hop_sequence_id Seed used to derive the hopping sequence pattern. Only the nine LSBs are taken into
|
||||
* account
|
||||
* @param [in] payload The payload to send. It is the responsibility of the caller to ensure that this references an
|
||||
* array containing at least payload_length elements
|
||||
* @param [in] payload_length The length of the payload
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_lr_fhss_build_frame( const void* context, const lr11xx_lr_fhss_params_t* lr_fhss_params,
|
||||
uint16_t hop_sequence_id, const uint8_t* payload, uint8_t payload_length );
|
||||
|
||||
/*!
|
||||
* @brief Get the time on air in ms for LR-FHSS transmission
|
||||
*
|
||||
* @param [in] params LR11XX LR-FHSS parameter structure
|
||||
* @param [in] payload_length Length of application-layer payload
|
||||
*
|
||||
* @returns Time-on-air value in ms for LR-FHSS transmission
|
||||
*/
|
||||
uint32_t lr11xx_lr_fhss_get_time_on_air_in_ms( const lr11xx_lr_fhss_params_t* params, uint16_t payload_length );
|
||||
|
||||
/**
|
||||
* @brief Return the number of hop sequences available using the given parameters
|
||||
*
|
||||
* @param [in] lr_fhss_params Parameter configuration structure of the LRFHSS
|
||||
*
|
||||
* @return Returns the number of valid hop sequences (512 or 384)
|
||||
*/
|
||||
unsigned int lr11xx_lr_fhss_get_hop_sequence_count( const lr11xx_lr_fhss_params_t* lr_fhss_params );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_LR_FHSS_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
65
components/esp_lora_1121/include/lr11xx_driver/lr11xx_lr_fhss_types.h
Executable file
65
components/esp_lora_1121/include/lr11xx_driver/lr11xx_lr_fhss_types.h
Executable file
@@ -0,0 +1,65 @@
|
||||
/*!
|
||||
* @file lr11xx_lr_fhss_types.h
|
||||
*
|
||||
* @brief LR_FHSS types definition for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_LR_FHSS_TYPES_H
|
||||
#define LR11XX_LR_FHSS_TYPES_H
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "lr_fhss_v1_base_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief LR FHSS parameter structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
lr_fhss_v1_params_t lr_fhss_params; //!< Base LR FHSS parameters
|
||||
int8_t device_offset; //<! Per device offset to avoid collisions over the air. Possible values:
|
||||
//<! - if lr_fhss_params.grid == LR_FHSS_V1_GRID_25391_HZ:
|
||||
//<! [-26, 25]
|
||||
//<! - if lr_fhss_params.grid == LR_FHSS_V1_GRID_3906_HZ:
|
||||
//<! [-4, 3]
|
||||
} lr11xx_lr_fhss_params_t;
|
||||
|
||||
#endif // LR11XX_LR_FHSS_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
1044
components/esp_lora_1121/include/lr11xx_driver/lr11xx_radio.h
Executable file
1044
components/esp_lora_1121/include/lr11xx_driver/lr11xx_radio.h
Executable file
File diff suppressed because it is too large
Load Diff
95
components/esp_lora_1121/include/lr11xx_driver/lr11xx_radio_timings.h
Executable file
95
components/esp_lora_1121/include/lr11xx_driver/lr11xx_radio_timings.h
Executable file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @file lr11xx_radio_timings.h
|
||||
*
|
||||
* @brief LR11XX timing helper functions definition
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_RADIO_TIMINGS_H
|
||||
#define LR11XX_RADIO_TIMINGS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "lr11xx_radio_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the time between the last bit sent (on Tx side) and the Rx done event (on Rx side)
|
||||
*
|
||||
* @param [in] mod_params Pointer to a structure holding the LoRa modulation parameters used for the computation
|
||||
*
|
||||
* @returns Delay in microsecond
|
||||
*/
|
||||
uint32_t lr11xx_radio_timings_get_delay_between_last_bit_sent_and_rx_done_in_us(
|
||||
const lr11xx_radio_mod_params_lora_t* mod_params );
|
||||
|
||||
/**
|
||||
* @brief Get the time between the last bit sent and the Tx done event
|
||||
*
|
||||
* @param [in] ramp_time Power amplifier ramp time
|
||||
*
|
||||
* @returns Delay in microsecond
|
||||
*/
|
||||
uint32_t lr11xx_radio_timings_get_delay_between_last_bit_sent_and_tx_done_in_us(
|
||||
const lr11xx_radio_ramp_time_t ramp_time );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_RADIO_TIMINGS_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
654
components/esp_lora_1121/include/lr11xx_driver/lr11xx_radio_types.h
Executable file
654
components/esp_lora_1121/include/lr11xx_driver/lr11xx_radio_types.h
Executable file
@@ -0,0 +1,654 @@
|
||||
/*!
|
||||
* @file lr11xx_radio_types.h
|
||||
*
|
||||
* @brief Radio driver types for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_RADIO_TYPES_H
|
||||
#define LR11XX_RADIO_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Bit mask to set to indicate a LR-FHSS bitrate is defined in steps of 1/256 bit per seconds
|
||||
*/
|
||||
#define LR11XX_RADIO_LR_FHSS_BITRATE_DIVIDE_BY_256 ( 0x80000000 )
|
||||
|
||||
/*!
|
||||
* @brief LR-FHSS bitrate value at 488.28125 bps defined as steps of 1/256 bitrate per seconds
|
||||
*/
|
||||
#define LR11XX_RADIO_LR_FHSS_BITRATE_IN_256_BPS_STEPS ( 125000 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Power Amplifier Selection values
|
||||
*
|
||||
* - Low-power Power Amplifier can reach up to 14dBm
|
||||
* - High-power Power Amplifier can reach up to 22 dBm
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_PA_SEL_LP = 0x00, //!< Low-power Power Amplifier
|
||||
LR11XX_RADIO_PA_SEL_HP = 0x01, //!< High-power Power Amplifier
|
||||
LR11XX_RADIO_PA_SEL_HF = 0x02, //!< High-frequency Power Amplifier
|
||||
} lr11xx_radio_pa_selection_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Address Filtering configurations
|
||||
*
|
||||
* If Address Filtering is enabled but a wrong address is received, therefore the reception is aborted and the address
|
||||
* error flag of packet status is set.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_GFSK_ADDRESS_FILTERING_DISABLE = 0x00, //!< Filter deactivated
|
||||
LR11XX_RADIO_GFSK_ADDRESS_FILTERING_NODE_ADDRESS = 0x01, //!< Filter on Node Address
|
||||
LR11XX_RADIO_GFSK_ADDRESS_FILTERING_NODE_AND_BROADCAST_ADDRESSES =
|
||||
0x02, //!< Filtering on Node and Broadcast addresses
|
||||
} lr11xx_radio_gfsk_address_filtering_t;
|
||||
|
||||
/*!
|
||||
* @brief Chip mode after successfull transmission or reception
|
||||
*
|
||||
* Unused for RX duty cycle and AutoTxRx operations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_FALLBACK_STDBY_RC = 0x01, //!< Standby RC (Default)
|
||||
LR11XX_RADIO_FALLBACK_STDBY_XOSC = 0x02, //!< Standby XOSC
|
||||
LR11XX_RADIO_FALLBACK_FS = 0x03 //!< FS
|
||||
} lr11xx_radio_fallback_modes_t;
|
||||
|
||||
/*!
|
||||
* @brief Ramping time for PA
|
||||
*
|
||||
* This parameter is the ramping time of the PA. A high value improves spectral quality.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_RAMP_16_US = 0x00, //!< 16 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_32_US = 0x01, //!< 32 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_48_US = 0x02, //!< 48 us Ramp Time (Default)
|
||||
LR11XX_RADIO_RAMP_64_US = 0x03, //!< 64 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_80_US = 0x04, //!< 80 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_96_US = 0x05, //!< 96 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_112_US = 0x06, //!< 112 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_128_US = 0x07, //!< 128 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_144_US = 0x08, //!< 144 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_160_US = 0x09, //!< 160 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_176_US = 0x0A, //!< 176 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_192_US = 0x0B, //!< 192 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_208_US = 0x0C, //!< 208 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_240_US = 0x0D, //!< 240 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_272_US = 0x0E, //!< 272 us Ramp Time
|
||||
LR11XX_RADIO_RAMP_304_US = 0x0F, //!< 304 us Ramp Time
|
||||
} lr11xx_radio_ramp_time_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa network type configuration
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LORA_NETWORK_PRIVATE = 0x00, //!< LoRa private network
|
||||
LR11XX_RADIO_LORA_NETWORK_PUBLIC = 0x01, //!< LoRa public network
|
||||
} lr11xx_radio_lora_network_type_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Spreading Factor configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LORA_SF5 = 0x05, //!< Spreading Factor 5
|
||||
LR11XX_RADIO_LORA_SF6 = 0x06, //!< Spreading Factor 6
|
||||
LR11XX_RADIO_LORA_SF7 = 0x07, //!< Spreading Factor 7
|
||||
LR11XX_RADIO_LORA_SF8 = 0x08, //!< Spreading Factor 8
|
||||
LR11XX_RADIO_LORA_SF9 = 0x09, //!< Spreading Factor 9
|
||||
LR11XX_RADIO_LORA_SF10 = 0x0A, //!< Spreading Factor 10
|
||||
LR11XX_RADIO_LORA_SF11 = 0x0B, //!< Spreading Factor 11
|
||||
LR11XX_RADIO_LORA_SF12 = 0x0C, //!< Spreading Factor 12
|
||||
} lr11xx_radio_lora_sf_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Bandwidth configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LORA_BW_10 = 0x08, //!< Bandwidth 10.42 kHz
|
||||
LR11XX_RADIO_LORA_BW_15 = 0x01, //!< Bandwidth 15.63 kHz
|
||||
LR11XX_RADIO_LORA_BW_20 = 0x09, //!< Bandwidth 20.83 kHz
|
||||
LR11XX_RADIO_LORA_BW_31 = 0x02, //!< Bandwidth 31.25 kHz
|
||||
LR11XX_RADIO_LORA_BW_41 = 0x0A, //!< Bandwidth 41.67 kHz
|
||||
LR11XX_RADIO_LORA_BW_62 = 0x03, //!< Bandwidth 62.50 kHz
|
||||
LR11XX_RADIO_LORA_BW_125 = 0x04, //!< Bandwidth 125.00 kHz
|
||||
LR11XX_RADIO_LORA_BW_250 = 0x05, //!< Bandwidth 250.00 kHz
|
||||
LR11XX_RADIO_LORA_BW_500 = 0x06, //!< Bandwidth 500.00 kHz
|
||||
LR11XX_RADIO_LORA_BW_200 = 0x0D, //!< Bandwidth 203.00 kHz, 2G4 and compatible with LR112x chips only
|
||||
LR11XX_RADIO_LORA_BW_400 = 0x0E, //!< Bandwidth 406.00 kHz, 2G4 and compatible with LR112x chips only
|
||||
LR11XX_RADIO_LORA_BW_800 = 0x0F, //!< Bandwidth 812.00 kHz, 2G4 and compatible with LR112x chips only
|
||||
} lr11xx_radio_lora_bw_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Coding Rate configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LORA_NO_CR = 0x00, //!< No Coding Rate
|
||||
LR11XX_RADIO_LORA_CR_4_5 = 0x01, //!< Coding Rate 4/5 Short Interleaver
|
||||
LR11XX_RADIO_LORA_CR_4_6 = 0x02, //!< Coding Rate 4/6 Short Interleaver
|
||||
LR11XX_RADIO_LORA_CR_4_7 = 0x03, //!< Coding Rate 4/7 Short Interleaver
|
||||
LR11XX_RADIO_LORA_CR_4_8 = 0x04, //!< Coding Rate 4/8 Short Interleaver
|
||||
LR11XX_RADIO_LORA_CR_LI_4_5 = 0x05, //!< Coding Rate 4/5 Long Interleaver
|
||||
LR11XX_RADIO_LORA_CR_LI_4_6 = 0x06, //!< Coding Rate 4/6 Long Interleaver
|
||||
LR11XX_RADIO_LORA_CR_LI_4_8 = 0x07, //!< Coding Rate 4/8 Long Interleaver
|
||||
} lr11xx_radio_lora_cr_t;
|
||||
|
||||
/*!
|
||||
* @brief Values for intermediary mode
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_MODE_SLEEP = 0x00, //!< Sleep / Not recommended with LR1110 FW from 0x0303 to 0x0307 and LR1120 FW
|
||||
//!< 0x0101 in case of transition from Rx to Tx in LoRa
|
||||
LR11XX_RADIO_MODE_STANDBY_RC = 0x01, //!< Standby RC
|
||||
LR11XX_RADIO_MODE_STANDBY_XOSC = 0x02, //!< Standby XOSC
|
||||
LR11XX_RADIO_MODE_FS = 0x03 //!< Frequency Synthesis
|
||||
} lr11xx_radio_intermediary_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Cyclic Redundancy Check configurations
|
||||
*
|
||||
* If this value is set to something other than CRC_OFF, a CRC is automatically computed and added after the end of the
|
||||
* payload on transmitter side. On receiver side, the CRC check is automatically processed.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_GFSK_CRC_OFF = 0x01, //!< CRC check deactivated
|
||||
LR11XX_RADIO_GFSK_CRC_1_BYTE = 0x00,
|
||||
LR11XX_RADIO_GFSK_CRC_2_BYTES = 0x02,
|
||||
LR11XX_RADIO_GFSK_CRC_1_BYTE_INV = 0x04,
|
||||
LR11XX_RADIO_GFSK_CRC_2_BYTES_INV = 0x06,
|
||||
} lr11xx_radio_gfsk_crc_type_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK data whitening configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_GFSK_DC_FREE_OFF = 0x00, //!< Whitening deactivated
|
||||
LR11XX_RADIO_GFSK_DC_FREE_WHITENING = 0x01, //!< Whitening enabled
|
||||
LR11XX_RADIO_GFSK_DC_FREE_WHITENING_SX128X_COMP = 0x03, //!< Whitening enabled - SX128x compatibility
|
||||
} lr11xx_radio_gfsk_dc_free_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Header Type configurations
|
||||
*
|
||||
* This parameter indicates whether or not the payload length is sent and read over the air.
|
||||
*
|
||||
* If the payload length is known beforehand by both transmitter and receiver, therefore there is no need to send it
|
||||
* over the air. Otherwise, setting this parameter to LR11XX_RADIO_GFSK_PKT_VAR_LEN will make the modem to automatically
|
||||
* prepand a byte containing the payload length to the the payload on transmitter side. On receiver side, this first
|
||||
* byte is read to set the payload length to read.
|
||||
*
|
||||
* This configuration is only available for GFSK packet types.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_GFSK_PKT_FIX_LEN = 0x00, //!< Payload length is not sent/read over the air
|
||||
LR11XX_RADIO_GFSK_PKT_VAR_LEN = 0x01, //!< Payload length is sent/read over the air
|
||||
LR11XX_RADIO_GFSK_PKT_VAR_LEN_SX128X_COMP =
|
||||
0x02, //!< Payload length is sent/read over the air - SX128x compatibility
|
||||
} lr11xx_radio_gfsk_pkt_len_modes_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Preamble Detector Length configurations
|
||||
*
|
||||
* This parameter sets the minimum length of preamble bits to be received to continue reception of incoming packet. If a
|
||||
* packet with preamble length lower than this value is being received, the reception stops without generating IRQ.
|
||||
*
|
||||
* This parameter has no impact on TX operations.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_GFSK_PREAMBLE_DETECTOR_OFF = 0x00,
|
||||
LR11XX_RADIO_GFSK_PREAMBLE_DETECTOR_MIN_8BITS = 0x04,
|
||||
LR11XX_RADIO_GFSK_PREAMBLE_DETECTOR_MIN_16BITS = 0x05,
|
||||
LR11XX_RADIO_GFSK_PREAMBLE_DETECTOR_MIN_24BITS = 0x06,
|
||||
LR11XX_RADIO_GFSK_PREAMBLE_DETECTOR_MIN_32BITS = 0x07
|
||||
} lr11xx_radio_gfsk_preamble_detector_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Cyclic Redundancy Check configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LORA_CRC_OFF = 0x00, //!< CRC deactivated
|
||||
LR11XX_RADIO_LORA_CRC_ON = 0x01, //!< CRC activated
|
||||
} lr11xx_radio_lora_crc_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa Header type configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LORA_PKT_EXPLICIT = 0x00, //!< Explicit header: transmitted over the air
|
||||
LR11XX_RADIO_LORA_PKT_IMPLICIT = 0x01, //!< Implicit header: not transmitted over the air
|
||||
} lr11xx_radio_lora_pkt_len_modes_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa IQ mode configurations
|
||||
*
|
||||
* LoRa IQ modes are mutually exclusives: a physical packet sent with standard IQ will not be received by a receiver
|
||||
* configured with inverted IQ.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LORA_IQ_STANDARD = 0x00, //!< IQ standard
|
||||
LR11XX_RADIO_LORA_IQ_INVERTED = 0x01, //!< IQ inverted
|
||||
} lr11xx_radio_lora_iq_t;
|
||||
|
||||
/*!
|
||||
* @brief Packet type values
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_PKT_NONE = 0x00, //!< State after cold start, Wi-Fi or GNSS capture
|
||||
LR11XX_RADIO_PKT_TYPE_GFSK = 0x01, //!< GFSK modulation
|
||||
LR11XX_RADIO_PKT_TYPE_LORA = 0x02, //!< LoRa modulation
|
||||
LR11XX_RADIO_PKT_TYPE_BPSK = 0x03, //!< BPSK modulation
|
||||
LR11XX_RADIO_PKT_TYPE_LR_FHSS = 0x04, //!< LR-FHSS modulation
|
||||
LR11XX_RADIO_PKT_TYPE_RTTOF = 0x05, //!< RTToF (Ranging) packet
|
||||
} lr11xx_radio_pkt_type_t;
|
||||
|
||||
/*!
|
||||
* @brief Select power amplifier supply source
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_PA_REG_SUPPLY_VREG = 0x00, //!< Power amplifier supplied by the main regulator
|
||||
LR11XX_RADIO_PA_REG_SUPPLY_VBAT = 0x01 //!< Power amplifier supplied by the battery
|
||||
} lr11xx_radio_pa_reg_supply_t;
|
||||
|
||||
/*!
|
||||
* @brief RX Duty Cycle Modes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_RX_DUTY_CYCLE_MODE_RX = 0x00, //!< LoRa/GFSK: Uses Rx for listening to packets
|
||||
LR11XX_RADIO_RX_DUTY_CYCLE_MODE_CAD = 0x01, //!< Only in LoRa: Uses CAD to listen for over-the-air activity
|
||||
} lr11xx_radio_rx_duty_cycle_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK Bandwidth configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_GFSK_BW_4800 = 0x1F, //!< Bandwidth 4.8 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_5800 = 0x17, //!< Bandwidth 5.8 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_7300 = 0x0F, //!< Bandwidth 7.3 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_9700 = 0x1E, //!< Bandwidth 9.7 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_11700 = 0x16, //!< Bandwidth 11.7 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_14600 = 0x0E, //!< Bandwidth 14.6 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_19500 = 0x1D, //!< Bandwidth 19.5 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_23400 = 0x15, //!< Bandwidth 23.4 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_29300 = 0x0D, //!< Bandwidth 29.3 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_39000 = 0x1C, //!< Bandwidth 39.0 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_46900 = 0x14, //!< Bandwidth 46.9 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_58600 = 0x0C, //!< Bandwidth 58.6 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_78200 = 0x1B, //!< Bandwidth 78.2 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_93800 = 0x13, //!< Bandwidth 93.8 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_117300 = 0x0B, //!< Bandwidth 117.3 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_156200 = 0x1A, //!< Bandwidth 156.2 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_187200 = 0x12, //!< Bandwidth 187.2 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_234300 = 0x0A, //!< Bandwidth 232.3 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_312000 = 0x19, //!< Bandwidth 312.0 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_373600 = 0x11, //!< Bandwidth 373.6 kHz DSB
|
||||
LR11XX_RADIO_GFSK_BW_467000 = 0x09 //!< Bandwidth 467.0 kHz DSB
|
||||
} lr11xx_radio_gfsk_bw_t;
|
||||
|
||||
/*!
|
||||
* @brief Possible automatic actions when Channel Activity Detection operations terminate
|
||||
*
|
||||
* For RADIO_EXIT_MODE_CAD_RX, LR11XX enters RX mode on activity detected. The timeout value for this RX operation is
|
||||
* defined as:
|
||||
*
|
||||
* \f$ 31.25us \times timeout \f$
|
||||
*
|
||||
* With \f$ timeout \f$ defined in RadioCadParams_t::timeout
|
||||
*
|
||||
* If the CAD operation is negative with RADIO_CAD_EXIT_MODE_RX or if CAD operation is positive with
|
||||
* RADIO_CAD_EXIT_MODE_TX, therefore the LR11XX enters Standby RC mode.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_CAD_EXIT_MODE_STANDBYRC = 0x00, //!< Enter standby RC mode after CAD operation
|
||||
LR11XX_RADIO_CAD_EXIT_MODE_RX = 0x01, //!< Enter in RX mode if an activity is detected
|
||||
LR11XX_RADIO_CAD_EXIT_MODE_TX = 0x10, //!< Enter in TX mode if no activity is detected
|
||||
} lr11xx_radio_cad_exit_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief Pulse shape configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_GFSK_PULSE_SHAPE_OFF = 0x00, //!< No filter applied
|
||||
LR11XX_RADIO_GFSK_PULSE_SHAPE_BT_03 = 0x08, //!< Gaussian BT 0.3
|
||||
LR11XX_RADIO_GFSK_PULSE_SHAPE_BT_05 = 0x09, //!< Gaussian BT 0.5
|
||||
LR11XX_RADIO_GFSK_PULSE_SHAPE_BT_07 = 0x0A, //!< Gaussian BT 0.7
|
||||
LR11XX_RADIO_GFSK_PULSE_SHAPE_BT_1 = 0x0B //!< Gaussian BT 1.0
|
||||
} lr11xx_radio_gfsk_pulse_shape_t;
|
||||
|
||||
/*!
|
||||
* @brief BPSK pulse shape configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_DBPSK_PULSE_SHAPE = 0x16, //!< Double OSR / RRC / BT 0.7
|
||||
} lr11xx_radio_bpsk_pulse_shape_t;
|
||||
|
||||
/*!
|
||||
* @brief LR-FHSS bitrate configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LR_FHSS_BITRATE_488_BPS =
|
||||
( int ) ( LR11XX_RADIO_LR_FHSS_BITRATE_DIVIDE_BY_256 +
|
||||
LR11XX_RADIO_LR_FHSS_BITRATE_IN_256_BPS_STEPS ), //!< 488.28215 bps
|
||||
} lr11xx_radio_lr_fhss_bitrate_t;
|
||||
|
||||
/*!
|
||||
* @brief LR-FHSS pulse shape configurations
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LR_FHSS_PULSE_SHAPE_BT_1 = 0x0B //!< Gaussian BT 1.0
|
||||
} lr11xx_radio_lr_fhss_pulse_shape_t;
|
||||
|
||||
/*!
|
||||
* @brief Channel Activity Detection parameters
|
||||
*
|
||||
* Parameters detPeak and detMin are to be used for tuning the sensitivity of Channel Activity Detection. It depends on
|
||||
* Spreading Factor, Bandwidth and symbolNum.
|
||||
*
|
||||
* For detPeak, the 5 MSBits are encoding the integer part, the 3 LSBits are encoding 1/8 of the decimal part. For
|
||||
* instance, \f$detPeak = 50\f$ (= 0x32) leads to a ratio being \f$6 + 2 * 1/8 = 6.25\f$.
|
||||
*
|
||||
* detMin is unit free and represents the ratio between the minimal power of a correlation peak and measurement gain
|
||||
* that can be considered as a peak detection. It helps to avoid detection on noise. Authorized values a from 0 to 181.
|
||||
*/
|
||||
typedef struct lr11xx_radio_cad_params_s
|
||||
{
|
||||
uint8_t cad_symb_nb; //!< Number of symbols used for CAD detection
|
||||
uint8_t cad_detect_peak; //!< Ratio for CAD between correlator peak and average
|
||||
//!< (Default 0x32)
|
||||
uint8_t cad_detect_min; //!< Minimum power of the correlation peak to be
|
||||
//!< considered as a positive CAD (Default 0x0A)
|
||||
lr11xx_radio_cad_exit_mode_t cad_exit_mode; //!< Automated action on CAD completion
|
||||
uint32_t cad_timeout; //!< Value used to compute timeout
|
||||
} lr11xx_radio_cad_params_t;
|
||||
|
||||
/*!
|
||||
* @brief Status of GFSK received packet
|
||||
*/
|
||||
typedef struct lr11xx_radio_pkt_status_gfsk_s
|
||||
{
|
||||
int8_t rssi_sync_in_dbm; //!< RSSI value latched on detection of the last received packet Sync Address
|
||||
int8_t rssi_avg_in_dbm; //!< RSSI averaged over the payload of the last received packet
|
||||
uint8_t rx_len_in_bytes; //!< Length of the last received packet [Bytes]
|
||||
bool is_addr_err; //!< Address filtering status. Asserted if received packet address does not match node address
|
||||
//!< nor broadcast address
|
||||
bool is_crc_err; //!< CRC status of the current packet (applicable only in RX, with CRC enabled)
|
||||
bool is_len_err; //!< Asserted when the length of last received packet is greater than the maximal length
|
||||
//!< (applicable only in RX with variable length packet)
|
||||
bool is_abort_err; //!< Asserted when the current packet has been aborted (applicable in RX and TX)
|
||||
bool is_received; //!< Asserted when packet reception is done (applicable in RX)
|
||||
bool is_sent; //!< Asserted when packet transmission is done (applicable in TX)
|
||||
} lr11xx_radio_pkt_status_gfsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Status of received packet
|
||||
*/
|
||||
typedef struct lr11xx_radio_pkt_status_lora_s
|
||||
{
|
||||
int8_t rssi_pkt_in_dbm; //!< Average RSSI over last received packet.
|
||||
int8_t snr_pkt_in_db; //!< SNR estimated on last received packet.
|
||||
int8_t signal_rssi_pkt_in_dbm; //!< RSSI of last packet latched after
|
||||
} lr11xx_radio_pkt_status_lora_t;
|
||||
|
||||
/*!
|
||||
* @brief Length and offset of received packet
|
||||
*/
|
||||
typedef struct lr11xx_radio_rx_buffer_status_s
|
||||
{
|
||||
uint8_t pld_len_in_bytes; //!< Length of received packet [Bytes]
|
||||
uint8_t buffer_start_pointer; //!< Offset in the reception buffer of
|
||||
//!< first byte received [Bytes]
|
||||
} lr11xx_radio_rx_buffer_status_t;
|
||||
|
||||
/*!
|
||||
* @brief GFSK packet statistic structure
|
||||
*/
|
||||
typedef struct lr11xx_radio_stats_gfsk_s
|
||||
{
|
||||
uint16_t nb_pkt_received; //!< Total number of received packets
|
||||
uint16_t nb_pkt_crc_error; //!< Total number of received packets with CRC error
|
||||
uint16_t nb_pkt_len_error; //!< Total number of received packets with a length error
|
||||
} lr11xx_radio_stats_gfsk_t;
|
||||
|
||||
/*!
|
||||
* @brief LoRa packet statistic structure
|
||||
*/
|
||||
typedef struct lr11xx_radio_stats_lora_s
|
||||
{
|
||||
uint16_t nb_pkt_received; //!< Total number of received packets
|
||||
uint16_t nb_pkt_crc_error; //!< Total number of received packets with CRC error
|
||||
uint16_t nb_pkt_header_error; //!< Total number of packets with header error
|
||||
uint16_t nb_pkt_falsesync; //!< Total number of false sync
|
||||
} lr11xx_radio_stats_lora_t;
|
||||
|
||||
/*!
|
||||
* @brief Modulation configuration for GFSK packet
|
||||
*/
|
||||
typedef struct lr11xx_radio_mod_params_gfsk_s
|
||||
{
|
||||
uint32_t br_in_bps; //!< GFSK bitrate [bit/s]
|
||||
lr11xx_radio_gfsk_pulse_shape_t pulse_shape; //!< GFSK pulse shape
|
||||
lr11xx_radio_gfsk_bw_t bw_dsb_param; //!< GFSK bandwidth
|
||||
uint32_t fdev_in_hz; //!< GFSK frequency deviation [Hz]
|
||||
} lr11xx_radio_mod_params_gfsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Modulation configuration for BPSK packet
|
||||
*/
|
||||
typedef struct lr11xx_radio_mod_params_bpsk_s
|
||||
{
|
||||
uint32_t br_in_bps; //!< BPSK bitrate [bit/s]
|
||||
lr11xx_radio_bpsk_pulse_shape_t pulse_shape; //!< BPSK pulse shape
|
||||
} lr11xx_radio_mod_params_bpsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Modulation configuration for LoRa packet
|
||||
*/
|
||||
typedef struct lr11xx_radio_mod_params_lora_s
|
||||
{
|
||||
lr11xx_radio_lora_sf_t sf; //!< LoRa spreading factor
|
||||
lr11xx_radio_lora_bw_t bw; //!< LoRa bandwidth
|
||||
lr11xx_radio_lora_cr_t cr; //!< LoRa coding rate
|
||||
uint8_t ldro; //!< LoRa LDRO
|
||||
} lr11xx_radio_mod_params_lora_t;
|
||||
|
||||
/*!
|
||||
* @brief Modulation configuration for LR-FHSS packets
|
||||
*/
|
||||
typedef struct lr11xx_radio_mod_params_lr_fhss_s
|
||||
{
|
||||
lr11xx_radio_lr_fhss_bitrate_t br_in_bps; //!< LR-FHSS bitrate
|
||||
lr11xx_radio_lr_fhss_pulse_shape_t pulse_shape; //!< LR-FHSS pulse shape
|
||||
} lr11xx_radio_mod_params_lr_fhss_t;
|
||||
|
||||
/*!
|
||||
* @brief Packet parameter configuration for GFSK packets
|
||||
*/
|
||||
typedef struct lr11xx_radio_pkt_params_gfsk_s
|
||||
{
|
||||
uint16_t preamble_len_in_bits; //!< GFSK Preamble length [bits]
|
||||
lr11xx_radio_gfsk_preamble_detector_t preamble_detector; //!< GFSK Preamble detection configuration
|
||||
uint8_t sync_word_len_in_bits; //!< GFSK Syncword length [bits]
|
||||
lr11xx_radio_gfsk_address_filtering_t address_filtering; //!< GFSK Address filtering/comparison configuration
|
||||
lr11xx_radio_gfsk_pkt_len_modes_t header_type; //!< GFSK Header type configuration
|
||||
uint8_t pld_len_in_bytes; //!< GFSK Payload length [bytes]
|
||||
lr11xx_radio_gfsk_crc_type_t crc_type; //!< GFSK CRC configuration
|
||||
lr11xx_radio_gfsk_dc_free_t dc_free; //!< GFSK Whitening configuration
|
||||
} lr11xx_radio_pkt_params_gfsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Packet parameter configuration for BPSK packets
|
||||
*/
|
||||
typedef struct lr11xx_radio_pkt_params_bpsk_s
|
||||
{
|
||||
uint8_t pld_len_in_bytes; //!< Payload length [bytes]
|
||||
uint16_t ramp_up_delay; //!< Delay to fine tune ramp-up time, if non-zero
|
||||
uint16_t ramp_down_delay; //!< Delay to fine tune ramp-down time, if non-zero
|
||||
uint16_t pld_len_in_bits; //!< If non-zero, used to ramp down PA before end of a payload with length that is not a
|
||||
//!< multiple of 8. pld_len_in_bits <= pld_len_in_bytes * 8
|
||||
} lr11xx_radio_pkt_params_bpsk_t;
|
||||
|
||||
/*!
|
||||
* @brief Packet parameter configuration for LoRa packets
|
||||
*/
|
||||
typedef struct lr11xx_radio_pkt_params_lora_s
|
||||
{
|
||||
uint16_t preamble_len_in_symb; //!< LoRa Preamble length [symbols]
|
||||
lr11xx_radio_lora_pkt_len_modes_t header_type; //!< LoRa Header type configuration
|
||||
uint8_t pld_len_in_bytes; //!< LoRa Payload length [bytes]
|
||||
lr11xx_radio_lora_crc_t crc; //!< LoRa CRC configuration
|
||||
lr11xx_radio_lora_iq_t iq; //!< LoRa IQ configuration
|
||||
} lr11xx_radio_pkt_params_lora_t;
|
||||
|
||||
/*!
|
||||
* @brief Configuration of Power Amplifier
|
||||
*
|
||||
* @ref pa_duty_cycle controls the duty cycle of Power Amplifier according to:
|
||||
* \f$ dutycycle = 0.2 + 0.04 \times pa_duty_cycle \f$
|
||||
* It can be used to adapt the TX multi-band operation using a single-matching network.
|
||||
*
|
||||
* The allowed duty cycle values for LPA are from 0.2 to 0.48 (by step of 0.04). Therefore possible values for
|
||||
* pa_duty_cycle go from 0 to 7.
|
||||
*
|
||||
* The allowed duty cycle values for HPA go from 0.2 to 0.36 (by step of 0.04). Therefore in this case, the possible
|
||||
* values for pa_duty_cycle go from 0 to 4.
|
||||
*
|
||||
* @ref pa_hp_sel controls the number of slices for HPA according to: \f$ \#slices = pa_hp_sel + 1 \f$
|
||||
*/
|
||||
typedef struct lr11xx_radio_pa_cfg_s
|
||||
{
|
||||
lr11xx_radio_pa_selection_t pa_sel; //!< Power Amplifier selection
|
||||
lr11xx_radio_pa_reg_supply_t pa_reg_supply; //!< Power Amplifier regulator supply source
|
||||
uint8_t pa_duty_cycle; //!< Power Amplifier duty cycle (Default 0x04)
|
||||
uint8_t pa_hp_sel; //!< Number of slices for HPA (Default 0x07)
|
||||
} lr11xx_radio_pa_cfg_t;
|
||||
|
||||
/*!
|
||||
* @brief RSSI calibration table
|
||||
*/
|
||||
typedef struct lr11xx_radio_rssi_calibration_table_s
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t g4;
|
||||
uint8_t g5;
|
||||
uint8_t g6;
|
||||
uint8_t g7;
|
||||
uint8_t g8;
|
||||
uint8_t g9;
|
||||
uint8_t g10;
|
||||
uint8_t g11;
|
||||
uint8_t g12;
|
||||
uint8_t g13;
|
||||
uint8_t g13hp1;
|
||||
uint8_t g13hp2;
|
||||
uint8_t g13hp3;
|
||||
uint8_t g13hp4;
|
||||
uint8_t g13hp5;
|
||||
uint8_t g13hp6;
|
||||
uint8_t g13hp7;
|
||||
} gain_tune; //!< Used to set gain tune value for RSSI calibration
|
||||
|
||||
int16_t gain_offset; //!< Used to set gain offset value for RSSI calibration
|
||||
} lr11xx_radio_rssi_calibration_table_t;
|
||||
|
||||
/*!
|
||||
* @brief Values to use to setup LNA LF0 configuration
|
||||
*
|
||||
* LNA can be configured in either of the 3 modes: Single N, Single P or differential (which is default)
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_RADIO_LNA_MODE_SINGLE_RFI_N_LF0 = 1, //!< Use only RFI_N_LF0 antenna
|
||||
LR11XX_RADIO_LNA_MODE_SINGLE_RFI_P_LF0 = 2, //!< Use only RFI_P_LF0 antenna
|
||||
LR11XX_RADIO_LNA_MODE_DIFFERENTIAL_LF0 = 3 //!< Configure LNA LF0 in differential mode (default)
|
||||
} lr11xx_radio_lna_mode_t;
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_RADIO_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
207
components/esp_lora_1121/include/lr11xx_driver/lr11xx_regmem.h
Executable file
207
components/esp_lora_1121/include/lr11xx_driver/lr11xx_regmem.h
Executable file
@@ -0,0 +1,207 @@
|
||||
/*!
|
||||
* @file lr11xx_regmem.h
|
||||
*
|
||||
* @brief Register/memory driver definition for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_REGMEM_H
|
||||
#define LR11XX_REGMEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lr11xx_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Maximum number of words that can be written to / read from a LR11XX chip with regmem32 commands
|
||||
*/
|
||||
#define LR11XX_REGMEM_MAX_WRITE_READ_WORDS 64
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Write up to 64 words into register memory space of LR11XX.
|
||||
*
|
||||
* A word is 32-bit long. The writing operations write contiguously in register memory, starting at the address
|
||||
* provided.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to start writing operation
|
||||
* @param [in] data The buffer of words to write into memory. Its size must be enough to contain length words.
|
||||
* @param [in] length Number of words to write into memory
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_regmem_read_regmem32
|
||||
*/
|
||||
lr11xx_status_t lr11xx_regmem_write_regmem32( const void* context, const uint32_t address, const uint32_t* buffer,
|
||||
const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read up to 64 words into register memory space of LR11XX.
|
||||
*
|
||||
* A word is 32-bit long. The reading operations read contiguously from register memory, starting at the address
|
||||
* provided.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to start reading operation
|
||||
* @param [in] length Number of words to read from memory
|
||||
* @param [out] buffer Pointer to a words array to be filled with content from memory. Its size must be enough to
|
||||
* contain at least length words.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_regmem_write_regmem32
|
||||
*/
|
||||
lr11xx_status_t lr11xx_regmem_read_regmem32( const void* context, const uint32_t address, uint32_t* buffer,
|
||||
const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Write bytes into register memory space of LR11XX.
|
||||
*
|
||||
* A byte is 8-bit long. The writing operations write contiguously in register memory, starting at the address provided.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to start writing operation
|
||||
* @param [in] data The buffer of bytes to write into memory. Its size must be enough to contain length bytes
|
||||
* @param [in] length Number of bytes to write into memory
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_regmem_read_mem8
|
||||
*/
|
||||
lr11xx_status_t lr11xx_regmem_write_mem8( const void* context, const uint32_t address, const uint8_t* buffer,
|
||||
const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read bytes into register memory space of LR11XX.
|
||||
*
|
||||
* A byte is 8-bit long. The reading operations read contiguously from register memory, starting at the address
|
||||
* provided.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to start reading operation
|
||||
* @param [in] length Number of bytes to read from memory
|
||||
* @param [in] buffer Pointer to a byte array to be filled with content from memory. Its size must be enough to contain
|
||||
* at least length bytes
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_regmem_write_mem8
|
||||
*/
|
||||
lr11xx_status_t lr11xx_regmem_read_mem8( const void* context, const uint32_t address, uint8_t* buffer,
|
||||
const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Write bytes into radio TX buffer memory space of LR11XX.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] data The buffer of bytes to write into radio buffer. Its size must be enough to contain length bytes
|
||||
* @param [in] length Number of bytes to write into radio buffer
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_regmem_read_buffer8
|
||||
*/
|
||||
lr11xx_status_t lr11xx_regmem_write_buffer8( const void* context, const uint8_t* buffer, const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read bytes from radio RX buffer memory space of LR11XX.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] offset Memory offset to start reading
|
||||
* @param [in] length Number of bytes to read from radio buffer
|
||||
* @param [in] data Pointer to a byte array to be filled with content from radio buffer. Its size must be enough to
|
||||
* contain at least length bytes
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_regmem_write_buffer8
|
||||
*/
|
||||
lr11xx_status_t lr11xx_regmem_read_buffer8( const void* context, uint8_t* buffer, const uint8_t offset,
|
||||
const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Clear radio RX buffer
|
||||
*
|
||||
* Set to 0x00 all content of the radio RX buffer
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_regmem_clear_rxbuffer( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Read-modify-write data at given register/memory address
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address The register memory address to be modified
|
||||
* @param [in] mask The mask to be applied on read data
|
||||
* @param [in] data The data to be written
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_regmem_write_regmem32_mask( const void* context, const uint32_t address, const uint32_t mask,
|
||||
const uint32_t data );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_REGMEM_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
201
components/esp_lora_1121/include/lr11xx_driver/lr11xx_rttof.h
Executable file
201
components/esp_lora_1121/include/lr11xx_driver/lr11xx_rttof.h
Executable file
@@ -0,0 +1,201 @@
|
||||
/**
|
||||
* @file lr11xx_rttof.h
|
||||
*
|
||||
* @brief Round-Trip Time of Flight (RTToF) driver definition for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2022. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_RTTOF_H
|
||||
#define LR11XX_RTTOF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lr11xx_rttof_types.h"
|
||||
#include "lr11xx_radio_types.h"
|
||||
#include "lr11xx_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Length in byte of the RTToF result
|
||||
*/
|
||||
#define LR11XX_RTTOF_RESULT_LENGTH ( 4 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTION PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set the RTToF address for this subordinate device.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] address 32-bit subordinate address (default is 0x00000019)
|
||||
* @param [in] check_length Number of bytes to be checked when comparing the device's
|
||||
* address with request address value contained in received
|
||||
* RTToF frames (valid range 1..4, default is 4)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @note The address set by this function is only used in subordinate mode, that is,
|
||||
* when receiving RTToF requests. While processing received request packets,
|
||||
* the RTToF subordinate compares @p check_length bytes (LSB first) of
|
||||
* the request address with its own address. Packets with non-matching request
|
||||
* addresses are discarded.
|
||||
*/
|
||||
lr11xx_status_t lr11xx_rttof_set_address( const void* context, const uint32_t address, const uint8_t check_length );
|
||||
|
||||
/**
|
||||
* @brief Set the RTToF address used for requests sent in manager mode.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] request_address 32-bit request address (default is 0x00000019)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @note The request address set by this function is only used in manager mode,
|
||||
* that is, when sending RTToF requests. The @p request_address is copied
|
||||
* into the corresponding field in the next RTToF request sent.
|
||||
*/
|
||||
lr11xx_status_t lr11xx_rttof_set_request_address( const void* context, const uint32_t request_address );
|
||||
|
||||
/**
|
||||
* @brief Set the transceiver RX/TX delay indicator to be compensated during RTToF.
|
||||
*
|
||||
* The transceiver hardware induces a delay depending on the physical layer
|
||||
* configuration (bandwidth, spreading factor). To achieve the desired RTToF
|
||||
* accuracy, this delay needs to be compensated by a calibration value.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] delay_indicator Delay value corresponding to the used bandwidth and spreading factor
|
||||
*
|
||||
* @returns lr11xx_status_t Operation status
|
||||
*
|
||||
* @note The same delay_indicator value needs to be configured in both manager and subordinate devices.
|
||||
*/
|
||||
lr11xx_status_t lr11xx_rttof_set_rx_tx_delay_indicator( const void* context, const uint32_t delay_indicator );
|
||||
|
||||
/**
|
||||
* @brief Configure RTToF specific parameters.
|
||||
*
|
||||
* It is recommended to always call this command when configuring the RTToF operation with @p nb_symbols = 15.
|
||||
* This value balances the RTToF accuracy and power consumption.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] nb_symbols Number of symbols contained in responses sent by subordinates
|
||||
*
|
||||
* @returns lr11xx_status_t Operation status
|
||||
*
|
||||
* @note The RTToF parameters need to be configured in both manager and subordinate devices.
|
||||
*/
|
||||
lr11xx_status_t lr11xx_rttof_set_parameters( const void* context, const uint8_t nb_symbols );
|
||||
|
||||
/**
|
||||
* @brief Get the RTToF result on the manager device.
|
||||
*
|
||||
* Retrieve the RTToF result item corresponding to the given item type @p type.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] type Result item type to be retrieved
|
||||
* @param [out] result Result data buffer
|
||||
*
|
||||
* @returns lr11xx_status_t Operation status
|
||||
*
|
||||
* @note This function is only available on devices in manager mode after
|
||||
* the RTToF is terminated.
|
||||
*/
|
||||
lr11xx_status_t lr11xx_rttof_get_raw_result( const void* context, const lr11xx_rttof_result_type_t type,
|
||||
uint8_t result[LR11XX_RTTOF_RESULT_LENGTH] );
|
||||
|
||||
/**
|
||||
* @brief Convert the raw distance result obtained from the device to a distance result [m].
|
||||
*
|
||||
* This function is meaningful only to convert a RTToF result obtained by calling @p lr11xx_rttof_get_raw_result
|
||||
* with type set to @p LR11XX_RTTOF_RESULT_TYPE_RAW
|
||||
*
|
||||
* @param [in] rttof_bw Bandwidth used during RTToF
|
||||
* @param [in] raw_distance_buf Buffer containing the raw distance result
|
||||
*
|
||||
* @returns int32_t Distance result [m]
|
||||
*
|
||||
* @see lr11xx_rttof_get_raw_result
|
||||
*
|
||||
* @note The caller must ensure that the @p rttof_bw parameter is one of the supported ones,
|
||||
* i.e., #LR11XX_RADIO_LORA_BW_125, #LR11XX_RADIO_LORA_BW_250, #LR11XX_RADIO_LORA_BW_500.
|
||||
*/
|
||||
int32_t lr11xx_rttof_distance_raw_to_meter( lr11xx_radio_lora_bw_t rttof_bw,
|
||||
const uint8_t raw_distance_buf[LR11XX_RTTOF_RESULT_LENGTH] );
|
||||
|
||||
/**
|
||||
* @brief Convert the raw RSSI result obtained from the device to an RSSI result.
|
||||
*
|
||||
* This function is meaningful only to convert a RTToF result obtained by calling @p lr11xx_rttof_get_raw_result
|
||||
* with type set to @p LR11XX_RTTOF_RESULT_TYPE_RSSI
|
||||
*
|
||||
* @param [in] raw_rssi_buf Buffer containing the raw RSSI result
|
||||
*
|
||||
* @returns int8_t RSSI result [dBm]
|
||||
*
|
||||
* @see lr11xx_rttof_get_raw_result
|
||||
*/
|
||||
static inline int8_t lr11xx_rttof_rssi_raw_to_value( const uint8_t raw_rssi_buf[LR11XX_RTTOF_RESULT_LENGTH] )
|
||||
{
|
||||
// Only the last byte is meaningful
|
||||
return -( int8_t )( raw_rssi_buf[3] >> 1 );
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_RTTOF_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
82
components/esp_lora_1121/include/lr11xx_driver/lr11xx_rttof_types.h
Executable file
82
components/esp_lora_1121/include/lr11xx_driver/lr11xx_rttof_types.h
Executable file
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* @file lr11xx_rttof_types.h
|
||||
*
|
||||
* @brief Round-Trip Time of Flight (RTToF) driver types for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2022. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_RTTOF_TYPES_H
|
||||
#define LR11XX_RTTOF_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Round-Trip Time of Flight result types
|
||||
*/
|
||||
typedef enum lr11xx_rttof_result_type_e
|
||||
{
|
||||
LR11XX_RTTOF_RESULT_TYPE_RAW = 0, ///< Raw distance result
|
||||
LR11XX_RTTOF_RESULT_TYPE_RSSI, ///< RTToF RSSI
|
||||
} lr11xx_rttof_result_type_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTION PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_RTTOF_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
594
components/esp_lora_1121/include/lr11xx_driver/lr11xx_system.h
Executable file
594
components/esp_lora_1121/include/lr11xx_driver/lr11xx_system.h
Executable file
@@ -0,0 +1,594 @@
|
||||
/*!
|
||||
* @file lr11xx_system.h
|
||||
*
|
||||
* @brief System driver definition for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_SYSTEM_H
|
||||
#define LR11XX_SYSTEM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "lr11xx_system_types.h"
|
||||
#include "lr11xx_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Frequency step in MHz used to compute the image calibration parameter
|
||||
*
|
||||
* @see lr11xx_system_calibrate_image_in_mhz
|
||||
*/
|
||||
#define LR11XX_SYSTEM_IMAGE_CALIBRATION_STEP_IN_MHZ 4
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Reset the radio
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_reset( const void* context );
|
||||
|
||||
/**
|
||||
* @brief Wake the radio up from sleep mode.
|
||||
*
|
||||
* @param [in] context Chip implementation context.
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_wakeup( const void* context );
|
||||
|
||||
/**
|
||||
* @brief Abort a blocking command.
|
||||
*
|
||||
* @param [in] context Chip implementation context.
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_abort_blocking_cmd( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Return stat1, stat2, and irq_status
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] stat1 Pointer to a variable for holding stat1. Can be NULL.
|
||||
* @param [out] stat2 Pointer to a variable for holding stat2. Can be NULL.
|
||||
* @param [out] irq_status Pointer to a variable for holding irq_status. Can be NULL.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @remark To simplify system integration, this function does not actually execute the GetStatus command, which would
|
||||
* require bidirectional SPI communication. It obtains the stat1, stat2, and irq_status values by performing an ordinary
|
||||
* SPI read (which is required to send null/NOP bytes on the MOSI line). This is possible since the LR11XX returns these
|
||||
* values automatically whenever a read that does not directly follow a response-carrying command is performed.
|
||||
* Unlike with the GetStatus command, however, the reset status information is NOT cleared by this command. The function
|
||||
* @ref lr11xx_system_clear_reset_status_info may be used for this purpose when necessary.
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_get_status( const void* context, lr11xx_system_stat1_t* stat1,
|
||||
lr11xx_system_stat2_t* stat2, lr11xx_system_irq_mask_t* irq_status );
|
||||
|
||||
/*!
|
||||
* @brief Clear the reset status information stored in stat2
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_clear_reset_status_info( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Return irq_status
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] irq_status irq_status status variable
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
static inline lr11xx_status_t lr11xx_system_get_irq_status( const void* context, lr11xx_system_irq_mask_t* irq_status )
|
||||
{
|
||||
return lr11xx_system_get_status( context, 0, 0, irq_status );
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Return the version of the system (hardware and software)
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] version Pointer to the structure holding the system version
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_get_version( const void* context, lr11xx_system_version_t* version );
|
||||
|
||||
/*!
|
||||
* @brief Return the system errors
|
||||
*
|
||||
* Errors may be fixed following:
|
||||
* - calibration error can be fixed by attempting another RC calibration;
|
||||
* - XOsc related errors may be due to hardware problems, can be fixed by reset;
|
||||
* - PLL lock related errors can be due to not-locked PLL, or by attempting to use an out-of-band frequency, can be
|
||||
* fixed by executing a PLL calibration, or by using other frequencies.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] errors Pointer to a value holding error flags
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_calibrate, lr11xx_system_calibrate_image, lr11xx_system_clear_errors
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_get_errors( const void* context, uint16_t* errors );
|
||||
|
||||
/*!
|
||||
* @brief Clear all error flags pending.
|
||||
*
|
||||
* This function cannot be used to clear flags individually.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_get_errors
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_clear_errors( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief lr11xx_system_calibrate the requested blocks
|
||||
*
|
||||
* This function can be called in any mode of the chip.
|
||||
*
|
||||
* The chip will return to standby RC mode on exit. Potential calibration issues can be read out with
|
||||
* lr11xx_system_get_errors command.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] calib_param Structure holding the reference to blocks to be calibrated
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_get_errors
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_calibrate( const void* context, const uint8_t calib_param );
|
||||
|
||||
/*!
|
||||
* @brief Configure the regulator mode to be used in specific modes
|
||||
*
|
||||
* This function shall only be called in standby RC mode.
|
||||
*
|
||||
* The reg_mode parameter defines if the DC-DC converter is switched on in the following modes: STANDBY XOSC, FS, RX, TX
|
||||
* and RX_CAPTURE.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] reg_mode Regulator mode configuration
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_set_reg_mode( const void* context, const lr11xx_system_reg_mode_t reg_mode );
|
||||
|
||||
/*!
|
||||
* @brief Launch an image calibration valid for all frequencies inside an interval, in steps
|
||||
*
|
||||
* This function can be called in any mode of the chip.
|
||||
*
|
||||
* The chip will return to standby RC mode on exit. Potential calibration issues can be read out with
|
||||
* lr11xx_system_get_errors command.
|
||||
*
|
||||
* The frequencies given in parameters are defined in 4MHz step (Eg. 900MHz corresponds to 0xE1). If freq1 = freq2, only
|
||||
* one calibration is performed.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] freq1 Image calibration interval lower bound, in steps
|
||||
* @param [in] freq2 Image calibration interval upper bound, in steps
|
||||
*
|
||||
* @remark freq1 must be less than or equal to freq2
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_get_errors
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_calibrate_image( const void* context, const uint8_t freq1, const uint8_t freq2 );
|
||||
|
||||
/*!
|
||||
* @brief Launch an image calibration valid for all frequencies inside an interval, in MHz
|
||||
*
|
||||
* @remark This function relies on @ref lr11xx_system_calibrate_image
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] freq1_in_mhz Image calibration interval lower bound, in MHz
|
||||
* @param [in] freq2_in_mhz Image calibration interval upper bound, in MHz
|
||||
*
|
||||
* @remark freq1 must be less than or equal to freq2
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_calibrate_image
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_calibrate_image_in_mhz( const void* context, const uint16_t freq1_in_mhz,
|
||||
const uint16_t freq2_in_mhz );
|
||||
|
||||
/*!
|
||||
* @brief Set the RF switch configurations for each RF setup
|
||||
*
|
||||
* This function shall only be called in standby RC mode.
|
||||
*
|
||||
* By default, no DIO is used to control a RF switch. All DIOs are set in High-Z mode.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] rf_switch_cfg Pointer to a structure that holds the switches configuration
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_set_dio_as_rf_switch( const void* context,
|
||||
const lr11xx_system_rfswitch_cfg_t* rf_switch_cfg );
|
||||
|
||||
/*!
|
||||
* @brief Set which interrupt signals are redirected to the dedicated DIO pin
|
||||
*
|
||||
* By default, no interrupt signal is redirected.
|
||||
*
|
||||
* The dedicated DIO pin will remain asserted until all redirected interrupt signals are cleared with a call to
|
||||
* lr11xx_system_clear_irq_status.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] irqs_to_enable_dio1 Variable that holds the interrupt mask for dio1
|
||||
* @param [in] irqs_to_enable_dio2 Variable that holds the interrupt mask for dio2
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_clear_irq_status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_set_dio_irq_params( const void* context,
|
||||
const lr11xx_system_irq_mask_t irqs_to_enable_dio1,
|
||||
const lr11xx_system_irq_mask_t irqs_to_enable_dio2 );
|
||||
|
||||
/*!
|
||||
* @brief Clear requested bits in the internal pending interrupt register
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] irqs_to_clear Variable that holds the interrupts to be cleared
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_clear_irq_status( const void* context, const lr11xx_system_irq_mask_t irqs_to_clear );
|
||||
|
||||
/**
|
||||
* @brief This helper function clears any radio irq status flags that are set and returns the flags that were cleared.
|
||||
*
|
||||
* @param [in] context Chip implementation context.
|
||||
* @param [out] irq Pointer to a variable for holding the system interrupt status. Can be NULL.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_get_irq_status, lr11xx_system_clear_irq_status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_get_and_clear_irq_status( const void* context, lr11xx_system_irq_mask_t* irq );
|
||||
|
||||
/*!
|
||||
* @brief Defines which clock is used as Low Frequency (LF) clock
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] lfclock_cfg Low frequency clock configuration
|
||||
* @param [in] wait_for_32k_ready Tells the radio if it has to check if 32k source is ready before driving busy low
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_calibrate, lr11xx_system_calibrate_image
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_cfg_lfclk( const void* context, const lr11xx_system_lfclk_cfg_t lfclock_cfg,
|
||||
const bool wait_for_32k_ready );
|
||||
|
||||
/*!
|
||||
* @brief Enable and configure TCXO supply voltage and detection timeout
|
||||
*
|
||||
* This function shall only be called in standby RC mode.
|
||||
*
|
||||
* The timeout parameter is the maximum time the firmware waits for the TCXO to be ready. The timeout duration is given
|
||||
* by: \f$ timeout\_duration\_us = timeout \times 30.52 \f$
|
||||
*
|
||||
* The TCXO mode can be disabled by setting timeout parameter to 0.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] tune Supply voltage value
|
||||
* @param [in] timeout Gating time before which the radio starts its Rx / Tx operation
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_calibrate, lr11xx_system_calibrate_image
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_set_tcxo_mode( const void* context, const lr11xx_system_tcxo_supply_voltage_t tune,
|
||||
const uint32_t timeout );
|
||||
|
||||
/*!
|
||||
* @brief Software reset of the chip.
|
||||
*
|
||||
* This function should be used to reboot the chip in a specified mode. Rebooting in flash mode presumes that the
|
||||
* content in flash memory is not corrupted (i.e. the integrity check performed by the bootloader before executing the
|
||||
* first instruction in flash is OK).
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] stay_in_bootloader Selector to stay in bootloader or execute flash code after reboot. If true, the
|
||||
* bootloader will not execute the flash code but activate SPI interface to allow firmware upgrade
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_reboot( const void* context, const bool stay_in_bootloader );
|
||||
|
||||
/*!
|
||||
* @brief Returns the value of Vbat
|
||||
*
|
||||
* Vbat value (in V) is a function of Vana (typ. 1.35V) using the following
|
||||
* formula: \f$ Vbat_{V} = (5 \times \frac{Vbat}{255} - 1) \times Vana \f$
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] vbat A pointer to the Vbat value
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_get_vbat( const void* context, uint8_t* vbat );
|
||||
|
||||
/*!
|
||||
* @brief Returns the value of Temp
|
||||
*
|
||||
* The temperature (in °C) is a function of Vana (typ. 1.35V), Vbe25 (Vbe voltage @ 25°C, typ. 0.7295V) and VbeSlope
|
||||
* (typ. -1.7mV/°C) using the following formula:
|
||||
* \f$ Temperature_{°C} = (\frac{Temp(10:0)}{2047} \times Vana - Vbe25) \times \frac{1000}{VbeSlope} + 25 \f$
|
||||
*
|
||||
* @remark If a TCXO is used, make sure to configure it with @ref lr11xx_system_set_tcxo_mode before calling this
|
||||
* function
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] temp A pointer to the Temp value
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_get_temp( const void* context, uint16_t* temp );
|
||||
|
||||
/*!
|
||||
* @brief Set the device into Sleep or Deep Sleep Mode
|
||||
*
|
||||
* The sleep_cfg parameter defines in which sleep mode the device is put and if it wakes up after a given time on the
|
||||
* RTC event.
|
||||
*
|
||||
* The sleep_time parameter is taken into account only when RtcTimeout = 1. It sets the sleep time in number of clock
|
||||
* cycles: \f$ sleep\_time\_ms = sleep_time \times \frac{1}{32.768} \f$
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] sleep_cfg Sleep mode configuration
|
||||
* @param [in] sleep_time Value of the RTC timeout (if RtcTimeout = 1)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_set_standby, lr11xx_system_set_fs
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_set_sleep( const void* context, const lr11xx_system_sleep_cfg_t sleep_cfg,
|
||||
const uint32_t sleep_time );
|
||||
|
||||
/*!
|
||||
* @brief Set the device into the requested Standby mode
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] standby_cfg Stand by mode configuration (RC or XOSC)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_set_sleep, lr11xx_system_set_fs
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_set_standby( const void* context, const lr11xx_system_standby_cfg_t standby_cfg );
|
||||
|
||||
/*!
|
||||
* @brief Set the device into Frequency Synthesis (FS) mode
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_set_standby, lr11xx_system_set_sleep
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_set_fs( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Erase an info page
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] info_page_id Info page to be erased. Only LR11XX_SYSTEM_INFOPAGE_1 is allowed.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_write_infopage, lr11xx_system_read_infopage
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_erase_infopage( const void* context, const lr11xx_system_infopage_id_t info_page_id );
|
||||
|
||||
/*!
|
||||
* @brief Write data in an info page
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] info_page_id Info page where data are written. Only LR11XX_SYSTEM_INFOPAGE_1 is allowed.
|
||||
* @param [in] address Address within the info page (aligned on 32-bit data)
|
||||
* @param [in] data Pointer to the data to write (data buffer shall be - at least - length words long)
|
||||
* @param [in] length Number of 32-bit data to write (maximum value is 64)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_erase_infopage, lr11xx_system_read_infopage
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_write_infopage( const void* context, const lr11xx_system_infopage_id_t info_page_id,
|
||||
const uint16_t address, const uint32_t* data, const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read data from an info page
|
||||
*
|
||||
* It is possible to cross from page 0 to 1 if (address + length >= 512)
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] info_page_id Info page where data are read
|
||||
* @param [in] address Address within the info page (aligned on 32-bit data)
|
||||
* @param [out] data Pointer to the data to read (data buffer shall be - at least - length words long)
|
||||
* @param [in] length Number of 32-bit data to read (maximum value is 64)
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_system_erase_infopage, lr11xx_system_write_infopage
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_read_infopage( const void* context, const lr11xx_system_infopage_id_t info_page_id,
|
||||
const uint16_t address, uint32_t* data, const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Read and return the Unique Identifier of the LR11XX
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] unique_identifier The buffer to be filled with the Unique Identifier of the LR11XX. It is up to the
|
||||
* application to ensure unique_identifier is long enough to hold the unique identifier
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see LR11XX_SYSTEM_UID_LENGTH
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_read_uid( const void* context, lr11xx_system_uid_t unique_identifier );
|
||||
|
||||
/*!
|
||||
* @brief Read and return the Join EUI of the LR11XX
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] join_eui The buffer to be filled with Join EUI of the LR11XX. It is up to the application to ensure
|
||||
* join_eui is long enough to hold the join EUI
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see LR11XX_SYSTEM_JOIN_EUI_LENGTH
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_read_join_eui( const void* context, lr11xx_system_join_eui_t join_eui );
|
||||
|
||||
/*!
|
||||
* @brief Compute and return the PIN of the LR11XX based on factory default EUIs
|
||||
*
|
||||
* @remark Calling this command also triggers a derivation of network and application keys (available as @ref
|
||||
* LR11XX_CRYPTO_KEYS_IDX_NWK_KEY and @ref LR11XX_CRYPTO_KEYS_IDX_APP_KEY) based on factory default EUIs
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] pin The buffer to be filled with PIN of the LR11XX. It is up to the application to ensure pin is long
|
||||
* enough to hold the PIN
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see LR11XX_SYSTEM_PIN_LENGTH
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_read_pin( const void* context, lr11xx_system_pin_t pin );
|
||||
|
||||
/*!
|
||||
* @brief Compute and return the PIN of the LR11XX based on EUIs provided as parameters
|
||||
*
|
||||
* @remark Calling this command also triggers a derivation of network and application keys (available as @ref
|
||||
* LR11XX_CRYPTO_KEYS_IDX_NWK_KEY and @ref LR11XX_CRYPTO_KEYS_IDX_APP_KEY) based on EUIs provided as parameters
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] device_eui Custom Device EUI
|
||||
* @param [in] join_eui Custom Join EUI
|
||||
* @param [in] rfu Parameter RFU - shall be set to 0x00
|
||||
* @param [out] pin The buffer to be filled with PIN of the LR11XX. It is up to the application to ensure pin is long
|
||||
* enough to hold the PIN
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see LR11XX_SYSTEM_PIN_LENGTH
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_read_pin_custom_eui( const void* context, lr11xx_system_uid_t device_eui,
|
||||
lr11xx_system_join_eui_t join_eui, uint8_t rfu,
|
||||
lr11xx_system_pin_t pin );
|
||||
|
||||
/*!
|
||||
* @brief Read and return a 32-bit random number
|
||||
*
|
||||
* @remark Radio operating mode must be set into standby.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] random_number 32-bit random number
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_get_random_number( const void* context, uint32_t* random_number );
|
||||
|
||||
/*!
|
||||
* @brief Enable the CRC on SPI transactions
|
||||
*
|
||||
* @remark This command shall always be sent with a CRC (to both enable and disable the feature). The function does not
|
||||
* take care of this additional byte - which is under the responsibility of the underlying HAL functions
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] enable_crc CRC
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_enable_spi_crc( const void* context, bool enable_crc );
|
||||
|
||||
/*!
|
||||
* @brief Configure the GPIO drive in sleep mode
|
||||
*
|
||||
* @remark GPIO stands for RF switch and IRQ line DIOs
|
||||
*
|
||||
* @note This command is available from firmware version 0x0306
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] enable_drive GPIO drive configuration (true: enabled / false: disabled)
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_system_drive_dio_in_sleep_mode( const void* context, bool enable_drive );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_SYSTEM_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
349
components/esp_lora_1121/include/lr11xx_driver/lr11xx_system_types.h
Executable file
349
components/esp_lora_1121/include/lr11xx_driver/lr11xx_system_types.h
Executable file
@@ -0,0 +1,349 @@
|
||||
/*!
|
||||
* @file lr11xx_system_types.h
|
||||
*
|
||||
* @brief System driver types for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_SYSTEM_TYPES_H
|
||||
#define LR11XX_SYSTEM_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Length in byte of the LR11XX version blob
|
||||
*/
|
||||
#define LR11XX_SYSTEM_VERSION_LENGTH ( 4 )
|
||||
|
||||
/*!
|
||||
* @brief Length of the LR11XX Unique Identifier in bytes
|
||||
*
|
||||
* The LR11XX Unique Identifiers is an 8 byte long buffer
|
||||
*/
|
||||
#define LR11XX_SYSTEM_UID_LENGTH ( 8 )
|
||||
#define LR11XX_SYSTEM_JOIN_EUI_LENGTH ( 8 )
|
||||
#define LR11XX_SYSTEM_PIN_LENGTH ( 4 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Fixed-length array to store a UID
|
||||
*/
|
||||
typedef uint8_t lr11xx_system_uid_t[LR11XX_SYSTEM_UID_LENGTH];
|
||||
|
||||
/**
|
||||
* @brief Fixed-length array to store a joinEUI
|
||||
*/
|
||||
typedef uint8_t lr11xx_system_join_eui_t[LR11XX_SYSTEM_JOIN_EUI_LENGTH];
|
||||
|
||||
/**
|
||||
* @brief Fixed-length array to store a PIN
|
||||
*/
|
||||
typedef uint8_t lr11xx_system_pin_t[LR11XX_SYSTEM_PIN_LENGTH];
|
||||
|
||||
/**
|
||||
* @brief Type to store system interrupt flags
|
||||
*/
|
||||
typedef uint32_t lr11xx_system_irq_mask_t;
|
||||
|
||||
/**
|
||||
* @brief Interrupt flags
|
||||
*/
|
||||
enum lr11xx_system_irq_e
|
||||
{
|
||||
LR11XX_SYSTEM_IRQ_NONE = ( 0 << 0 ),
|
||||
LR11XX_SYSTEM_IRQ_TX_DONE = ( 1 << 2 ),
|
||||
LR11XX_SYSTEM_IRQ_RX_DONE = ( 1 << 3 ),
|
||||
LR11XX_SYSTEM_IRQ_PREAMBLE_DETECTED = ( 1 << 4 ),
|
||||
LR11XX_SYSTEM_IRQ_SYNC_WORD_HEADER_VALID = ( 1 << 5 ),
|
||||
LR11XX_SYSTEM_IRQ_HEADER_ERROR = ( 1 << 6 ),
|
||||
LR11XX_SYSTEM_IRQ_CRC_ERROR = ( 1 << 7 ),
|
||||
LR11XX_SYSTEM_IRQ_CAD_DONE = ( 1 << 8 ),
|
||||
LR11XX_SYSTEM_IRQ_CAD_DETECTED = ( 1 << 9 ),
|
||||
LR11XX_SYSTEM_IRQ_TIMEOUT = ( 1 << 10 ),
|
||||
LR11XX_SYSTEM_IRQ_LR_FHSS_INTRA_PKT_HOP = ( 1 << 11 ),
|
||||
LR11XX_SYSTEM_IRQ_RTTOF_REQ_VALID = ( 1 << 14 ),
|
||||
LR11XX_SYSTEM_IRQ_RTTOF_REQ_DISCARDED = ( 1 << 15 ),
|
||||
LR11XX_SYSTEM_IRQ_RTTOF_RESP_DONE = ( 1 << 16 ),
|
||||
LR11XX_SYSTEM_IRQ_RTTOF_EXCH_VALID = ( 1 << 17 ),
|
||||
LR11XX_SYSTEM_IRQ_RTTOF_TIMEOUT = ( 1 << 18 ),
|
||||
LR11XX_SYSTEM_IRQ_GNSS_SCAN_DONE = ( 1 << 19 ),
|
||||
LR11XX_SYSTEM_IRQ_WIFI_SCAN_DONE = ( 1 << 20 ),
|
||||
LR11XX_SYSTEM_IRQ_EOL = ( 1 << 21 ),
|
||||
LR11XX_SYSTEM_IRQ_CMD_ERROR = ( 1 << 22 ),
|
||||
LR11XX_SYSTEM_IRQ_ERROR = ( 1 << 23 ),
|
||||
LR11XX_SYSTEM_IRQ_FSK_LEN_ERROR = ( 1 << 24 ),
|
||||
LR11XX_SYSTEM_IRQ_FSK_ADDR_ERROR = ( 1 << 25 ),
|
||||
LR11XX_SYSTEM_IRQ_LORA_RX_TIMESTAMP =
|
||||
( 1 << 27 ), //!< Available since firmware LR1110 0x0308 / LR1120 0x0102 / LR1121 0x0102
|
||||
LR11XX_SYSTEM_IRQ_ALL_MASK =
|
||||
LR11XX_SYSTEM_IRQ_TX_DONE | LR11XX_SYSTEM_IRQ_RX_DONE | LR11XX_SYSTEM_IRQ_PREAMBLE_DETECTED |
|
||||
LR11XX_SYSTEM_IRQ_SYNC_WORD_HEADER_VALID | LR11XX_SYSTEM_IRQ_HEADER_ERROR | LR11XX_SYSTEM_IRQ_CRC_ERROR |
|
||||
LR11XX_SYSTEM_IRQ_CAD_DONE | LR11XX_SYSTEM_IRQ_CAD_DETECTED | LR11XX_SYSTEM_IRQ_TIMEOUT |
|
||||
LR11XX_SYSTEM_IRQ_LR_FHSS_INTRA_PKT_HOP | LR11XX_SYSTEM_IRQ_RTTOF_REQ_VALID |
|
||||
LR11XX_SYSTEM_IRQ_RTTOF_REQ_DISCARDED | LR11XX_SYSTEM_IRQ_RTTOF_RESP_DONE | LR11XX_SYSTEM_IRQ_RTTOF_EXCH_VALID |
|
||||
LR11XX_SYSTEM_IRQ_RTTOF_TIMEOUT | LR11XX_SYSTEM_IRQ_GNSS_SCAN_DONE | LR11XX_SYSTEM_IRQ_WIFI_SCAN_DONE |
|
||||
LR11XX_SYSTEM_IRQ_EOL | LR11XX_SYSTEM_IRQ_CMD_ERROR | LR11XX_SYSTEM_IRQ_ERROR |
|
||||
LR11XX_SYSTEM_IRQ_FSK_LEN_ERROR | LR11XX_SYSTEM_IRQ_FSK_ADDR_ERROR | LR11XX_SYSTEM_IRQ_LORA_RX_TIMESTAMP,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Calibration flags
|
||||
*/
|
||||
enum lr11xx_system_calibration_e
|
||||
{
|
||||
LR11XX_SYSTEM_CALIB_LF_RC_MASK = ( 1 << 0 ),
|
||||
LR11XX_SYSTEM_CALIB_HF_RC_MASK = ( 1 << 1 ),
|
||||
LR11XX_SYSTEM_CALIB_PLL_MASK = ( 1 << 2 ),
|
||||
LR11XX_SYSTEM_CALIB_ADC_MASK = ( 1 << 3 ),
|
||||
LR11XX_SYSTEM_CALIB_IMG_MASK = ( 1 << 4 ),
|
||||
LR11XX_SYSTEM_CALIB_PLL_TX_MASK = ( 1 << 5 ),
|
||||
};
|
||||
|
||||
typedef uint8_t lr11xx_system_cal_mask_t;
|
||||
|
||||
/**
|
||||
* @brief Error flags
|
||||
*/
|
||||
enum lr11xx_system_errors_e
|
||||
{
|
||||
LR11XX_SYSTEM_ERRORS_LF_RC_CALIB_MASK = ( 1 << 0 ),
|
||||
LR11XX_SYSTEM_ERRORS_HF_RC_CALIB_MASK = ( 1 << 1 ),
|
||||
LR11XX_SYSTEM_ERRORS_ADC_CALIB_MASK = ( 1 << 2 ),
|
||||
LR11XX_SYSTEM_ERRORS_PLL_CALIB_MASK = ( 1 << 3 ),
|
||||
LR11XX_SYSTEM_ERRORS_IMG_CALIB_MASK = ( 1 << 4 ),
|
||||
LR11XX_SYSTEM_ERRORS_HF_XOSC_START_MASK = ( 1 << 5 ),
|
||||
LR11XX_SYSTEM_ERRORS_LF_XOSC_START_MASK = ( 1 << 6 ),
|
||||
LR11XX_SYSTEM_ERRORS_PLL_LOCK_MASK = ( 1 << 7 ),
|
||||
};
|
||||
|
||||
typedef uint16_t lr11xx_system_errors_t;
|
||||
|
||||
/**
|
||||
* @brief Chip modes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_SYSTEM_CHIP_MODE_SLEEP = 0x00,
|
||||
LR11XX_SYSTEM_CHIP_MODE_STBY_RC = 0x01,
|
||||
LR11XX_SYSTEM_CHIP_MODE_STBY_XOSC = 0x02,
|
||||
LR11XX_SYSTEM_CHIP_MODE_FS = 0x03,
|
||||
LR11XX_SYSTEM_CHIP_MODE_RX = 0x04,
|
||||
LR11XX_SYSTEM_CHIP_MODE_TX = 0x05,
|
||||
LR11XX_SYSTEM_CHIP_MODE_LOC = 0x06,
|
||||
} lr11xx_system_chip_modes_t;
|
||||
|
||||
/**
|
||||
* @brief Reset status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_SYSTEM_RESET_STATUS_CLEARED = 0x00,
|
||||
LR11XX_SYSTEM_RESET_STATUS_ANALOG = 0x01,
|
||||
LR11XX_SYSTEM_RESET_STATUS_EXTERNAL = 0x02,
|
||||
LR11XX_SYSTEM_RESET_STATUS_SYSTEM = 0x03,
|
||||
LR11XX_SYSTEM_RESET_STATUS_WATCHDOG = 0x04,
|
||||
LR11XX_SYSTEM_RESET_STATUS_IOCD_RESTART = 0x05,
|
||||
LR11XX_SYSTEM_RESET_STATUS_RTC_RESTART = 0x06,
|
||||
} lr11xx_system_reset_status_t;
|
||||
|
||||
/**
|
||||
* @brief Command status
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_SYSTEM_CMD_STATUS_FAIL = 0x00,
|
||||
LR11XX_SYSTEM_CMD_STATUS_PERR = 0x01,
|
||||
LR11XX_SYSTEM_CMD_STATUS_OK = 0x02,
|
||||
LR11XX_SYSTEM_CMD_STATUS_DATA = 0x03,
|
||||
} lr11xx_system_command_status_t;
|
||||
|
||||
/**
|
||||
* @brief Low-frequency clock modes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_SYSTEM_LFCLK_RC = 0x00, //!< (Default)
|
||||
LR11XX_SYSTEM_LFCLK_XTAL = 0x01,
|
||||
LR11XX_SYSTEM_LFCLK_EXT = 0x02
|
||||
} lr11xx_system_lfclk_cfg_t;
|
||||
|
||||
/**
|
||||
* @brief Regulator modes
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_SYSTEM_REG_MODE_LDO = 0x00, //!< (Default)
|
||||
LR11XX_SYSTEM_REG_MODE_DCDC = 0x01,
|
||||
} lr11xx_system_reg_mode_t;
|
||||
|
||||
/**
|
||||
* @brief Info page ID
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_SYSTEM_INFOPAGE_0 = 0x00, //!< Info page #0
|
||||
LR11XX_SYSTEM_INFOPAGE_1 = 0x01, //!< Info page #1
|
||||
} lr11xx_system_infopage_id_t;
|
||||
|
||||
/**
|
||||
* @brief RF switch configuration pin
|
||||
*/
|
||||
enum lr11xx_system_rfswitch_cfg_pin_e
|
||||
{
|
||||
LR11XX_SYSTEM_RFSW0_HIGH = ( 1 << 0 ),
|
||||
LR11XX_SYSTEM_RFSW1_HIGH = ( 1 << 1 ),
|
||||
LR11XX_SYSTEM_RFSW2_HIGH = ( 1 << 2 ),
|
||||
LR11XX_SYSTEM_RFSW3_HIGH = ( 1 << 3 ),
|
||||
LR11XX_SYSTEM_RFSW4_HIGH = ( 1 << 4 ),
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief RF switch configuration structure definition
|
||||
*/
|
||||
typedef struct lr11xx_system_rfswitch_cfg_s
|
||||
{
|
||||
uint8_t enable;
|
||||
uint8_t standby;
|
||||
uint8_t rx;
|
||||
uint8_t tx;
|
||||
uint8_t tx_hp;
|
||||
uint8_t tx_hf;
|
||||
uint8_t gnss;
|
||||
uint8_t wifi;
|
||||
} lr11xx_system_rfswitch_cfg_t;
|
||||
|
||||
/**
|
||||
* @brief Stand by configuration values
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_SYSTEM_STANDBY_CFG_RC = 0x00,
|
||||
LR11XX_SYSTEM_STANDBY_CFG_XOSC = 0x01
|
||||
} lr11xx_system_standby_cfg_t;
|
||||
|
||||
/**
|
||||
* @brief TCXO supply voltage values
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_SYSTEM_TCXO_CTRL_1_6V = 0x00, //!< Supply voltage = 1.6v
|
||||
LR11XX_SYSTEM_TCXO_CTRL_1_7V = 0x01, //!< Supply voltage = 1.7v
|
||||
LR11XX_SYSTEM_TCXO_CTRL_1_8V = 0x02, //!< Supply voltage = 1.8v
|
||||
LR11XX_SYSTEM_TCXO_CTRL_2_2V = 0x03, //!< Supply voltage = 2.2v
|
||||
LR11XX_SYSTEM_TCXO_CTRL_2_4V = 0x04, //!< Supply voltage = 2.4v
|
||||
LR11XX_SYSTEM_TCXO_CTRL_2_7V = 0x05, //!< Supply voltage = 2.7v
|
||||
LR11XX_SYSTEM_TCXO_CTRL_3_0V = 0x06, //!< Supply voltage = 3.0v
|
||||
LR11XX_SYSTEM_TCXO_CTRL_3_3V = 0x07, //!< Supply voltage = 3.3v
|
||||
} lr11xx_system_tcxo_supply_voltage_t;
|
||||
|
||||
/**
|
||||
* @brief Status register 1 structure definition
|
||||
*/
|
||||
typedef struct lr11xx_system_stat1_s
|
||||
{
|
||||
lr11xx_system_command_status_t command_status;
|
||||
bool is_interrupt_active;
|
||||
} lr11xx_system_stat1_t;
|
||||
|
||||
/**
|
||||
* @brief Status register 2 structure definition
|
||||
*/
|
||||
typedef struct lr11xx_system_stat2_s
|
||||
{
|
||||
lr11xx_system_reset_status_t reset_status;
|
||||
lr11xx_system_chip_modes_t chip_mode;
|
||||
bool is_running_from_flash;
|
||||
} lr11xx_system_stat2_t;
|
||||
|
||||
/**
|
||||
* @brief Chip type values
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_SYSTEM_VERSION_TYPE_LR1110 = 0x01,
|
||||
LR11XX_SYSTEM_VERSION_TYPE_LR1120 = 0x02,
|
||||
LR11XX_SYSTEM_VERSION_TYPE_LR1121 = 0x03,
|
||||
} lr11xx_system_version_type_t;
|
||||
|
||||
/**
|
||||
* @brief Version structure definition
|
||||
*/
|
||||
typedef struct lr11xx_system_version_s
|
||||
{
|
||||
uint8_t hw;
|
||||
lr11xx_system_version_type_t type;
|
||||
uint16_t fw;
|
||||
} lr11xx_system_version_t;
|
||||
|
||||
/**
|
||||
* @brief Sleep configuration structure definition
|
||||
*/
|
||||
typedef struct lr11xx_system_sleep_cfg_s
|
||||
{
|
||||
bool is_warm_start;
|
||||
bool is_rtc_timeout;
|
||||
} lr11xx_system_sleep_cfg_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_SYSTEM_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
76
components/esp_lora_1121/include/lr11xx_driver/lr11xx_types.h
Executable file
76
components/esp_lora_1121/include/lr11xx_driver/lr11xx_types.h
Executable file
@@ -0,0 +1,76 @@
|
||||
/*!
|
||||
* @file lr11xx_types.h
|
||||
*
|
||||
* @brief Type definitions for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_TYPES_H
|
||||
#define LR11XX_TYPES_H
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define LR11XX_CMD_LENGTH_MAX ( 512 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief LR11XX status
|
||||
*/
|
||||
typedef enum lr11xx_status_e
|
||||
{
|
||||
LR11XX_STATUS_OK = 0,
|
||||
LR11XX_STATUS_ERROR = 3,
|
||||
} lr11xx_status_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#endif // LR11XX_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
628
components/esp_lora_1121/include/lr11xx_driver/lr11xx_wifi.h
Executable file
628
components/esp_lora_1121/include/lr11xx_driver/lr11xx_wifi.h
Executable file
@@ -0,0 +1,628 @@
|
||||
/*!
|
||||
* @file lr11xx_wifi.h
|
||||
*
|
||||
* @brief Wi-Fi passive scan driver definition for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_WIFI_H
|
||||
#define LR11XX_WIFI_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "lr11xx_regmem.h"
|
||||
#include "lr11xx_wifi_types.h"
|
||||
#include "lr11xx_types.h"
|
||||
#include "lr11xx_system_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_WIFI_N_RESULTS_MAX_PER_CHUNK
|
||||
/*!
|
||||
* @brief The number of results max to fetch per SPI communication with the chip
|
||||
*
|
||||
* This macro is used by the internals of the driver to size the internal
|
||||
* buffers of the driver used in the *read results* functions.
|
||||
*
|
||||
* It can be defined externally at compile time, or just before including this file.
|
||||
*
|
||||
* Its value can be programmatically obtained at runtime by calling lr11xx_wifi_get_nb_results_max_per_chunk() function.
|
||||
*
|
||||
* Its default value is set to the maximum number of results saved by LR11XX chip.
|
||||
*
|
||||
* @warning Its value must be in the range [1,32] (inclusive). Defining out of this range leads to undefined behavior.
|
||||
*/
|
||||
#define LR11XX_WIFI_N_RESULTS_MAX_PER_CHUNK LR11XX_WIFI_MAX_RESULTS
|
||||
#endif // LR11XX_WIFI_N_RESULTS_MAX_PER_CHUNK
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Start a Wi-Fi passive scan operation
|
||||
*
|
||||
* During the complete passive scan operation, the LR11XX remains busy and cannot receive any commands. Using this
|
||||
* command **DOES** reset the results already obtained by previous passive scan operations.
|
||||
*
|
||||
* The result can be read at the end of the passive scan issuing the command lr11xx_wifi_get_nb_results (to get the
|
||||
* number of results to read) and lr11xx_wifi_read_basic_complete_results or
|
||||
* lr11xx_wifi_read_basic_mac_type_channel_results to actually get the result bytes.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] signal_type The type of Wi-Fi Signals to scan for. If LR11XX_WIFI_TYPE_SCAN_B_G_N is selected, the LR11XX
|
||||
* already starts by scanning all selected channels for Wi-Fi signals B. Then the LR11XX scans all selected channels for
|
||||
* Wi-Fi signals G/N.
|
||||
* @param [in] channels Mask of the Wi-Fi channels to scan
|
||||
* @param [in] scan_mode Scan mode to execute
|
||||
* @param [in] max_results The maximal number of results to gather. When this limit is reached, the passive scan
|
||||
* automatically stop. Range of allowed values is [1:32]. Note that value 0 is forbidden.
|
||||
* @param [in] nb_scan_per_channel The number of internal scan sequences per channel scanned. Range of accepted values
|
||||
* is [1:255]. Note that value 0 is forbidden.
|
||||
* @param [in] timeout_in_ms The maximal duration of a single preamble search. Expressed in ms. Range of allowed values
|
||||
* is [1:65535]. Note that value 0 is forbidden.
|
||||
* @param [in] abort_on_timeout If true, the beacon search jumps to next configured Wi-Fi channel (or stop if there is
|
||||
* no more channel to scan) as soon as a search timeout is encountered
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_wifi_read_basic_complete_results, lr11xx_wifi_read_basic_mac_type_channel_results
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_scan( const void* context, const lr11xx_wifi_signal_type_scan_t signal_type,
|
||||
const lr11xx_wifi_channel_mask_t channels, const lr11xx_wifi_mode_t scan_mode,
|
||||
const uint8_t max_results, const uint8_t nb_scan_per_channel,
|
||||
const uint16_t timeout_in_ms, const bool abort_on_timeout );
|
||||
|
||||
/*!
|
||||
* @brief Start a Wi-Fi passive scan for country codes extraction
|
||||
*
|
||||
* This command starts a Wi-Fi passive scan operation for Beacons and Probe Responses on Wi-Fi type B only. It is to be
|
||||
* used to extract the Country Code fields.
|
||||
*
|
||||
* During the passive scan, the results are filtered to keep only single MAC addresses.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] channels_mask Mask of the Wi-Fi channels to scan
|
||||
* @param [in] nb_max_results The maximum number of country code to gather. When this limit is reached, the passive scan
|
||||
* automatically stops. Maximal value is 32
|
||||
* @param [in] nb_scan_per_channel Maximal number of scan attempts per channel. Maximal value is 255
|
||||
* @param [in] timeout_in_ms The maximal duration of a single beacon search. Expressed in ms. Maximal value is 65535 ms
|
||||
* @param [in] abort_on_timeout If true, the beacon search jumps to next configured Wi-Fi channel (or stop if there is
|
||||
* no more channel to scan) as soon as a search timeout is encountered
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_search_country_code( const void* context, const lr11xx_wifi_channel_mask_t channels_mask,
|
||||
const uint8_t nb_max_results, const uint8_t nb_scan_per_channel,
|
||||
const uint16_t timeout_in_ms, const bool abort_on_timeout );
|
||||
|
||||
/*!
|
||||
* @brief Start a Wi-Fi passive scan operation with duration stop conditions
|
||||
*
|
||||
* This passive scan API does not require the number of scan per channel, so
|
||||
* that it searches for Wi-Fi signals until it finds one, or until the
|
||||
* exhaustion of timeout_per_scan_ms or timeout_per_channel_ms.
|
||||
*
|
||||
* The maximal duration of a scan is determined by the number of channels to scan times the timeout_per_channel_ms
|
||||
* configured. However, this duration may be exceeded depending on the crystal drift of the clock source and on the
|
||||
* instant the last Wi-Fi signal is detected by the device.
|
||||
* Therefore the maximal duration of a Wi-Fi scan with this API is provided by the following equations:
|
||||
*
|
||||
* For signal type being `LR11XX_WIFI_TYPE_SCAN_B`, `LR11XX_WIFI_TYPE_SCAN_G` or `LR11XX_WIFI_TYPE_SCAN_N`:
|
||||
*
|
||||
* \f$ T_{max} = N_{channel} \times ((1 + Xtal_{precision})timeout\_per\_channel + T_{offset} ) \f$
|
||||
*
|
||||
* \f$ Xtal_{precision} \f$ depends on the crystal used as clock source.
|
||||
* If the clock source is configured with 32kHz internal RC, then \f$ Xtal_{precision} = 1/100 \f$
|
||||
*
|
||||
* \f$ T_{offset} \f$ depends on the \f$ signal\_type \f$ and the \f$scan\_mode\f$ selected:
|
||||
*
|
||||
* - LR11XX_WIFI_TYPE_SCAN_B:
|
||||
* - if \f$scan\_mode != LR11XX\_WIFI\_SCAN\_MODE\_FULL\_BEACON\f$: 2.31 ms
|
||||
* - if \f$scan\_mode == LR11XX\_WIFI\_SCAN\_MODE\_FULL\_BEACON\f$: 9.59 ms
|
||||
* - LR11XX_WIFI_TYPE_SCAN_G:
|
||||
* - if \f$scan\_mode != LR11XX\_WIFI\_SCAN\_MODE\_FULL\_BEACON\f$: 52.55 ms
|
||||
* - if \f$scan\_mode == LR11XX\_WIFI\_SCAN\_MODE\_FULL\_BEACON\f$: N/A
|
||||
*
|
||||
* For signal type being `LR11XX_WIFI_TYPE_SCAN_B_G_N`:
|
||||
*
|
||||
* \f$ T_{max} = 2 \times N_{channel} \times (1 + Xtal_{precision})timeout\_per\_channel + T_{offset} \f$
|
||||
*
|
||||
* \f$ T_{offset} \f$ depends on the \f$scan\_mode\f$ selected:
|
||||
* - \f$scan\_mode != LR11XX\_WIFI\_SCAN\_MODE\_FULL\_BEACON\f$: 54.86 ms
|
||||
* - \f$scan\_mode == LR11XX\_WIFI\_SCAN\_MODE\_FULL\_BEACON\f$: 9.59 ms.
|
||||
*
|
||||
* @note With \f$scan\_mode != LR11XX\_WIFI\_SCAN\_MODE\_FULL\_BEACON\f$ the T_offset is actually the worst case of
|
||||
* Wi-Fi type B and Wi-Fi type G/N. Moreover, the Wi-Fi types G and N are scanned within the same steps (it is not two
|
||||
* different scans). So the T_offset is the addition of 2.31 + 52.55 = 54.86.
|
||||
*
|
||||
* @note With \f$scan\_mode == LR11XX\_WIFI\_SCAN\_MODE\_FULL\_BEACON\f$, only Wi-Fi types B can be scanned. So scans
|
||||
* for Wi-Fi types G/N are silently discarded. Therefore the T_offset is the same as for scan with Wi-Fi type B.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] signal_type The type of Wi-Fi Signals to scan for. If LR11XX_WIFI_TYPE_SCAN_B_G_N is selected, the LR11XX
|
||||
* already starts by scanning all selected channels for Wi-Fi signals B. Then the LR11XX scans all selected channels for
|
||||
* Wi-Fi signals G/N.
|
||||
* @param [in] channels Mask of the Wi-Fi channels to scan
|
||||
* @param [in] scan_mode Scan mode to execute
|
||||
* @param [in] max_results The maximal number of results to gather. When this
|
||||
* limit is reached, the passive scan automatically stop. Maximal value is 32
|
||||
* @param [in] timeout_per_channel_ms The time to spend scanning one channel. Expressed in ms. Value 0 is forbidden and
|
||||
* will result in the raise of WIFI_SCAN_DONE interrupt, with stat1.command_status being set to
|
||||
* LR11XX_SYSTEM_CMD_STATUS_PERR
|
||||
* @param [in] timeout_per_scan_ms The maximal time to spend in preamble detection for each single scan. The time spent
|
||||
* on preamble search is reset at each new preamble search. If the time spent on preamble search reach this timeout, the
|
||||
* scan on the current channel stops and start on next channel. If set to 0, the command will keep listening until
|
||||
* exhaustion of timeout_per_channel_ms or until nb_max_results is reached. Expressed in ms. Range of allowed values is
|
||||
* [0:65535].
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_wifi_read_basic_results, lr11xx_wifi_read_extended_results
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_scan_time_limit( const void* context, const lr11xx_wifi_signal_type_scan_t signal_type,
|
||||
const lr11xx_wifi_channel_mask_t channels,
|
||||
const lr11xx_wifi_mode_t scan_mode, const uint8_t max_results,
|
||||
const uint16_t timeout_per_channel_ms,
|
||||
const uint16_t timeout_per_scan_ms );
|
||||
|
||||
/*!
|
||||
* @brief Start a Wi-Fi passive scan for country codes extraction with duration stop conditions
|
||||
*
|
||||
* This command starts a Wi-Fi passive scan operation for Beacons and Probe Responses on Wi-Fi type B only. It is to be
|
||||
* used to extract the Country Code fields.
|
||||
* This passive scan API does not require the number of scan per channel, so that it searches for Wi-Fi signals until it
|
||||
* finds one, or until the exhaustion of timeout_per_scan_ms or timeout_per_channel_ms.
|
||||
*
|
||||
* The maximal duration of a scan is determined by the number of channels to scan times the timeout_per_channel_ms
|
||||
* configured. However, this duration may be exceeded depending on the crystal drift of the clock source and on the
|
||||
* instant the last Wi-Fi signal is detected by the device.
|
||||
* Therefore the maximal duration of a Wi-Fi scan with this API is provided by the following equation:
|
||||
*
|
||||
* \f$ T_{max} = N_{channel} \times ((1 + Xtal_{precision})timeout\_per\_channel + T_{offset} ) \f$
|
||||
*
|
||||
* \f$ Xtal_{precision} \f$ depends on the crystal used as clock source.
|
||||
* If the clock source is configured with 32kHz internal RC, then \f$ Xtal_{precision} = 1/100 \f$
|
||||
*
|
||||
* \f$ T_{offset} \f$ is always the same: 9.59 ms.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] channels_mask Mask of the Wi-Fi channels to scan
|
||||
* @param [in] nb_max_results The maximum number of country code to gather. When this limit is reached, the passive scan
|
||||
* automatically stops. Maximal value is 32
|
||||
* @param [in] timeout_per_channel_ms The time to spend scanning one channel. Expressed in ms. Value 0 is forbidden and
|
||||
* will result in the raise of WIFI_SCAN_DONE interrupt, with stat1.command_status being set to
|
||||
* LR11XX_SYSTEM_CMD_STATUS_PERR
|
||||
* @param [in] timeout_per_scan_ms The maximal time to spend in preamble detection for each single scan. The time spent
|
||||
* on preamble search is reset at each new preamble search. If the time spent on preamble search reach this timeout, the
|
||||
* scan on the current channel stops and start on next channel. If set to 0, the command will keep listening until
|
||||
* exhaustion of timeout_per_channel_ms or until nb_max_results is reached. Expressed in ms. Range of allowed values is
|
||||
* [0:65535].
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_search_country_code_time_limit( const void* context,
|
||||
const lr11xx_wifi_channel_mask_t channels_mask,
|
||||
const uint8_t nb_max_results,
|
||||
const uint16_t timeout_per_channel_ms,
|
||||
const uint16_t timeout_per_scan_ms );
|
||||
|
||||
/*!
|
||||
* @brief Returns the number of results currently available in LR11XX
|
||||
*
|
||||
* It can be called before lr11xx_wifi_read_basic_complete_results or lr11xx_wifi_read_basic_mac_type_channel_results to
|
||||
* know the number of results.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] nb_results The number of results available in the LR11XX
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_wifi_read_basic_complete_results, lr11xx_wifi_read_basic_mac_type_channel_results
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_get_nb_results( const void* context, uint8_t* nb_results );
|
||||
|
||||
/*!
|
||||
* @brief Read basic complete results
|
||||
*
|
||||
* This function can be used to fetch all results in a row, or one after the other.
|
||||
* It corresponds to result format @ref ::LR11XX_WIFI_RESULT_FORMAT_BASIC_COMPLETE.
|
||||
*
|
||||
* An example of usage to fetch all results in a row is:
|
||||
* \code{.cpp}
|
||||
* uint8_t nb_results = 0;
|
||||
* lr11xx_wifi_get_nb_results(&radio, &nb_results);
|
||||
* lr11xx_wifi_basic_complete_result_t all_results[LR11XX_WIFI_MAX_RESULTS] = {0};
|
||||
* lr11xx_wifi_read_basic_complete_results(&radio, 0, nb_results, all_results);
|
||||
* \endcode
|
||||
*
|
||||
* On the other hand, fetching result one after the other:
|
||||
* \code{.cpp}
|
||||
* uint8_t nb_results = 0;
|
||||
* lr11xx_wifi_get_nb_results(&radio, &nb_results);
|
||||
* lr11xx_wifi_basic_complete_result_t single_results = {0};
|
||||
* for(uint8_t index_result = 0; index_result < nb_results; index_result++){
|
||||
* lr11xx_wifi_read_basic_complete_results(&radio, index_result, 1, &single_results);
|
||||
* // Do something with single_results
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* @remark This result fetching function **MUST** be used only if the scan function call was made with Scan Mode set to
|
||||
* @ref ::LR11XX_WIFI_SCAN_MODE_BEACON or @ref ::LR11XX_WIFI_SCAN_MODE_BEACON_AND_PKT.
|
||||
* Refer to @ref lr11xx_wifi_are_scan_mode_result_format_compatible to know which scan mode and result format are
|
||||
* compatible.
|
||||
*
|
||||
* @param [in] radio Radio abstraction
|
||||
* @param [in] start_result_index Result index from which starting to fetch the results
|
||||
* @param [in] nb_results Number of results to fetch
|
||||
* @param [out] results Pointer to an array of result structures to populate. It is up to the caller to ensure this
|
||||
* array can hold at least nb_results elements.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_wifi_are_scan_mode_result_format_compatible, lr11xx_wifi_read_basic_mac_type_channel_results,
|
||||
* lr11xx_wifi_read_extended_full_results
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_read_basic_complete_results( const void* context, const uint8_t start_result_index,
|
||||
const uint8_t nb_results,
|
||||
lr11xx_wifi_basic_complete_result_t* results );
|
||||
|
||||
/*!
|
||||
* @brief Read basic MAC, Wi-Fi type and channel results
|
||||
*
|
||||
* This function can be used to fetch all results in a row, or one after the other.
|
||||
* It corresponds to result format @ref ::LR11XX_WIFI_RESULT_FORMAT_BASIC_MAC_TYPE_CHANNEL.
|
||||
*
|
||||
* An example of usage to fetch all results in a row is:
|
||||
* \code{.cpp}
|
||||
* uint8_t nb_results = 0;
|
||||
* lr11xx_wifi_get_nb_results(&radio, &nb_results);
|
||||
* lr11xx_wifi_basic_mac_type_channel_result_t all_results[LR11XX_WIFI_MAX_RESULTS] = {0};
|
||||
* lr11xx_wifi_read_basic_mac_type_channel_results(&radio, 0, nb_results, all_results);
|
||||
* \endcode
|
||||
*
|
||||
* On the other hand, fetching result one after the other:
|
||||
* \code{.cpp}
|
||||
* uint8_t nb_results = 0;
|
||||
* lr11xx_wifi_get_nb_results(&radio, &nb_results);
|
||||
* lr11xx_wifi_basic_mac_type_channel_result_t single_results = {0};
|
||||
* for(uint8_t index_result = 0; index_result < nb_results; index_result++){
|
||||
* lr11xx_wifi_read_basic_mac_type_channel_results(&radio, index_result, 1, &single_results);
|
||||
* // Do something with single_results
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* @remark This result fetching function **MUST** be used only if the scan function call was made with Scan Mode set to
|
||||
* @ref ::LR11XX_WIFI_SCAN_MODE_BEACON or @ref ::LR11XX_WIFI_SCAN_MODE_BEACON_AND_PKT.
|
||||
* Refer to @ref lr11xx_wifi_are_scan_mode_result_format_compatible to know which scan mode and result format are
|
||||
* compatible.
|
||||
*
|
||||
* @param [in] radio Radio abstraction
|
||||
* @param [in] start_result_index Result index from which starting to fetch the results
|
||||
* @param [in] nb_results Number of results to fetch
|
||||
* @param [out] results Pointer to an array of result structures to populate. It is up to the caller to ensure this
|
||||
* array can hold at least nb_results elements.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_wifi_are_scan_mode_result_format_compatible, lr11xx_wifi_read_basic_complete_results,
|
||||
* lr11xx_wifi_read_extended_full_results
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_read_basic_mac_type_channel_results( const void* context, const uint8_t start_result_index,
|
||||
const uint8_t nb_results,
|
||||
lr11xx_wifi_basic_mac_type_channel_result_t* results );
|
||||
|
||||
/*!
|
||||
* @brief Read extended complete results
|
||||
*
|
||||
* This function can be used to fetch all results in a row, or one after the other.
|
||||
* It corresponds to result format @ref ::LR11XX_WIFI_RESULT_FORMAT_EXTENDED_FULL.
|
||||
*
|
||||
* An example of usage to fetch all results in a row is:
|
||||
* \code{.cpp}
|
||||
* uint8_t nb_results = 0;
|
||||
* lr11xx_wifi_get_nb_results(&radio, &nb_results);
|
||||
* lr11xx_wifi_extended_full_result_t all_results[LR11XX_WIFI_MAX_RESULTS] = {0};
|
||||
* lr11xx_wifi_read_extended_full_results(&radio, 0, nb_results, all_results);
|
||||
* \endcode
|
||||
*
|
||||
* On the other hand, fetching result one after the other:
|
||||
* \code{.cpp}
|
||||
* uint8_t nb_results = 0;
|
||||
* lr11xx_wifi_get_nb_results(&radio, &nb_results);
|
||||
* lr11xx_wifi_extended_full_result_t single_results = {0};
|
||||
* for(uint8_t index_result = 0; index_result < nb_results; index_result++){
|
||||
* lr11xx_wifi_read_extended_full_results(&radio, index_result, 1, &single_results);
|
||||
* // Do something with single_results
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* @remark This result fetching function **MUST** be used only if the scan function call was made with Scan Mode set to
|
||||
* @ref ::LR11XX_WIFI_SCAN_MODE_FULL_BEACON.
|
||||
* Refer to @ref lr11xx_wifi_are_scan_mode_result_format_compatible to know which scan mode and result format are
|
||||
* compatible.
|
||||
*
|
||||
* @param [in] radio Radio abstraction
|
||||
* @param [in] start_result_index Result index from which starting to fetch the results
|
||||
* @param [in] nb_results Number of results to fetch
|
||||
* @param [out] results Pointer to an array of result structures to populate. It is up to the caller to ensure this
|
||||
* array can hold at least nb_results elements.
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_wifi_are_scan_mode_result_format_compatible, lr11xx_wifi_read_basic_complete_results,
|
||||
* lr11xx_wifi_read_basic_mac_type_channel_results
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_read_extended_full_results( const void* radio, const uint8_t start_result_index,
|
||||
const uint8_t nb_results,
|
||||
lr11xx_wifi_extended_full_result_t* results );
|
||||
|
||||
/*!
|
||||
* @brief Reset the internal counters of cumulative timing
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_reset_cumulative_timing( const void* context );
|
||||
|
||||
/*!
|
||||
* @brief Read the internal counters of cumulative timing
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] timing A pointer to the cumulative timing structure to populate
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_read_cumulative_timing( const void* context, lr11xx_wifi_cumulative_timings_t* timing );
|
||||
|
||||
/*!
|
||||
* @brief Get size of country code search results
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] nb_country_code_results Number of country results to read
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_get_nb_country_code_results( const void* context, uint8_t* nb_country_code_results );
|
||||
|
||||
/*!
|
||||
* @brief Read country code results
|
||||
*
|
||||
* The total number of country code results to read is obtained from a previous call to
|
||||
* lr11xx_wifi_get_nb_country_code_results
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] start_result_index The result index to start reading results from
|
||||
* @param [in] nb_country_results Number of country code results to read
|
||||
* @param [out] country_code_results An array of lr11xx_wifi_country_code_t to be filled. It is up to the application to
|
||||
* ensure this array is big enough to hold nb_country_results elements
|
||||
*
|
||||
* @returns Operation status
|
||||
*
|
||||
* @see lr11xx_wifi_get_nb_country_code_results, lr11xx_wifi_search_country_code
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_read_country_code_results( const void* context, const uint8_t start_result_index,
|
||||
const uint8_t nb_country_results,
|
||||
lr11xx_wifi_country_code_t* country_code_results );
|
||||
|
||||
/*!
|
||||
* @brief Configure the timestamp used to discriminate mobile access points from gateways.
|
||||
*
|
||||
* This filtering is based on the hypothesis that mobile access points have timestamp shorter than gateways.
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [in] timestamp_in_s Timestamp value in second
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_cfg_timestamp_ap_phone( const void* context, uint32_t timestamp_in_s );
|
||||
|
||||
/*!
|
||||
* @brief Get the internal wifi firmware version
|
||||
*
|
||||
* @param [in] context Chip implementation context
|
||||
* @param [out] wifi_version The wifi version structure populated with version numbers
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr11xx_status_t lr11xx_wifi_read_version( const void* context, lr11xx_wifi_version_t* wifi_version );
|
||||
|
||||
/*!
|
||||
* @brief Retreive channel information from channel info byte
|
||||
*
|
||||
* This method is to be called with on the WiFi channel info byte of a scan result.
|
||||
*
|
||||
* As the WiFi passive scan allows to get Access Point MAC address from Packet WiFi frames, it is possible that the
|
||||
* frame does not comes from the Access Point, but from a device. In that case, the RSSI reported by LR11XX is the one
|
||||
* of the frame received from the device and not from the Access Point. The rssi_validity flag allows to detect that
|
||||
* case.
|
||||
*
|
||||
* It is possible for an Access Point to be a mobile AP, which is of low interest for location purpose. The LR11XX tries
|
||||
* to detect mobile AP based on Access Point up time and set the flag mac_origin_estimation accordingly.
|
||||
*
|
||||
* @param [in] channel_info The channel info byte to retrieve channel information from. It is obtained from WiFi
|
||||
* passive scan result
|
||||
* @param [out] channel The channel of the scanned mac address
|
||||
* @param [out] rssi_validity The validity of the scanned MAC address
|
||||
* @param [out] mac_origin_estimation Indicates the estimation of MAC address origin by LR11XX
|
||||
*
|
||||
* @see lr11xx_wifi_read_basic_complete_results, lr11xx_wifi_read_basic_mac_type_channel_results,
|
||||
* lr11xx_wifi_cfg_timestamp_ap_phone
|
||||
*/
|
||||
void lr11xx_wifi_parse_channel_info( const lr11xx_wifi_channel_info_byte_t channel_info, lr11xx_wifi_channel_t* channel,
|
||||
bool* rssi_validity, lr11xx_wifi_mac_origin_t* mac_origin_estimation );
|
||||
|
||||
/*!
|
||||
* @brief Helper method to retrieve channel from channel info byte
|
||||
*
|
||||
* @param [in] channel_info The chanel info byte from passive scan result
|
||||
*
|
||||
* @returns The channel of scanned MAC address
|
||||
*
|
||||
* @see lr11xx_wifi_parse_channel_info
|
||||
*/
|
||||
lr11xx_wifi_channel_t lr11xx_wifi_extract_channel_from_info_byte( const lr11xx_wifi_channel_info_byte_t channel_info );
|
||||
|
||||
/*!
|
||||
* @brief Retrieve the Frame Type, Frame Subtype, To/From DS fields from a frame info byte
|
||||
*
|
||||
* This method is intended to be called on the channel info byte of a passive scan result structure.
|
||||
*
|
||||
* The from_ds/to_ds (Distribution Station) fields have the following meaning:
|
||||
*
|
||||
* <table>
|
||||
* <tr><th> to_ds value </th><th> from_ds value </th><th> Meaning </th>
|
||||
* <tr><td> False </td><td> False </td><td> Frame was between two Stations
|
||||
* </td> <tr><td> True </td><td> False </td><td> Frame was from Station to
|
||||
* Access Point </td> <tr><td> False </td><td> True </td><td> Frame was sent
|
||||
* from Access Point or Distribution Stations </td> <tr><td> True </td><td>
|
||||
* True </td><td> Mesh network only, frame was between Stations </td>
|
||||
* </table>
|
||||
*
|
||||
* @param [in] frame_type_info The frame info byte from passive scan result
|
||||
* @param [out] frame_type The Frame Type of the received frame
|
||||
* @param [out] frame_sub_type The Frame SubType of the frame received
|
||||
* @param [out] to_ds to_ds field of the frame received
|
||||
* @param [out] from_ds from_ds field of the frame received
|
||||
*/
|
||||
void lr11xx_wifi_parse_frame_type_info( const lr11xx_wifi_frame_type_info_byte_t frame_type_info,
|
||||
lr11xx_wifi_frame_type_t* frame_type,
|
||||
lr11xx_wifi_frame_sub_type_t* frame_sub_type, bool* to_ds, bool* from_ds );
|
||||
|
||||
/*!
|
||||
* @brief Retrieve the data rate information from data rate info byte
|
||||
*
|
||||
* This method is intended to be called on a data rate info byte of a passive scan result structure.
|
||||
*
|
||||
* @param [in] data_rate_info The data rate info byte from a passive scan result
|
||||
* @param [out] wifi_signal_type The wifi signal type of the scanned frame
|
||||
* @param [out] wifi_data_rate The data rate of the scanned frame
|
||||
*/
|
||||
void lr11xx_wifi_parse_data_rate_info( const lr11xx_wifi_datarate_info_byte_t data_rate_info,
|
||||
lr11xx_wifi_signal_type_result_t* wifi_signal_type,
|
||||
lr11xx_wifi_datarate_t* wifi_data_rate );
|
||||
|
||||
/*!
|
||||
* @brief Return the maximal number of results to read per SPI communication
|
||||
*
|
||||
* This function **DOES NOT** communicates with the LR11XX. It returns the driver maximal number of Wi-Fi results it can
|
||||
* retrieve per SPI communication.
|
||||
*
|
||||
* @remark It is a driver limitation, not a LR11XX limitation, that avoid allocating temporary buffers of size too big
|
||||
* when reading Wi-Fi passive scan results.
|
||||
*
|
||||
* @returns The maximal number of results to fetch per SPI calls
|
||||
*
|
||||
* @see LR11XX_WIFI_N_RESULTS_MAX_PER_CHUNK
|
||||
*/
|
||||
uint8_t lr11xx_wifi_get_nb_results_max_per_chunk( void );
|
||||
|
||||
/*!
|
||||
* @brief Helper method to retrieve the signal type from data rate info byte
|
||||
*
|
||||
* @param [in] data_rate_info The data rate info byte from a passive scan result
|
||||
*
|
||||
* @returns The Signal Type of the scanned frame
|
||||
*/
|
||||
lr11xx_wifi_signal_type_result_t lr11xx_wifi_extract_signal_type_from_data_rate_info(
|
||||
const lr11xx_wifi_datarate_info_byte_t data_rate_info );
|
||||
|
||||
/*!
|
||||
* @brief Helper function to check if a buffer is a well-formed UTF-8 byte sequence
|
||||
*
|
||||
* @param [in] buffer The buffer holding the bytes to be analyzed
|
||||
* @param [in] length The number of bytes in the buffer
|
||||
*
|
||||
* @returns The result of the check
|
||||
*/
|
||||
bool lr11xx_wifi_is_well_formed_utf8_byte_sequence( const uint8_t* buffer, const uint8_t length );
|
||||
|
||||
/*!
|
||||
* @brief Check that Wi-Fi scan mode and result format are compatible
|
||||
*
|
||||
* The possible combination of Wi-Fi scan modes and result format are the following:
|
||||
*
|
||||
* <table>
|
||||
* <tr> <th> Scan Mode <th> Type/Sub-type selected <th> Corresponding read result function
|
||||
* <tr> <td> @ref ::LR11XX_WIFI_SCAN_MODE_BEACON <td> Management/Beacon and Management/Probe Response <td rowspan="2">
|
||||
* @ref lr11xx_wifi_read_basic_complete_results, @ref lr11xx_wifi_read_basic_mac_type_channel_results <tr> <td>
|
||||
* @ref ::LR11XX_WIFI_SCAN_MODE_BEACON_AND_PKT <td> Some from Management, Control and Data Types <tr> <td>
|
||||
* @ref ::LR11XX_WIFI_SCAN_MODE_FULL_BEACON <td> Management/Beacon and Management/Probe Response <td rowspan="2"> @ref
|
||||
* lr11xx_wifi_read_extended_full_results <tr> <td> @ref ::LR11XX_WIFI_SCAN_MODE_UNTIL_SSID <td> Management/Beacon and
|
||||
* Management/Probe Response - until SSID field
|
||||
* </table>
|
||||
*
|
||||
* @param scan_mode The scan mode used when calling the scan API
|
||||
* @param result_format The result format used when calling the read result API
|
||||
* @retval true The scan mode and result format are compatible
|
||||
* @retval false The scan mode and result format are not compatible.
|
||||
*/
|
||||
bool lr11xx_wifi_are_scan_mode_result_format_compatible( lr11xx_wifi_mode_t scan_mode,
|
||||
lr11xx_wifi_result_format_t result_format );
|
||||
|
||||
/**
|
||||
* @brief Compute the power consumption in nAh based on the cumulative timing.
|
||||
*
|
||||
* @param [in] regulator The regulator used during last Wi-Fi passive scan
|
||||
* @param [in] timing Cumulative timing structure to use for computation
|
||||
*
|
||||
* @returns Current consumption in nAh
|
||||
*/
|
||||
uint32_t lr11xx_wifi_get_consumption_nah( lr11xx_system_reg_mode_t regulator, lr11xx_wifi_cumulative_timings_t timing );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_WIFI_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
410
components/esp_lora_1121/include/lr11xx_driver/lr11xx_wifi_types.h
Executable file
410
components/esp_lora_1121/include/lr11xx_driver/lr11xx_wifi_types.h
Executable file
@@ -0,0 +1,410 @@
|
||||
/*!
|
||||
* @file lr11xx_wifi_types.h
|
||||
*
|
||||
* @brief Wi-Fi passive scan driver types for LR11XX
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR11XX_WIFI_TYPES_H
|
||||
#define LR11XX_WIFI_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define LR11XX_WIFI_MAC_ADDRESS_LENGTH ( 6 )
|
||||
#define LR11XX_WIFI_MAX_RESULTS ( 32 )
|
||||
#define LR11XX_WIFI_RESULT_SSID_LENGTH ( 32 )
|
||||
#define LR11XX_WIFI_MAX_COUNTRY_CODE ( 32 )
|
||||
#define LR11XX_WIFI_STR_COUNTRY_CODE_SIZE ( 2 )
|
||||
|
||||
#define LR11XX_WIFI_CHANNEL_1_POS ( 0U ) //!< Channel at frequency 2.412 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_1_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_1_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_2_POS ( 1U ) //!< Channel at frequency 2.417 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_2_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_2_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_3_POS ( 2U ) //!< Channel at frequency 2.422 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_3_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_3_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_4_POS ( 3U ) //!< Channel at frequency 2.427 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_4_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_4_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_5_POS ( 4U ) //!< Channel at frequency 2.432 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_5_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_5_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_6_POS ( 5U ) //!< Channel at frequency 2.437 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_6_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_6_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_7_POS ( 6U ) //!< Channel at frequency 2.442 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_7_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_7_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_8_POS ( 7U ) //!< Channel at frequency 2.447 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_8_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_8_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_9_POS ( 8U ) //!< Channel at frequency 2.452 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_9_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_9_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_10_POS ( 9U ) //!< Channel at frequency 2.457 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_10_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_10_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_11_POS ( 10U ) //!< Channel at frequency 2.462 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_11_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_11_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_12_POS ( 11U ) //!< Channel at frequency 2.467 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_12_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_12_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_13_POS ( 12U ) //!< Channel at frequency 2.472 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_13_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_13_POS )
|
||||
#define LR11XX_WIFI_CHANNEL_14_POS ( 13U ) //!< Channel at frequency 2.484 GHz
|
||||
#define LR11XX_WIFI_CHANNEL_14_MASK ( 0x01UL << LR11XX_WIFI_CHANNEL_14_POS )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @brief Type to store a Wi-Fi channel mask
|
||||
*/
|
||||
typedef uint16_t lr11xx_wifi_channel_mask_t;
|
||||
|
||||
/*!
|
||||
* @brief Type to store a Wi-Fi channel info byte
|
||||
*/
|
||||
typedef uint8_t lr11xx_wifi_channel_info_byte_t;
|
||||
|
||||
/*!
|
||||
* @brief Type to store a Wi-Fi datarate info byte
|
||||
*/
|
||||
typedef uint8_t lr11xx_wifi_datarate_info_byte_t;
|
||||
|
||||
/*!
|
||||
* @brief Type to store a Wi-Fi frame type info byte
|
||||
*/
|
||||
typedef uint8_t lr11xx_wifi_frame_type_info_byte_t;
|
||||
|
||||
/*!
|
||||
* @brief Type to store a Wi-Fi frame sub_type
|
||||
*/
|
||||
typedef uint8_t lr11xx_wifi_frame_sub_type_t;
|
||||
|
||||
/*!
|
||||
* @brief Wi-Fi FCS info byte
|
||||
*/
|
||||
typedef struct lr11xx_wifi_fcs_info_byte_s
|
||||
{
|
||||
bool is_fcs_ok; //!< True if the LR11XX has checked the FCS and the check succeeded
|
||||
bool is_fcs_checked; //!< True if the LR11XX has checked the FCS
|
||||
} lr11xx_wifi_fcs_info_byte_t;
|
||||
|
||||
/*!
|
||||
* @brief Type to store a MAC address
|
||||
*/
|
||||
typedef uint8_t lr11xx_wifi_mac_address_t[LR11XX_WIFI_MAC_ADDRESS_LENGTH];
|
||||
|
||||
/*!
|
||||
* @brief Type to store the Country Code
|
||||
*/
|
||||
typedef uint8_t lr11xx_wifi_country_code_str_t[LR11XX_WIFI_STR_COUNTRY_CODE_SIZE];
|
||||
|
||||
/*!
|
||||
* @brief Wi-Fi Channels index
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_WIFI_NO_CHANNEL = 0x00,
|
||||
LR11XX_WIFI_CHANNEL_1 = 0x01, //!< Channel at frequency 2.412 GHz
|
||||
LR11XX_WIFI_CHANNEL_2 = 0x02, //!< Channel at frequency 2.417 GHz
|
||||
LR11XX_WIFI_CHANNEL_3 = 0x03, //!< Channel at frequency 2.422 GHz
|
||||
LR11XX_WIFI_CHANNEL_4 = 0x04, //!< Channel at frequency 2.427 GHz
|
||||
LR11XX_WIFI_CHANNEL_5 = 0x05, //!< Channel at frequency 2.432 GHz
|
||||
LR11XX_WIFI_CHANNEL_6 = 0x06, //!< Channel at frequency 2.437 GHz
|
||||
LR11XX_WIFI_CHANNEL_7 = 0x07, //!< Channel at frequency 2.442 GHz
|
||||
LR11XX_WIFI_CHANNEL_8 = 0x08, //!< Channel at frequency 2.447 GHz
|
||||
LR11XX_WIFI_CHANNEL_9 = 0x09, //!< Channel at frequency 2.452 GHz
|
||||
LR11XX_WIFI_CHANNEL_10 = 0x0A, //!< Channel at frequency 2.457 GHz
|
||||
LR11XX_WIFI_CHANNEL_11 = 0x0B, //!< Channel at frequency 2.462 GHz
|
||||
LR11XX_WIFI_CHANNEL_12 = 0x0C, //!< Channel at frequency 2.467 GHz
|
||||
LR11XX_WIFI_CHANNEL_13 = 0x0D, //!< Channel at frequency 2.472 GHz
|
||||
LR11XX_WIFI_CHANNEL_14 = 0x0E, //!< Channel at frequency 2.484 GHz
|
||||
LR11XX_WIFI_ALL_CHANNELS = 0x0F,
|
||||
} lr11xx_wifi_channel_t;
|
||||
|
||||
/*!
|
||||
* @brief WiFi theoretical Datarates
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_WIFI_DATARATE_1_MBPS = 1,
|
||||
LR11XX_WIFI_DATARATE_2_MBPS = 2,
|
||||
LR11XX_WIFI_DATARATE_6_MBPS = 3,
|
||||
LR11XX_WIFI_DATARATE_9_MBPS = 4,
|
||||
LR11XX_WIFI_DATARATE_12_MBPS = 5,
|
||||
LR11XX_WIFI_DATARATE_18_MBPS = 6,
|
||||
LR11XX_WIFI_DATARATE_24_MBPS = 7,
|
||||
LR11XX_WIFI_DATARATE_36_MBPS = 8,
|
||||
LR11XX_WIFI_DATARATE_48_MBPS = 9,
|
||||
LR11XX_WIFI_DATARATE_54_MBPS = 10,
|
||||
LR11XX_WIFI_DATARATE_6_5_MBPS = 11,
|
||||
LR11XX_WIFI_DATARATE_13_MBPS = 12,
|
||||
LR11XX_WIFI_DATARATE_19_5_MBPS = 13,
|
||||
LR11XX_WIFI_DATARATE_26_MBPS = 14,
|
||||
LR11XX_WIFI_DATARATE_39_MBPS = 15,
|
||||
LR11XX_WIFI_DATARATE_52_MBPS = 16,
|
||||
LR11XX_WIFI_DATARATE_58_MBPS = 17,
|
||||
LR11XX_WIFI_DATARATE_65_MBPS = 18,
|
||||
LR11XX_WIFI_DATARATE_7_2_MBPS = 19,
|
||||
LR11XX_WIFI_DATARATE_14_4_MBPS = 20,
|
||||
LR11XX_WIFI_DATARATE_21_7_MBPS = 21,
|
||||
LR11XX_WIFI_DATARATE_28_9_MBPS = 22,
|
||||
LR11XX_WIFI_DATARATE_43_3_MBPS = 23,
|
||||
LR11XX_WIFI_DATARATE_57_8_MBPS = 24,
|
||||
LR11XX_WIFI_DATARATE_65_2_MBPS = 25,
|
||||
LR11XX_WIFI_DATARATE_72_2_MBPS = 26,
|
||||
} lr11xx_wifi_datarate_t;
|
||||
|
||||
/*!
|
||||
* @brief WiFi Frame Types
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_WIFI_FRAME_TYPE_MANAGEMENT = 0x00,
|
||||
LR11XX_WIFI_FRAME_TYPE_CONTROL = 0x01,
|
||||
LR11XX_WIFI_FRAME_TYPE_DATA = 0x02,
|
||||
} lr11xx_wifi_frame_type_t;
|
||||
|
||||
/*!
|
||||
* @brief The WiFi MAC address origin
|
||||
*
|
||||
* @see lr11xx_wifi_parse_channel_info for details about the MAC address origin estimation of the LR11XX
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_WIFI_ORIGIN_BEACON_FIX_AP = 1, //!< MAC address extracted from a packet coming from a fix Access Point
|
||||
LR11XX_WIFI_ORIGIN_BEACON_MOBILE_AP = 2, //!< MAC address extracted from a packet coming from a mobile Access Point
|
||||
LR11XX_WIFI_ORIGIN_UNKNOWN = 3, //!< Impossible to determine the origin of the packet the MAC is extracted from
|
||||
} lr11xx_wifi_mac_origin_t;
|
||||
|
||||
/*!
|
||||
* @brief Wi-Fi signal type for passive scanning configuration
|
||||
*
|
||||
* Note it is not possible to configure the WiFi passive scanning to search Wi-Fi type N GreenField. Only Wi-Fi type N
|
||||
* Mixed Mode can be scanned by LR11XX.
|
||||
*
|
||||
* @warning ::LR11XX_WIFI_TYPE_SCAN_G and ::LR11XX_WIFI_TYPE_SCAN_N configurations are implemented the same way, and
|
||||
* both will scan Wi-Fi type G **AND** Wi-Fi type N.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_WIFI_TYPE_SCAN_B = 0x01, //!< Wi-Fi B
|
||||
LR11XX_WIFI_TYPE_SCAN_G = 0x02, //!< Wi-Fi G
|
||||
LR11XX_WIFI_TYPE_SCAN_N = 0x03, //!< Wi-Fi N
|
||||
LR11XX_WIFI_TYPE_SCAN_B_G_N = 0x04, //!< Wi-Fi B and Wi-Fi G/N
|
||||
} lr11xx_wifi_signal_type_scan_t;
|
||||
|
||||
/*!
|
||||
* @brief Wi-Fi signal type for passive scan results
|
||||
*
|
||||
* Note that the Wi-Fi N detected is Wi-Fi N Mixed mode, and not GreenField.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_WIFI_TYPE_RESULT_B = 0x01, //!< WiFi B
|
||||
LR11XX_WIFI_TYPE_RESULT_G = 0x02, //!< WiFi G
|
||||
LR11XX_WIFI_TYPE_RESULT_N = 0x03, //!< WiFi N
|
||||
} lr11xx_wifi_signal_type_result_t;
|
||||
|
||||
/*!
|
||||
* @brief Wi-Fi scan mode
|
||||
*
|
||||
* When the LR11XX receives a Wi-Fi frame, it starts demodulating it. Depending on the scan mode selected, only some
|
||||
* Wi-Fi frame type/sub-types are to be kept. The demodulation step is stopped as soon as the LR11XX detects the current
|
||||
* Wi-Fi frame is not of the required type/sub-types. This saves scan time and consumption.
|
||||
*
|
||||
* A Wi-Fi frame is never completely demodulated. The ::LR11XX_WIFI_SCAN_MODE_FULL_BEACON uses a special configuration
|
||||
* allowing to demodulate more fields (until Frame Check Sequence field), at a price of higher scan duration and higher
|
||||
* consumption.
|
||||
*
|
||||
* @note Not all results formats are available depending on the scan mode selected. Refer to
|
||||
* @ref lr11xx_wifi_are_scan_mode_result_format_compatible to know which result formats are available depending on scan
|
||||
* mode selected.
|
||||
*
|
||||
* @see lr11xx_wifi_are_scan_mode_result_format_compatible
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_WIFI_SCAN_MODE_BEACON =
|
||||
1, //!< Exposes Beacons and Probe Responses Access Points frames until Period Beacon field (Basic result)
|
||||
LR11XX_WIFI_SCAN_MODE_BEACON_AND_PKT =
|
||||
2, //!< Exposes some Management Access Points frames until Period Beacon field, and some other packets frame
|
||||
//!< until third Mac Address field (Basic result)
|
||||
LR11XX_WIFI_SCAN_MODE_FULL_BEACON =
|
||||
4, //!< Exposes Beacons and Probes Responses Access Points frames until Frame Check Sequence (FCS) field
|
||||
//!< (Extended result). In this mode, only signal type LR11XX_WIFI_TYPE_SCAN_B is executed and other signal
|
||||
//!< types are silently discarded.
|
||||
LR11XX_WIFI_SCAN_MODE_UNTIL_SSID = 5, //!< Exposes Beacons and Probes Responses Access Points frames until the end
|
||||
//!< of SSID field (Extended result) - available since firmware 0x0306
|
||||
} lr11xx_wifi_mode_t;
|
||||
|
||||
/*!
|
||||
* @brief Cumulative timings
|
||||
*
|
||||
* This structure is representing the cumulative time spent in the different modes of Wi-Fi passive scanning procedure.
|
||||
* All timings are provided in [us].
|
||||
* */
|
||||
typedef struct lr11xx_wifi_cumulative_timings_s
|
||||
{
|
||||
uint32_t rx_detection_us; //!< Cumulative time spent during NFE or TOA
|
||||
uint32_t rx_correlation_us; //!< Cumulative time spent during preamble detection
|
||||
uint32_t rx_capture_us; //!< Cumulative time spent during signal acquisition
|
||||
uint32_t demodulation_us; //!< Cumulative time spent during software demodulation
|
||||
} lr11xx_wifi_cumulative_timings_t;
|
||||
|
||||
/*!
|
||||
* @brief Basic complete result structure
|
||||
*
|
||||
* The beacon period is expressed in TU (Time Unit). 1 TU is 1024 microseconds.
|
||||
*/
|
||||
typedef struct lr11xx_wifi_basic_complete_result_s
|
||||
{
|
||||
lr11xx_wifi_datarate_info_byte_t data_rate_info_byte;
|
||||
lr11xx_wifi_channel_info_byte_t channel_info_byte;
|
||||
int8_t rssi;
|
||||
lr11xx_wifi_frame_type_info_byte_t frame_type_info_byte;
|
||||
lr11xx_wifi_mac_address_t mac_address;
|
||||
int16_t phi_offset;
|
||||
uint64_t timestamp_us; //!< Indicate the up-time of the Access Point transmitting the Beacon [us]
|
||||
uint16_t beacon_period_tu;
|
||||
} lr11xx_wifi_basic_complete_result_t;
|
||||
|
||||
/*!
|
||||
* @brief Basic MAC, type, channel result structure
|
||||
*/
|
||||
typedef struct lr11xx_wifi_basic_mac_type_channel_result_s
|
||||
{
|
||||
lr11xx_wifi_datarate_info_byte_t data_rate_info_byte;
|
||||
lr11xx_wifi_channel_info_byte_t channel_info_byte;
|
||||
int8_t rssi;
|
||||
lr11xx_wifi_mac_address_t mac_address;
|
||||
} lr11xx_wifi_basic_mac_type_channel_result_t;
|
||||
|
||||
/*!
|
||||
* @brief Extended full result structure
|
||||
*
|
||||
* @note The beacon period is expressed in TU (Time Unit). 1 TU is 1024 microseconds.
|
||||
*
|
||||
* @remark When used with @ref ::LR11XX_WIFI_SCAN_MODE_UNTIL_SSID, the following field are always set to 0:
|
||||
* - field is_fcs_ok and is_fcs_checked in fcs_check_byte structure
|
||||
* - current_channel
|
||||
* - country_code
|
||||
* - io_regulation
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
lr11xx_wifi_datarate_info_byte_t data_rate_info_byte;
|
||||
lr11xx_wifi_channel_info_byte_t channel_info_byte;
|
||||
int8_t rssi;
|
||||
uint8_t rate; //!< Rate index
|
||||
uint16_t service; //!< Service value
|
||||
uint16_t length; //!< Length of MPDU (in microseconds for WiFi B, bytes for WiFi G)
|
||||
uint16_t frame_control; //!< Frame Control structure
|
||||
lr11xx_wifi_mac_address_t mac_address_1;
|
||||
lr11xx_wifi_mac_address_t mac_address_2;
|
||||
lr11xx_wifi_mac_address_t mac_address_3;
|
||||
uint64_t timestamp_us; //!< Indicate the up-time of the Access Point
|
||||
//!< transmitting the Beacon [us]
|
||||
uint16_t beacon_period_tu;
|
||||
uint16_t seq_control; //!< Sequence Control value
|
||||
uint8_t ssid_bytes[LR11XX_WIFI_RESULT_SSID_LENGTH]; //!< Service Set
|
||||
//!< IDentifier
|
||||
lr11xx_wifi_channel_t current_channel; //!< Current channel indicated in the Wi-Fi frame
|
||||
lr11xx_wifi_country_code_str_t country_code; //!< Country Code
|
||||
uint8_t io_regulation; //!< Input Output Regulation
|
||||
lr11xx_wifi_fcs_info_byte_t fcs_check_byte; //!< Frame Check Sequence info
|
||||
int16_t phi_offset;
|
||||
} lr11xx_wifi_extended_full_result_t;
|
||||
|
||||
/*!
|
||||
* @brief Wi-Fi scan result formats
|
||||
*
|
||||
* @note Result format to use depends on the scan mode selected when calling @ref lr11xx_wifi_scan or @ref
|
||||
* lr11xx_wifi_scan_time_limit API. Refer to @ref lr11xx_wifi_are_scan_mode_result_format_compatible to know which
|
||||
* result formats are available depending on scan mode selected.
|
||||
*
|
||||
* @see lr11xx_wifi_are_scan_mode_result_format_compatible
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR11XX_WIFI_RESULT_FORMAT_BASIC_COMPLETE, //!< Basic complete result format: @ref
|
||||
//!< lr11xx_wifi_basic_complete_result_t
|
||||
LR11XX_WIFI_RESULT_FORMAT_BASIC_MAC_TYPE_CHANNEL, //!< Basic MAC/type/channel result format: @ref
|
||||
//!< lr11xx_wifi_basic_mac_type_channel_result_t
|
||||
LR11XX_WIFI_RESULT_FORMAT_EXTENDED_FULL, //!< Extended full result format: @ref lr11xx_wifi_extended_full_result_t
|
||||
} lr11xx_wifi_result_format_t;
|
||||
|
||||
/*!
|
||||
* @brief Wi-Fi country code structure
|
||||
*/
|
||||
typedef struct lr11xx_wifi_country_code_s
|
||||
{
|
||||
lr11xx_wifi_country_code_str_t country_code;
|
||||
uint8_t io_regulation; //!< Input Output Regulation
|
||||
lr11xx_wifi_channel_info_byte_t channel_info_byte;
|
||||
lr11xx_wifi_mac_address_t mac_address;
|
||||
} lr11xx_wifi_country_code_t;
|
||||
|
||||
/*!
|
||||
* @brief Wi-Fi firmware version
|
||||
*/
|
||||
typedef struct lr11xx_wifi_version_s
|
||||
{
|
||||
uint8_t major;
|
||||
uint8_t minor;
|
||||
} lr11xx_wifi_version_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR11XX_WIFI_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
127
components/esp_lora_1121/include/lr11xx_driver/lr_fhss_v1_base_types.h
Executable file
127
components/esp_lora_1121/include/lr11xx_driver/lr_fhss_v1_base_types.h
Executable file
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
* @file lr_fhss_v1_base_types.h
|
||||
*
|
||||
* @brief Radio-independent LR-FHSS base type definitions, version 1
|
||||
*
|
||||
* The Clear BSD License
|
||||
* Copyright Semtech Corporation 2021. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the disclaimer
|
||||
* below) provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Semtech corporation nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
||||
* THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
||||
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEMTECH CORPORATION BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LR_FHSS_V1_BASE_TYPES_H__
|
||||
#define LR_FHSS_V1_BASE_TYPES_H__
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS modulation type
|
||||
*/
|
||||
typedef enum lr_fhss_v1_modulation_type_e
|
||||
{
|
||||
LR_FHSS_V1_MODULATION_TYPE_GMSK_488 = 0,
|
||||
} lr_fhss_v1_modulation_type_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS coding rate
|
||||
*/
|
||||
typedef enum lr_fhss_v1_cr_e
|
||||
{
|
||||
LR_FHSS_V1_CR_5_6 = 0x00,
|
||||
LR_FHSS_V1_CR_2_3 = 0x01,
|
||||
LR_FHSS_V1_CR_1_2 = 0x02,
|
||||
LR_FHSS_V1_CR_1_3 = 0x03,
|
||||
} lr_fhss_v1_cr_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS grid
|
||||
*/
|
||||
typedef enum lr_fhss_v1_grid_e
|
||||
{
|
||||
LR_FHSS_V1_GRID_25391_HZ = 0x00,
|
||||
LR_FHSS_V1_GRID_3906_HZ = 0x01,
|
||||
} lr_fhss_v1_grid_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS bandwidth
|
||||
*/
|
||||
typedef enum lr_fhss_v1_bw_e
|
||||
{
|
||||
LR_FHSS_V1_BW_39063_HZ = 0x00,
|
||||
LR_FHSS_V1_BW_85938_HZ = 0x01,
|
||||
LR_FHSS_V1_BW_136719_HZ = 0x02,
|
||||
LR_FHSS_V1_BW_183594_HZ = 0x03,
|
||||
LR_FHSS_V1_BW_335938_HZ = 0x04,
|
||||
LR_FHSS_V1_BW_386719_HZ = 0x05,
|
||||
LR_FHSS_V1_BW_722656_HZ = 0x06,
|
||||
LR_FHSS_V1_BW_773438_HZ = 0x07,
|
||||
LR_FHSS_V1_BW_1523438_HZ = 0x08,
|
||||
LR_FHSS_V1_BW_1574219_HZ = 0x09,
|
||||
} lr_fhss_v1_bw_t;
|
||||
|
||||
/**
|
||||
* @brief LR-FHSS parameter structure
|
||||
*/
|
||||
typedef struct lr_fhss_v1_params_s
|
||||
{
|
||||
const uint8_t* sync_word; /**< 4-byte sync word */
|
||||
lr_fhss_v1_modulation_type_t modulation_type;
|
||||
lr_fhss_v1_cr_t cr;
|
||||
lr_fhss_v1_grid_t grid;
|
||||
lr_fhss_v1_bw_t bw;
|
||||
bool enable_hopping;
|
||||
uint8_t header_count; /**< Number of header blocks */
|
||||
} lr_fhss_v1_params_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#endif // LR_FHSS_V1_BASE_TYPES_H__
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
Reference in New Issue
Block a user