* HAL: Fixed packet timestamp issue which was "jumping in time" in specific
conditions.
* HAL: Workaround hardware issue when reading 32-bits registers (timestamp, nb
bytes in RX buffer...)
* HAL: Fixed potential endless loop in sx1302_tx_abort() in SPI access fails.
* Packet Forwarder: Added global_conf.json.sx1250.US915 for US915 band
* test_hal_rx: added command line to specify RSSI offset to be applied
This commit is contained in:
Michael Coracin 2020-02-21 10:33:23 +01:00
commit 6291e62ef9
8 changed files with 240 additions and 68 deletions

View file

@ -25,7 +25,7 @@ License: Revised BSD License, see LICENSE.TXT file include in the project
/* --- DEPENDANCIES --------------------------------------------------------- */
#include <stdint.h> /* C99 types*/
#include <stdbool.h> /* boolean type */
#include <stdbool.h> /* boolean type */
#include "config.h" /* library configuration options (dynamically generated) */
@ -41,13 +41,15 @@ License: Revised BSD License, see LICENSE.TXT file include in the project
/**
@struct timestamp_counter_s
@brief context to maintain the internal counters (inst and pps trig) wrapping
@brief context to maintain the internal counters (inst and pps trig) rollover status
*/
struct timestamp_info_s {
uint32_t counter_us_27bits_ref; /* reference value (last read) */
uint8_t counter_us_27bits_wrap; /* rollover/wrap status */
};
typedef struct timestamp_counter_s {
uint32_t counter_us_raw_27bits_inst_prev;
uint32_t counter_us_raw_27bits_pps_prev;
uint8_t counter_us_raw_27bits_inst_wrap;
uint8_t counter_us_raw_27bits_pps_wrap;
struct timestamp_info_s inst; /* holds current reference of the instantaneous counter */
struct timestamp_info_s pps; /* holds current reference of the pps-trigged counter */
} timestamp_counter_t;
/* -------------------------------------------------------------------------- */
@ -85,6 +87,14 @@ void timestamp_counter_update(timestamp_counter_t * self, bool pps, uint32_t cnt
*/
uint32_t timestamp_counter_expand(timestamp_counter_t * self, bool pps, uint32_t cnt_us);
/**
@brief Convert the 27-bits packet timestamp to a 32-bits counter which wraps on a uint32_t.
@param self Pointer to the counter handler
@param cnt_us The packet 27-bits counter to be expanded
@return the 32-bits counter
*/
uint32_t timestamp_pkt_expand(timestamp_counter_t * self, uint32_t cnt_us);
/**
@brief Reads the SX1302 internal counter register, and return the 32-bits 1 MHz counter
@param self Pointer to the counter handler