mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-09 10:55:38 +00:00
promicro LR2021 build fix
This commit is contained in:
@@ -0,0 +1,246 @@
|
||||
/*!
|
||||
* @file lr20xx_radio_ook.h
|
||||
*
|
||||
* @brief On-Off Keying radio driver definition for LR20XX
|
||||
*
|
||||
* 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 LR20XX_RADIO_OOK_H
|
||||
#define LR20XX_RADIO_OOK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lr20xx_status.h"
|
||||
#include "lr20xx_radio_ook_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set the modulation parameters for OOK packets
|
||||
*
|
||||
* The workaround @ref lr20xx_workarounds_dcdc_configure must be called for Rx sub-GHz operations with regulator @ref
|
||||
* LR20XX_SYSTEM_REG_MODE_DCDC after this function to avoid possible RF sensitivity degradation.
|
||||
*
|
||||
* @note This function automatically applies the workaround @ref lr20xx_workarounds_dcdc_configure unless the macro @p
|
||||
* LR20XX_WORKAROUNDS_DISABLE_AUTOMATIC_DCDC_CONFIGURE is defined at compile time.
|
||||
*
|
||||
* @param[in] context Chip implementation context
|
||||
* @param[in] params Structure of OOK modulation configuration
|
||||
*
|
||||
* @return lr20xx_status_t Operation status
|
||||
*
|
||||
* @see lr20xx_workarounds_dcdc_configure
|
||||
*/
|
||||
lr20xx_status_t lr20xx_radio_ook_set_modulation_params( const void* context,
|
||||
const lr20xx_radio_ook_mod_params_t* params );
|
||||
|
||||
/**
|
||||
* @brief Set the packet parameters for OOK packets
|
||||
*
|
||||
* The OOK packet configuration with header explicit and CRC disabled is known to generate incorrect packet reception.
|
||||
*
|
||||
* @param[in] context Chip implementation context
|
||||
* @param[in] params Structure of the OOK packet parameter to configure
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr20xx_status_t lr20xx_radio_ook_set_packet_params( const void* context, const lr20xx_radio_ook_pkt_params_t* params );
|
||||
|
||||
/**
|
||||
* @brief Set the CRC configuration for OOK packets
|
||||
*
|
||||
* @param[in] context Chip implementation context
|
||||
* @param[in] crc_polynomial Polynomial to use for CRC LFSR
|
||||
* @param[in] crc_seed LFSR initial value
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr20xx_status_t lr20xx_radio_ook_set_crc_params( const void* context, uint32_t crc_polynomial, uint32_t crc_seed );
|
||||
|
||||
/**
|
||||
* @brief Set the syncword for OOK packets
|
||||
*
|
||||
* The argument \p syncword is a 4-byte array. However, it should be understood as 32-bit variable, where Most
|
||||
* Significant Bit is the MSB of syncword[0] and Least Significant Bit is LSB of syncword[3].
|
||||
*
|
||||
* For instance:
|
||||
*
|
||||
* @code{.c}
|
||||
* syncword = 0x0000AA67
|
||||
* nb_bits = 12
|
||||
* @endcode
|
||||
*
|
||||
* Then, syncword in bits is:
|
||||
*
|
||||
* @verbatim
|
||||
* 0...0 01010101 01100111
|
||||
* ^ ^ ^
|
||||
* MSB nb_bit'th LSB
|
||||
* @endverbatim
|
||||
*
|
||||
* Then, the bit stream sent over the air will be
|
||||
* - if \p bit_order == LR20XX_RADIO_OOK_SYNCWORD_LSBF:
|
||||
* @verbatim
|
||||
* 111001101010
|
||||
* @endverbatim
|
||||
* - if \p bit_order == LR20XX_RADIO_OOK_SYNCWORD_MSBF:
|
||||
* @verbatim
|
||||
* 010101100111
|
||||
* @endverbatim
|
||||
*
|
||||
* @param[in] context Chip implementation context
|
||||
* @param[in] syncword Array holding the syncword value. It is up to the caller that this array holds at least
|
||||
* LR20XX_RADIO_OOK_SYNCWORD_LENGTH bytes, even if nb_bits is not 32
|
||||
* @param[in] nb_bits The number of significant bits in syncword to use for syncword. The significant bits are taken as
|
||||
* Least Significant Bits of \p syncword argument. Value in range of [0:32]
|
||||
* @param[in] bit_order The order of transmission of the selected bits of syncword over-the-air
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr20xx_status_t lr20xx_radio_ook_set_syncword( const void* context,
|
||||
const uint8_t syncword[LR20XX_RADIO_OOK_SYNCWORD_LENGTH],
|
||||
uint8_t nb_bits, lr20xx_radio_ook_syncword_bit_order_t bit_order );
|
||||
|
||||
/**
|
||||
* @brief Set the node and broadcast addresses for OOK packets
|
||||
*
|
||||
* @param[in] context Chip implementation context
|
||||
* @param[in] node_address Node address
|
||||
* @param[in] broadcast_address Broadcast address
|
||||
*
|
||||
* @returns Operation status
|
||||
*/
|
||||
lr20xx_status_t lr20xx_radio_ook_set_addresses( const void* context, uint8_t node_address, uint8_t broadcast_address );
|
||||
|
||||
/**
|
||||
* @brief Get the internal statistics of received OOK packets
|
||||
*
|
||||
* The internal statistics are reset on:
|
||||
* - Power On Reset (POR)
|
||||
* - sleep without memory retention
|
||||
* - call to lr20xx_radio_common_reset_rx_stats
|
||||
*
|
||||
* @param[in] context Chip implementation context
|
||||
* @param[out] statistics Pointer to a structure of statistic to populate with internal statistics
|
||||
*
|
||||
* @return lr20xx_status_t Operation status
|
||||
*
|
||||
* @see lr20xx_radio_common_reset_rx_stats
|
||||
*/
|
||||
lr20xx_status_t lr20xx_radio_ook_get_rx_statistics( const void* context, lr20xx_radio_ook_rx_statistics_t* statistics );
|
||||
|
||||
/**
|
||||
* @brief Get the status of the last received OOK packet
|
||||
*
|
||||
* Availability of the packet status fields depend on the IRQ as follows:
|
||||
* - Available from LR20XX_SYSTEM_IRQ_SYNC_WORD_HEADER_VALID:
|
||||
* - lr20xx_radio_ook_packet_status_t.rssi_on_in_dbm
|
||||
* - lr20xx_radio_ook_packet_status_t.rssi_on_half_dbm_count
|
||||
* - Available from LR20XX_SYSTEM_IRQ_RX_DONE:
|
||||
* - lr20xx_radio_ook_packet_status_t.rssi_avg_in_dbm
|
||||
* - lr20xx_radio_ook_packet_status_t.rssi_avg_half_dbm_count
|
||||
* - lr20xx_radio_ook_packet_status_t.is_addr_match_broadcast
|
||||
* - lr20xx_radio_ook_packet_status_t.is_addr_match_node
|
||||
*
|
||||
* @param[in] context Chip implementation context
|
||||
* @param[out] pkt_status Pointer to a structure of packet status to populate
|
||||
*
|
||||
* @return lr20xx_status_t Operation status
|
||||
*/
|
||||
lr20xx_status_t lr20xx_radio_ook_get_packet_status( const void* context, lr20xx_radio_ook_packet_status_t* pkt_status );
|
||||
|
||||
/**
|
||||
* @brief Configure the Rx detector OOK packet
|
||||
*
|
||||
* @param[in] context Chip implementation context
|
||||
* @param[in] rx_detector Rx detector configuration
|
||||
*
|
||||
* @return lr20xx_status_t Operation status
|
||||
*/
|
||||
lr20xx_status_t lr20xx_radio_ook_set_rx_detector( const void* context,
|
||||
const lr20xx_radio_ook_rx_detector_t* rx_detector );
|
||||
|
||||
/**
|
||||
* @brief Set whitening parameters for OOK packet
|
||||
*
|
||||
* @param[in] context Chip implementation context
|
||||
* @param[in] params Whitening parameters
|
||||
*
|
||||
* @return lr20xx_status_t Operation status
|
||||
*/
|
||||
lr20xx_status_t lr20xx_radio_ook_set_whitening_params( const void* context,
|
||||
const lr20xx_radio_ook_whitening_params_t* params );
|
||||
|
||||
/**
|
||||
* @brief Get the time on air in ms for OOK transmission
|
||||
*
|
||||
* @param [in] pkt_p Pointer to a structure holding the OOK packet parameters
|
||||
* @param [in] mod_p Pointer to a structure holding the OOK modulation parameters
|
||||
* @param [in] syncword_len_in_bit Syncword length in bit
|
||||
*
|
||||
* @returns Time-on-air value in ms for OOK transmission
|
||||
*/
|
||||
uint32_t lr20xx_radio_ook_get_time_on_air_in_ms( const lr20xx_radio_ook_pkt_params_t* pkt_p,
|
||||
const lr20xx_radio_ook_mod_params_t* mod_p,
|
||||
uint8_t syncword_len_in_bit );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR20XX_RADIO_OOK_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
@@ -0,0 +1,264 @@
|
||||
/*!
|
||||
* @file lr20xx_radio_ook_types.h
|
||||
*
|
||||
* @brief On-Off Keying radio types driver definition for LR20XX
|
||||
*
|
||||
* 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 LR20XX_RADIO_OOK_TYPES_H
|
||||
#define LR20XX_RADIO_OOK_TYPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "lr20xx_radio_fsk_common_types.h"
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- DEPENDENCIES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC MACROS -----------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Length in bytes of the OOK syncword
|
||||
*
|
||||
*/
|
||||
#define LR20XX_RADIO_OOK_SYNCWORD_LENGTH ( 4 )
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC CONSTANTS --------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC TYPES ------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Type of bitrate for OOK
|
||||
*
|
||||
* This type is a synonym of uint32_t. The meaning of the corresponding value depends on the value of the MSB:
|
||||
* - If MSB is 0, then the 31 remaining LSBs represent the bitrate in bits per second
|
||||
* - If MSB is 1, then the 31 remaining LSBs represent the bitrate in 1/256 bits per second
|
||||
*/
|
||||
typedef uint32_t lr20xx_radio_ook_bitrate_t;
|
||||
|
||||
/**
|
||||
* @brief BT value for the pulse shape filter of OOK modulation
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR20XX_RADIO_OOK_PULSE_SHAPE_OFF = 0x00,
|
||||
LR20XX_RADIO_OOK_PULSE_SHAPE_BT_05 = 0x05,
|
||||
LR20XX_RADIO_OOK_PULSE_SHAPE_BT_1 = 0x07,
|
||||
} lr20xx_radio_ook_pulse_shape_t;
|
||||
|
||||
/**
|
||||
* @brief Magnitude depth value
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR20XX_RADIO_OOK_MAG_DEPTH_FULL = 0x00, //!< The magnitude depth is limited by the power amplifier and depends on
|
||||
//!< the output power, external components and bitrate
|
||||
LR20XX_RADIO_OOK_MAG_DEPTH_UP_TO_20DB =
|
||||
0x01, //!< Maximal magnitude depth is 20dB. The exact value must be measured on the device. It depends on
|
||||
//!< external components and bitrate.
|
||||
} lr20xx_radio_ook_mag_depth_t;
|
||||
|
||||
/**
|
||||
* @brief Configuration of address filtering
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR20XX_RADIO_OOK_ADDRESS_FILTERING_DISABLED = 0x00, //!< Disable address filtering
|
||||
LR20XX_RADIO_OOK_ADDRESS_FILTERING_NODE = 0x01, //!< Filter on node address
|
||||
LR20XX_RADIO_OOK_ADDRESS_FILTERING_NODE_BROADCAST = 0x02, //!< Filter on both node and broadcast addresses
|
||||
} lr20xx_radio_ook_address_filtering_t;
|
||||
|
||||
/**
|
||||
* @brief Configure the header mode of OOK packet
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR20XX_RADIO_OOK_HEADER_IMPLICIT =
|
||||
0x00, //!< (aka. fixed length packet) The packet is sent without header so the receiver must be configured to
|
||||
//!< receive the same payload length as the transmitted one
|
||||
LR20XX_RADIO_OOK_HEADER_EXPLICIT = 0x01, //!< Packet with variable payload length encoded in a 8-bit header
|
||||
LR20XX_RADIO_OOK_HEADER_16BITS = 0x03, //!< Variable payload length encoded on 15LSBs - MSB is RFU
|
||||
} lr20xx_radio_ook_header_mode_t;
|
||||
|
||||
/**
|
||||
* @brief Configuration of CRC field
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR20XX_RADIO_OOK_CRC_OFF = 0x00, //!< CRC is not added to packet
|
||||
LR20XX_RADIO_OOK_CRC_1_BYTE = 0x01, //!< CRC is 1-byte long
|
||||
LR20XX_RADIO_OOK_CRC_2_BYTES = 0x02, //!< CRC is 2-byte long
|
||||
LR20XX_RADIO_OOK_CRC_3_BYTES = 0x03, //!< CRC is 3-byte long
|
||||
LR20XX_RADIO_OOK_CRC_4_BYTES = 0x04, //!< CRC is 4-byte long
|
||||
LR20XX_RADIO_OOK_CRC_1_BYTE_INVERTED = 0x09, //!< CRC is 1-byte long and inverted
|
||||
LR20XX_RADIO_OOK_CRC_2_BYTES_INVERTED = 0x0A, //!< CRC is 2-byte long and inverted
|
||||
LR20XX_RADIO_OOK_CRC_3_BYTES_INVERTED = 0x0B, //!< CRC is 3-byte long and inverted
|
||||
LR20XX_RADIO_OOK_CRC_4_BYTES_INVERTED = 0x0C, //!< CRC is 4-byte long and inverted
|
||||
} lr20xx_radio_ook_crc_t;
|
||||
|
||||
/**
|
||||
* @brief Configuration of CRC field
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR20XX_RADIO_OOK_ENCODING_OFF = 0x00, //!< No encoding
|
||||
LR20XX_RADIO_OOK_ENCODING_MANCHESTER = 0x01, //!< Manchester encoding
|
||||
LR20XX_RADIO_OOK_ENCODING_BIPHASE_MARK = 0x02, //!< Biphase mark encoding
|
||||
LR20XX_RADIO_OOK_ENCODING_MANCHESTER_INV = 0x09, //!< Inverted-manchester encoding
|
||||
LR20XX_RADIO_OOK_ENCODING_BIPHASE_MARK_INV = 0x0A, //!< Inverted biphase mark encoding
|
||||
} lr20xx_radio_ook_encoding_t;
|
||||
|
||||
/**
|
||||
* @brief Syncword endianess
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR20XX_RADIO_OOK_SYNCWORD_LSBF = 0x00, //!< Syncword is transmitted Least Significant Bit First
|
||||
LR20XX_RADIO_OOK_SYNCWORD_MSBF = 0x01, //!< Syncword is transmitted Most Significant Bit First
|
||||
} lr20xx_radio_ook_syncword_bit_order_t;
|
||||
|
||||
/**
|
||||
* @brief Start-of-Frame delimiter type for OOK Rx detector
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LR20XX_RADIO_OOK_RX_DETECTOR_SFD_TYPE_FALLING_EDGE = 0x00, //!<
|
||||
LR20XX_RADIO_OOK_RX_DETECTOR_SFD_TYPE_RISING_EDGE = 0x01, //!<
|
||||
} lr20xx_radio_ook_rx_detector_sfd_type_t;
|
||||
|
||||
/**
|
||||
* @brief Modulation configuration for OOK packet
|
||||
*/
|
||||
typedef struct lr20xx_radio_ook_mod_params_s
|
||||
{
|
||||
lr20xx_radio_ook_bitrate_t br; //!< Bitrate
|
||||
lr20xx_radio_ook_pulse_shape_t pulse_shape; //!< Pulse shape
|
||||
lr20xx_radio_fsk_common_bw_t bw; //!< Bandwidth
|
||||
lr20xx_radio_ook_mag_depth_t mag_depth; //!< Magnitude depth
|
||||
} lr20xx_radio_ook_mod_params_t;
|
||||
|
||||
/**
|
||||
* @brief Structure of configuration for OOK packet parameters
|
||||
*
|
||||
* The \p payload_length field meaning depends on the header_mode value:
|
||||
* - if header_mode is \p LR20XX_RADIO_OOK_HEADER_IMPLICIT, then \p payload_length is the number of payload byte to
|
||||
* receive (not including CRC configuration)
|
||||
* - otherwise, \p payload_length is the maximal length of packet to receive (not including CRC). In this case, if a
|
||||
* packet is received with a header indicating the payload length is superior to the one configured, the chip raises the
|
||||
* IRQ \p LR20XX_SYSTEM_IRQ_LEN_ERROR (if this IRQ has been configured with \p lr20xx_system_set_dio_irq_cfg function).
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t pbl_length_in_bit; //!< Preamble length in bits
|
||||
lr20xx_radio_ook_address_filtering_t address_filtering; //!< Address filtering configuration
|
||||
lr20xx_radio_ook_header_mode_t header_mode; //!< Header mode
|
||||
uint16_t payload_length; //!< Payload length in bytes
|
||||
lr20xx_radio_ook_crc_t crc; //!< CRC configuration
|
||||
lr20xx_radio_ook_encoding_t encoding; //!< Encoding configuration
|
||||
} lr20xx_radio_ook_pkt_params_t;
|
||||
|
||||
/**
|
||||
* @brief Rx statistics of OOK packets
|
||||
*/
|
||||
typedef struct lr20xx_radio_ook_rx_statistics_s
|
||||
{
|
||||
uint16_t n_received_packets; //!< Number of received packets
|
||||
uint16_t n_crc_errors; //!< Number of received packets with CRC error
|
||||
uint16_t n_length_errors; //!< Number of received packets with length error
|
||||
} lr20xx_radio_ook_rx_statistics_t;
|
||||
|
||||
/**
|
||||
* @brief Structure of OOK packet status
|
||||
*/
|
||||
typedef struct lr20xx_radio_ook_packet_status_s
|
||||
{
|
||||
uint16_t packet_length_bytes; //!< Length of last received packet in bytes
|
||||
int16_t rssi_avg_in_dbm; //!< RSSI in dBm - averaged over the last received packet
|
||||
uint8_t rssi_avg_half_dbm_count; //!< Count of 0.5 dBm to subtract to @p rssi_avg_in_dbm value in dBm
|
||||
int16_t rssi_on_in_dbm; //!< RSSI estimated during @a ON part in dBm
|
||||
uint8_t rssi_on_half_dbm_count; //!< Count of 0.5 dBm to subtract to @p rssi_on_in_dbm value in dBm
|
||||
bool is_addr_match_broadcast; //!< True if address filtering is enabled and match with broadcast address, false
|
||||
//!< otherwise
|
||||
bool is_addr_match_node; //!< True if address filtering is enabled and match with node address, false
|
||||
//!< otherwise
|
||||
uint8_t link_quality_indicator; //!< Average difference between @a 0 and @a 1 symbols, in dB
|
||||
} lr20xx_radio_ook_packet_status_t;
|
||||
|
||||
/**
|
||||
* @brief Rx detector configuration for OOK packet
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t pattern; //!< Rx detector pattern
|
||||
uint8_t pattern_length_in_bit; //!< Rx detector pattern length - 1
|
||||
uint8_t pattern_repeat_nb; //!< Rx detector pattern repetition number - in [0:31]
|
||||
lr20xx_radio_ook_rx_detector_sfd_type_t sfd_type; //!< Start-of-Frame Delimiter type
|
||||
uint8_t sfd_length_in_bit; //!< Start-of-Frame Delimiter length in bit - in [0:15]
|
||||
bool is_syncword_encoded; //!< Configure the encoding of syncword. If set to \p true the syncword is encoded the
|
||||
//!< same way as the payload
|
||||
} lr20xx_radio_ook_rx_detector_t;
|
||||
|
||||
/**
|
||||
* @brief Rx detector configuration for OOK packet
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bit_index; //!< LFSR bit index - in [0:15]
|
||||
uint16_t polynomial; //!< Whitening polynomial - 12-bit value
|
||||
uint16_t seed; //!< Whitening seed - 12-bit value
|
||||
} lr20xx_radio_ook_whitening_params_t;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------------------------
|
||||
* --- PUBLIC FUNCTIONS PROTOTYPES ---------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LR20XX_RADIO_OOK_TYPES_H
|
||||
|
||||
/* --- EOF ------------------------------------------------------------------ */
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#if IS_ENABLED(CONFIG_ZEPHCORE_RADIO_LR1110)
|
||||
#include <adapters/radio/LR1110Radio.h>
|
||||
#elif IS_ENABLED(CONFIG_ZEPHCORE_RADIO_LR2021)
|
||||
#include <adapters/radio/LR2021Radio.h>
|
||||
#else
|
||||
#include <adapters/radio/SX126xRadio.h>
|
||||
#endif
|
||||
|
||||
@@ -166,7 +166,8 @@ static void lr20xx_configure_rfswitch(void *ctx, const struct lr20xx_config *cfg
|
||||
|
||||
/* Set this DIO function to RF switch control */
|
||||
lr20xx_system_set_dio_function(ctx, dio,
|
||||
LR20XX_SYSTEM_DIO_FUNC_RF_SWITCH);
|
||||
LR20XX_SYSTEM_DIO_FUNC_RF_SWITCH,
|
||||
LR20XX_SYSTEM_DIO_DRIVE_NONE);
|
||||
|
||||
/* Build the per-DIO mode bitmask:
|
||||
* which operational modes drive this DIO HIGH */
|
||||
@@ -846,7 +847,7 @@ static int lr20xx_hw_init(struct lr20xx_data *data,
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
LOG_INF("LR20xx HW:0x%02X FW:0x%04X", ver.hw, ver.fw);
|
||||
LOG_INF("LR20xx v%u.%u", ver.major, ver.minor);
|
||||
|
||||
if (cfg->tcxo_voltage_mv > 0) {
|
||||
/* Convert ms to RTC steps (31.25 us per step) */
|
||||
|
||||
@@ -1,37 +1,22 @@
|
||||
diff --git a/drivers/lora/CMakeLists.txt b/drivers/lora/CMakeLists.txt
|
||||
index 9cd035fcf2b..18d04ec099a 100644
|
||||
index cda2f6dbaf3..18d04ec099a 100644
|
||||
--- a/drivers/lora/CMakeLists.txt
|
||||
+++ b/drivers/lora/CMakeLists.txt
|
||||
@@ -1,7 +1,11 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
+# ZephCore patch: adds lr11xx driver subdirectory.
|
||||
@@ -5,5 +5,6 @@ zephyr_sources_ifdef(CONFIG_LORA_SHELL shell.c)
|
||||
|
||||
zephyr_sources_ifdef(CONFIG_LORA_SHELL shell.c)
|
||||
|
||||
+add_subdirectory_ifdef(CONFIG_LORA_LR11XX lr11xx)
|
||||
add_subdirectory_ifdef(CONFIG_LORA_LR11XX lr11xx)
|
||||
+add_subdirectory_ifdef(CONFIG_LORA_LR20XX lr20xx)
|
||||
+
|
||||
|
||||
# zephyr-keep-sorted-start
|
||||
add_subdirectory_ifdef(CONFIG_LORA_MODULE_BACKEND_LORAMAC_NODE loramac-node)
|
||||
add_subdirectory_ifdef(CONFIG_LORA_MODULE_BACKEND_LORA_BASICS_MODEM lora-basics-modem)
|
||||
diff --git a/drivers/lora/Kconfig b/drivers/lora/Kconfig
|
||||
index 657bdb9ce28..f8513b37044 100644
|
||||
index 0ebee4246f3..f8513b37044 100644
|
||||
--- a/drivers/lora/Kconfig
|
||||
+++ b/drivers/lora/Kconfig
|
||||
@@ -5,6 +5,7 @@
|
||||
#
|
||||
|
||||
# Top-level configuration file for LORA drivers.
|
||||
+# ZephCore patch: adds lr11xx driver Kconfig.
|
||||
|
||||
menuconfig LORA
|
||||
bool "LoRa drivers"
|
||||
@@ -60,6 +61,8 @@ config LORA_INIT_PRIORITY
|
||||
|
||||
@@ -62,5 +62,6 @@ config LORA_INIT_PRIORITY
|
||||
rsource "Kconfig.sx12xx"
|
||||
rsource "Kconfig.rylrxxx"
|
||||
+rsource "lr11xx/Kconfig"
|
||||
rsource "lr11xx/Kconfig"
|
||||
+rsource "lr20xx/Kconfig"
|
||||
rsource "lora-basics-modem/Kconfig"
|
||||
rsource "native/Kconfig"
|
||||
|
||||
|
||||
@@ -364,6 +364,10 @@ static NodePrefs temp_prefs;
|
||||
/* LR1110 via Zephyr LoRa driver */
|
||||
static const struct device *const lora_dev = DEVICE_DT_GET(DT_ALIAS(lora0));
|
||||
static mesh::LR1110Radio lora_radio(lora_dev, zephyr_board, &temp_prefs);
|
||||
#elif IS_ENABLED(CONFIG_ZEPHCORE_RADIO_LR2021)
|
||||
/* LR2021 via Zephyr LoRa driver */
|
||||
static const struct device *const lora_dev = DEVICE_DT_GET(DT_ALIAS(lora0));
|
||||
static mesh::LR2021Radio lora_radio(lora_dev, zephyr_board, &temp_prefs);
|
||||
#else
|
||||
/* SX126x via Zephyr LoRa driver */
|
||||
static const struct device *const lora_dev = DEVICE_DT_GET(DT_ALIAS(lora0));
|
||||
|
||||
Reference in New Issue
Block a user