From d0fc63c1ab3ab4a38fb2297b76e40119fd288572 Mon Sep 17 00:00:00 2001 From: smtc-bot Date: Fri, 15 Dec 2023 10:17:53 +0100 Subject: [PATCH] Release v2.3.2 --- CHANGELOG.md | 11 +++ src/llcc68.c | 173 +++++++++++++++++++++--------------- src/llcc68.h | 80 +++++++++++++++++ src/llcc68_driver_version.h | 4 +- 4 files changed, 192 insertions(+), 76 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73cca23..9950f49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.3.2] - 2023-12-15 + +### Changed +- `llcc68_set_gfsk_sync_word()` function - Remove memcpy usage + +## [2.3.0] - 2023-10-10 + +### Added +- `llcc68_set_bpsk_mod_params()` function - Set the modulation parameters for BPSK packets +- `llcc68_set_bpsk_pkt_params()` function - Set the packet parameters for BPSK packets + ## [2.2.0] - 2023-03-27 ### Added diff --git a/src/llcc68.c b/src/llcc68.c index 7a5396b..603eef2 100644 --- a/src/llcc68.c +++ b/src/llcc68.c @@ -36,8 +36,7 @@ * ----------------------------------------------------------------------------- * --- DEPENDENCIES ------------------------------------------------------------ */ - -#include // memcpy +#include #include "llcc68.h" #include "llcc68_hal.h" #include "llcc68_regs.h" @@ -173,8 +172,10 @@ typedef enum llcc68_commands_size_e LLCC68_SIZE_GET_PKT_TYPE = 2, LLCC68_SIZE_SET_TX_PARAMS = 3, LLCC68_SIZE_SET_MODULATION_PARAMS_GFSK = 9, + LLCC68_SIZE_SET_MODULATION_PARAMS_BPSK = 5, LLCC68_SIZE_SET_MODULATION_PARAMS_LORA = 5, LLCC68_SIZE_SET_PKT_PARAMS_GFSK = 10, + LLCC68_SIZE_SET_PKT_PARAMS_BPSK = 2, LLCC68_SIZE_SET_PKT_PARAMS_LORA = 7, LLCC68_SIZE_SET_CAD_PARAMS = 8, LLCC68_SIZE_SET_BUFFER_BASE_ADDRESS = 3, @@ -516,11 +517,10 @@ llcc68_status_t llcc68_get_irq_status( const void* context, llcc68_irq_mask_t* i LLCC68_GET_IRQ_STATUS, LLCC68_NOP, }; - uint8_t irq_local[sizeof( llcc68_irq_mask_t )] = { 0x00 }; - llcc68_status_t status = LLCC68_STATUS_ERROR; + uint8_t irq_local[sizeof( llcc68_irq_mask_t )] = { 0x00 }; - status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_IRQ_STATUS, irq_local, - sizeof( llcc68_irq_mask_t ) ); + const llcc68_status_t status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_IRQ_STATUS, + irq_local, sizeof( llcc68_irq_mask_t ) ); if( status == LLCC68_STATUS_OK ) { @@ -633,16 +633,16 @@ llcc68_status_t llcc68_set_tx_params( const void* context, const int8_t pwr_in_d llcc68_status_t llcc68_set_gfsk_mod_params( const void* context, const llcc68_mod_params_gfsk_t* params ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; - const uint32_t bitrate = ( uint32_t )( 32 * LLCC68_XTAL_FREQ / params->br_in_bps ); - const uint32_t fdev = llcc68_convert_freq_in_hz_to_pll_step( params->fdev_in_hz ); - const uint8_t buf[LLCC68_SIZE_SET_MODULATION_PARAMS_GFSK] = { + const uint32_t bitrate = ( uint32_t )( 32 * LLCC68_XTAL_FREQ / params->br_in_bps ); + const uint32_t fdev = llcc68_convert_freq_in_hz_to_pll_step( params->fdev_in_hz ); + const uint8_t buf[LLCC68_SIZE_SET_MODULATION_PARAMS_GFSK] = { LLCC68_SET_MODULATION_PARAMS, ( uint8_t )( bitrate >> 16 ), ( uint8_t )( bitrate >> 8 ), ( uint8_t )( bitrate >> 0 ), ( uint8_t )( params->pulse_shape ), params->bw_dsb_param, ( uint8_t )( fdev >> 16 ), ( uint8_t )( fdev >> 8 ), ( uint8_t )( fdev >> 0 ), }; - status = ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_MODULATION_PARAMS_GFSK, 0, 0 ); + llcc68_status_t status = + ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_MODULATION_PARAMS_GFSK, 0, 0 ); if( status == LLCC68_STATUS_OK ) { @@ -653,9 +653,21 @@ llcc68_status_t llcc68_set_gfsk_mod_params( const void* context, const llcc68_mo return status; } +llcc68_status_t llcc68_set_bpsk_mod_params( const void* context, const llcc68_mod_params_bpsk_t* params ) +{ + const uint32_t bitrate = ( uint32_t )( 32 * LLCC68_XTAL_FREQ / params->br_in_bps ); + + const uint8_t buf[LLCC68_SIZE_SET_MODULATION_PARAMS_BPSK] = { + LLCC68_SET_MODULATION_PARAMS, ( uint8_t )( bitrate >> 16 ), ( uint8_t )( bitrate >> 8 ), + ( uint8_t )( bitrate >> 0 ), ( uint8_t )( params->pulse_shape ), + }; + + return ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_MODULATION_PARAMS_BPSK, 0, 0 ); +} + llcc68_status_t llcc68_set_lora_mod_params( const void* context, const llcc68_mod_params_lora_t* params ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; + llcc68_status_t status; if( ( ( params->bw == LLCC68_LORA_BW_250 ) && ( params->sf == LLCC68_LORA_SF11 ) ) || ( ( params->bw == LLCC68_LORA_BW_125 ) && @@ -670,7 +682,7 @@ llcc68_status_t llcc68_set_lora_mod_params( const void* context, const llcc68_mo ( uint8_t )( params->cr ), params->ldro & 0x01, }; - status = llcc68_hal_write( context, buf, LLCC68_SIZE_SET_MODULATION_PARAMS_LORA, 0, 0 ); + status = ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_MODULATION_PARAMS_LORA, 0, 0 ); if( status == LLCC68_STATUS_OK ) { @@ -701,10 +713,31 @@ llcc68_status_t llcc68_set_gfsk_pkt_params( const void* context, const llcc68_pk return ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_PKT_PARAMS_GFSK, 0, 0 ); } -llcc68_status_t llcc68_set_lora_pkt_params( const void* context, const llcc68_pkt_params_lora_t* params ) +llcc68_status_t llcc68_set_bpsk_pkt_params( const void* context, const llcc68_pkt_params_bpsk_t* params ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; + const uint8_t buf[LLCC68_SIZE_SET_PKT_PARAMS_BPSK] = { + LLCC68_SET_PKT_PARAMS, + params->pld_len_in_bytes, + }; + + llcc68_status_t status = + ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_PKT_PARAMS_BPSK, 0, 0 ); + if( status != LLCC68_STATUS_OK ) + { + return status; + } + + const uint8_t buf2[] = { + ( uint8_t )( params->ramp_up_delay >> 8 ), ( uint8_t )( params->ramp_up_delay >> 0 ), + ( uint8_t )( params->ramp_down_delay >> 8 ), ( uint8_t )( params->ramp_down_delay >> 0 ), + ( uint8_t )( params->pld_len_in_bits >> 8 ), ( uint8_t )( params->pld_len_in_bits >> 0 ), + }; + + return llcc68_write_register( context, 0x00F0, buf2, sizeof( buf2 ) ); +} +llcc68_status_t llcc68_set_lora_pkt_params( const void* context, const llcc68_pkt_params_lora_t* params ) +{ const uint8_t buf[LLCC68_SIZE_SET_PKT_PARAMS_LORA] = { LLCC68_SET_PKT_PARAMS, ( uint8_t )( params->preamble_len_in_symb >> 8 ), @@ -715,7 +748,8 @@ llcc68_status_t llcc68_set_lora_pkt_params( const void* context, const llcc68_pk ( uint8_t )( params->invert_iq_is_on ? 1 : 0 ), }; - status = ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_PKT_PARAMS_LORA, 0, 0 ); + llcc68_status_t status = + ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_PKT_PARAMS_LORA, 0, 0 ); // WORKAROUND - Optimizing the Inverted IQ Operation, see datasheet DS_LLCC68_V1.0 ยง15.4 if( status == LLCC68_STATUS_OK ) @@ -779,9 +813,8 @@ llcc68_status_t llcc68_set_buffer_base_address( const void* context, const uint8 llcc68_status_t llcc68_set_lora_symb_nb_timeout( const void* context, const uint8_t nb_of_symbs ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; - uint8_t exp = 0; - uint8_t mant = + uint8_t exp = 0; + uint8_t mant = ( ( ( nb_of_symbs > LLCC68_MAX_LORA_SYMB_NUM_TIMEOUT ) ? LLCC68_MAX_LORA_SYMB_NUM_TIMEOUT : nb_of_symbs ) + 1 ) >> 1; @@ -797,7 +830,8 @@ llcc68_status_t llcc68_set_lora_symb_nb_timeout( const void* context, const uint mant << ( 2 * exp + 1 ), }; - status = ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_LORA_SYMB_NUM_TIMEOUT, 0, 0 ); + llcc68_status_t status = + ( llcc68_status_t ) llcc68_hal_write( context, buf, LLCC68_SIZE_SET_LORA_SYMB_NUM_TIMEOUT, 0, 0 ); if( ( status == LLCC68_STATUS_OK ) && ( nb_of_symbs > 0 ) ) { @@ -817,10 +851,10 @@ llcc68_status_t llcc68_get_status( const void* context, llcc68_chip_status_t* ra const uint8_t buf[LLCC68_SIZE_GET_STATUS] = { LLCC68_GET_STATUS, }; - uint8_t status_local = 0; - llcc68_status_t status = LLCC68_STATUS_ERROR; + uint8_t status_local = 0; - status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_STATUS, &status_local, 1 ); + const llcc68_status_t status = + ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_STATUS, &status_local, 1 ); if( status == LLCC68_STATUS_OK ) { @@ -839,11 +873,10 @@ llcc68_status_t llcc68_get_rx_buffer_status( const void* context, llcc68_rx_buff LLCC68_GET_RX_BUFFER_STATUS, LLCC68_NOP, }; - uint8_t status_local[sizeof( llcc68_rx_buffer_status_t )] = { 0x00 }; - llcc68_status_t status = LLCC68_STATUS_ERROR; + uint8_t status_local[sizeof( llcc68_rx_buffer_status_t )] = { 0x00 }; - status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_RX_BUFFER_STATUS, status_local, - sizeof( llcc68_rx_buffer_status_t ) ); + const llcc68_status_t status = ( llcc68_status_t ) llcc68_hal_read( + context, buf, LLCC68_SIZE_GET_RX_BUFFER_STATUS, status_local, sizeof( llcc68_rx_buffer_status_t ) ); if( status == LLCC68_STATUS_OK ) { @@ -860,10 +893,10 @@ llcc68_status_t llcc68_get_gfsk_pkt_status( const void* context, llcc68_pkt_stat LLCC68_GET_PKT_STATUS, LLCC68_NOP, }; - uint8_t pkt_status_local[3] = { 0x00 }; - llcc68_status_t status = LLCC68_STATUS_ERROR; + uint8_t pkt_status_local[3] = { 0x00 }; - status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_PKT_STATUS, pkt_status_local, 3 ); + const llcc68_status_t status = + ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_PKT_STATUS, pkt_status_local, 3 ); if( status == LLCC68_STATUS_OK ) { @@ -893,11 +926,10 @@ llcc68_status_t llcc68_get_lora_pkt_status( const void* context, llcc68_pkt_stat LLCC68_GET_PKT_STATUS, LLCC68_NOP, }; - uint8_t pkt_status_local[sizeof( llcc68_pkt_status_lora_t )] = { 0x00 }; - llcc68_status_t status = LLCC68_STATUS_ERROR; + uint8_t pkt_status_local[sizeof( llcc68_pkt_status_lora_t )] = { 0x00 }; - status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_PKT_STATUS, pkt_status_local, - sizeof( llcc68_pkt_status_lora_t ) ); + const llcc68_status_t status = ( llcc68_status_t ) llcc68_hal_read( + context, buf, LLCC68_SIZE_GET_PKT_STATUS, pkt_status_local, sizeof( llcc68_pkt_status_lora_t ) ); if( status == LLCC68_STATUS_OK ) { @@ -915,10 +947,10 @@ llcc68_status_t llcc68_get_rssi_inst( const void* context, int16_t* rssi_in_dbm LLCC68_GET_RSSI_INST, LLCC68_NOP, }; - uint8_t rssi_local = 0x00; - llcc68_status_t status = LLCC68_STATUS_ERROR; + uint8_t rssi_local = 0x00; - status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_RSSI_INST, &rssi_local, 1 ); + const llcc68_status_t status = + ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_RSSI_INST, &rssi_local, 1 ); if( status == LLCC68_STATUS_OK ) { @@ -934,11 +966,10 @@ llcc68_status_t llcc68_get_gfsk_stats( const void* context, llcc68_stats_gfsk_t* LLCC68_GET_STATS, LLCC68_NOP, }; - uint8_t stats_local[sizeof( llcc68_stats_gfsk_t )] = { 0 }; - llcc68_status_t status = LLCC68_STATUS_ERROR; + uint8_t stats_local[sizeof( llcc68_stats_gfsk_t )] = { 0 }; - status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_STATS, stats_local, - sizeof( llcc68_stats_gfsk_t ) ); + const llcc68_status_t status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_STATS, + stats_local, sizeof( llcc68_stats_gfsk_t ) ); if( status == LLCC68_STATUS_OK ) { @@ -956,11 +987,10 @@ llcc68_status_t llcc68_get_lora_stats( const void* context, llcc68_stats_lora_t* LLCC68_GET_STATS, LLCC68_NOP, }; - uint8_t stats_local[sizeof( llcc68_stats_lora_t )] = { 0 }; - llcc68_status_t status = LLCC68_STATUS_ERROR; + uint8_t stats_local[sizeof( llcc68_stats_lora_t )] = { 0 }; - status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_STATS, stats_local, - sizeof( llcc68_stats_lora_t ) ); + const llcc68_status_t status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_STATS, + stats_local, sizeof( llcc68_stats_lora_t ) ); if( status == LLCC68_STATUS_OK ) { @@ -1000,11 +1030,10 @@ llcc68_status_t llcc68_get_device_errors( const void* context, llcc68_errors_mas LLCC68_GET_DEVICE_ERRORS, LLCC68_NOP, }; - uint8_t errors_local[sizeof( llcc68_errors_mask_t )] = { 0x00 }; - llcc68_status_t status = LLCC68_STATUS_ERROR; + uint8_t errors_local[sizeof( llcc68_errors_mask_t )] = { 0x00 }; - status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_DEVICE_ERRORS, errors_local, - sizeof( llcc68_errors_mask_t ) ); + const llcc68_status_t status = ( llcc68_status_t ) llcc68_hal_read( context, buf, LLCC68_SIZE_GET_DEVICE_ERRORS, + errors_local, sizeof( llcc68_errors_mask_t ) ); if( status == LLCC68_STATUS_OK ) { @@ -1273,11 +1302,15 @@ llcc68_status_t llcc68_cfg_rx_boosted( const void* context, const bool state ) llcc68_status_t llcc68_set_gfsk_sync_word( const void* context, const uint8_t* sync_word, const uint8_t sync_word_len ) { llcc68_status_t status = LLCC68_STATUS_ERROR; - uint8_t buf[8] = { 0 }; if( sync_word_len <= 8 ) { - memcpy( buf, sync_word, sync_word_len ); + uint8_t buf[8] = { 0 }; + + for( int i = 0; i < sync_word_len; i++ ) + { + buf[i] = sync_word[i]; + } status = llcc68_write_register( context, LLCC68_REG_SYNCWORDBASEADDRESS, buf, 8 ); } @@ -1286,10 +1319,9 @@ llcc68_status_t llcc68_set_gfsk_sync_word( const void* context, const uint8_t* s llcc68_status_t llcc68_set_lora_sync_word( const void* context, const uint8_t sync_word ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; - uint8_t buffer[2] = { 0x00 }; + uint8_t buffer[2] = { 0x00 }; - status = llcc68_read_register( context, LLCC68_REG_LR_SYNCWORD, buffer, 2 ); + llcc68_status_t status = llcc68_read_register( context, LLCC68_REG_LR_SYNCWORD, buffer, 2 ); if( status == LLCC68_STATUS_OK ) { @@ -1318,12 +1350,11 @@ llcc68_status_t llcc68_set_gfsk_crc_polynomial( const void* context, const uint1 llcc68_status_t llcc68_set_gfsk_whitening_seed( const void* context, const uint16_t seed ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; - uint8_t reg_value = 0; + uint8_t reg_value = 0; // The LLCC68_REG_WHITSEEDBASEADDRESS @ref LSBit is used for the seed value. The 7 MSBits must not be modified. // Thus, we first need to read the current value and then change the LSB according to the provided seed @ref value. - status = llcc68_read_register( context, LLCC68_REG_WHITSEEDBASEADDRESS, ®_value, 1 ); + llcc68_status_t status = llcc68_read_register( context, LLCC68_REG_WHITSEEDBASEADDRESS, ®_value, 1 ); if( status == LLCC68_STATUS_OK ) { reg_value = ( reg_value & 0xFE ) | ( ( uint8_t )( seed >> 8 ) & 0x01 ); @@ -1340,10 +1371,9 @@ llcc68_status_t llcc68_set_gfsk_whitening_seed( const void* context, const uint1 llcc68_status_t llcc68_cfg_tx_clamp( const void* context ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; - uint8_t reg_value = 0x00; + uint8_t reg_value = 0x00; - status = llcc68_read_register( context, LLCC68_REG_TX_CLAMP_CFG, ®_value, 1 ); + llcc68_status_t status = llcc68_read_register( context, LLCC68_REG_TX_CLAMP_CFG, ®_value, 1 ); if( status == LLCC68_STATUS_OK ) { @@ -1356,11 +1386,9 @@ llcc68_status_t llcc68_cfg_tx_clamp( const void* context ) llcc68_status_t llcc68_stop_rtc( const void* context ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; - uint8_t reg_value = 0; + uint8_t reg_value = 0; - reg_value = 0; - status = llcc68_write_register( context, LLCC68_REG_RTC_CTRL, ®_value, 1 ); + llcc68_status_t status = llcc68_write_register( context, LLCC68_REG_RTC_CTRL, ®_value, 1 ); if( status == LLCC68_STATUS_OK ) { @@ -1392,10 +1420,9 @@ llcc68_status_t llcc68_set_trimming_capacitor_values( const void* context, const llcc68_status_t llcc68_add_registers_to_retention_list( const void* context, const uint16_t* register_addr, uint8_t register_nb ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; - uint8_t buffer[9]; + uint8_t buffer[9] = {0}; - status = llcc68_read_register( context, LLCC68_REG_RETENTION_LIST_BASE_ADDRESS, buffer, 9 ); + llcc68_status_t status = llcc68_read_register( context, LLCC68_REG_RETENTION_LIST_BASE_ADDRESS, buffer, 9 ); if( status == LLCC68_STATUS_OK ) { @@ -1450,11 +1477,10 @@ llcc68_status_t llcc68_init_retention_list( const void* context ) llcc68_status_t llcc68_get_lora_params_from_header( const void* context, llcc68_lora_cr_t* cr, bool* crc_is_on ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; - uint8_t buffer_cr; - uint8_t buffer_crc; + uint8_t buffer_cr = 0; + uint8_t buffer_crc = 0; - status = llcc68_read_register( context, LLCC68_REG_LR_HEADER_CR, &buffer_cr, 1 ); + llcc68_status_t status = llcc68_read_register( context, LLCC68_REG_LR_HEADER_CR, &buffer_cr, 1 ); if( status == LLCC68_STATUS_OK ) { @@ -1478,10 +1504,9 @@ llcc68_status_t llcc68_get_lora_params_from_header( const void* context, llcc68_ static llcc68_status_t llcc68_tx_modulation_workaround( const void* context, llcc68_pkt_type_t pkt_type, llcc68_lora_bw_t bw ) { - llcc68_status_t status = LLCC68_STATUS_ERROR; - uint8_t reg_value = 0; + uint8_t reg_value = 0; - status = llcc68_read_register( context, LLCC68_REG_TX_MODULATION, ®_value, 1 ); + llcc68_status_t status = llcc68_read_register( context, LLCC68_REG_TX_MODULATION, ®_value, 1 ); if( status == LLCC68_STATUS_OK ) { diff --git a/src/llcc68.h b/src/llcc68.h index b265743..b492f6a 100644 --- a/src/llcc68.h +++ b/src/llcc68.h @@ -135,6 +135,30 @@ extern "C" { #define LLCC68_GFSK_RX_STATUS_ADRS_ERROR_POS ( 5U ) #define LLCC68_GFSK_RX_STATUS_ADRS_ERROR_MASK ( 0x01UL << LLCC68_GFSK_RX_STATUS_ADRS_ERROR_POS ) +/*! + * \brief Ramp-up delay for the power amplifier + * + * This parameter configures the delay to fine tune the ramp-up time of the power amplifier for BPSK operation. + */ +enum +{ + LLCC68_SIGFOX_DBPSK_RAMP_UP_TIME_DEFAULT = 0x0000, //!< No optimization + LLCC68_SIGFOX_DBPSK_RAMP_UP_TIME_100_BPS = 0x370F, //!< Ramp-up optimization for 100bps + LLCC68_SIGFOX_DBPSK_RAMP_UP_TIME_600_BPS = 0x092F, //!< Ramp-up optimization for 600bps +}; + +/*! + * \brief Ramp-down delay for the power amplifier + * + * This parameter configures the delay to fine tune the ramp-down time of the power amplifier for BPSK operation. + */ +enum +{ + LLCC68_SIGFOX_DBPSK_RAMP_DOWN_TIME_DEFAULT = 0x0000, //!< No optimization + LLCC68_SIGFOX_DBPSK_RAMP_DOWN_TIME_100_BPS = 0x1D70, //!< Ramp-down optimization for 100bps + LLCC68_SIGFOX_DBPSK_RAMP_DOWN_TIME_600_BPS = 0x04E1, //!< Ramp-down optimization for 600bps +}; + /* * ----------------------------------------------------------------------------- * --- PUBLIC TYPES ------------------------------------------------------------ @@ -264,6 +288,7 @@ typedef enum llcc68_pkt_types_e { LLCC68_PKT_TYPE_GFSK = 0x00, LLCC68_PKT_TYPE_LORA = 0x01, + LLCC68_PKT_TYPE_BPSK = 0x02, } llcc68_pkt_type_t; /** @@ -293,6 +318,14 @@ typedef enum llcc68_gfsk_pulse_shape_e LLCC68_GFSK_PULSE_SHAPE_BT_1 = 0x0B, } llcc68_gfsk_pulse_shape_t; +/** + * @brief LLCC68 BPSK modulation shaping enumeration definition + */ +typedef enum +{ + LLCC68_DBPSK_PULSE_SHAPE = 0x16, //!< Double OSR / RRC / BT 0.7 +} llcc68_bpsk_pulse_shape_t; + /** * @brief LLCC68 GFSK Rx bandwidth enumeration definition */ @@ -332,6 +365,15 @@ typedef struct llcc68_mod_params_gfsk_s llcc68_gfsk_bw_t bw_dsb_param; } llcc68_mod_params_gfsk_t; +/** + * @brief Modulation configuration for BPSK packet + */ +typedef struct llcc68_mod_params_bpsk_s +{ + uint32_t br_in_bps; //!< BPSK bitrate [bit/s] + llcc68_bpsk_pulse_shape_t pulse_shape; //!< BPSK pulse shape +} llcc68_mod_params_bpsk_t; + /** * @brief LLCC68 LoRa spreading factor enumeration definition */ @@ -473,6 +515,18 @@ typedef struct llcc68_pkt_params_gfsk_s llcc68_gfsk_dc_free_t dc_free; //!< Whitening configuration } llcc68_pkt_params_gfsk_t; +/** + * @brief LLCC68 BPSK packet parameters structure definition + */ +typedef struct llcc68_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 +} llcc68_pkt_params_bpsk_t; + /** * @brief LLCC68 LoRa CAD number of symbols enumeration definition * @@ -1146,6 +1200,19 @@ llcc68_status_t llcc68_set_tx_params( const void* context, const int8_t pwr_in_d */ llcc68_status_t llcc68_set_gfsk_mod_params( const void* context, const llcc68_mod_params_gfsk_t* params ); +/** + * @brief Set the modulation parameters for BPSK packets + * + * @remark The command @ref llcc68_set_pkt_type must be called prior to this + * one. + * + * @param [in] context Chip implementation context + * @param [in] params The structure of BPSK modulation configuration + * + * @returns Operation status + */ +llcc68_status_t llcc68_set_bpsk_mod_params( const void* context, const llcc68_mod_params_bpsk_t* params ); + /** * @brief Set the modulation parameters for LoRa packets * @@ -1171,6 +1238,19 @@ llcc68_status_t llcc68_set_lora_mod_params( const void* context, const llcc68_mo */ llcc68_status_t llcc68_set_gfsk_pkt_params( const void* context, const llcc68_pkt_params_gfsk_t* params ); +/** + * @brief Set the packet parameters for BPSK packets + * + * @remark The command @ref llcc68_set_pkt_type must be called prior to this + * one. + * + * @param [in] context Chip implementation context + * @param [in] params The structure of BPSK packet configuration + * + * @returns Operation status + */ +llcc68_status_t llcc68_set_bpsk_pkt_params( const void* context, const llcc68_pkt_params_bpsk_t* params ); + /** * @brief Set the packet parameters for LoRa packets * diff --git a/src/llcc68_driver_version.h b/src/llcc68_driver_version.h index d64290b..e022926 100644 --- a/src/llcc68_driver_version.h +++ b/src/llcc68_driver_version.h @@ -55,8 +55,8 @@ extern "C" { */ #define LLCC68_DRIVER_VERSION_MAJOR 2 -#define LLCC68_DRIVER_VERSION_MINOR 2 -#define LLCC68_DRIVER_VERSION_PATCH 0 +#define LLCC68_DRIVER_VERSION_MINOR 3 +#define LLCC68_DRIVER_VERSION_PATCH 2 /* * -----------------------------------------------------------------------------