Chirp SonicLib  4.9.0
Functions | Variables
chx01_freqsweep.c File Reference

Chirp CHx01 Frequency Sweep firmware interface. More...

#include <invn/soniclib/soniclib.h>
#include <invn/soniclib/details/ch_common.h>
#include <invn/soniclib/details/ch_math_utils.h>
#include "chx01_freqsweep.h"

Functions

uint16_t chx01_freqsweep_get_amplitude (ch_dev_t *dev_ptr)
 Gets measured intensity from the sensor. More...
 
uint16_t chx01_freqsweep_get_dco_code (ch_dev_t *dev_ptr)
 
uint8_t chx01_freqsweep_get_iq_data (ch_dev_t *dev_ptr, uint8_t *buf_ptr, uint16_t start_sample, uint16_t num_samples, uint8_t mode)
 Reads IQ data from sensor and places it into specified buffer. More...
 
uint8_t chx01_freqsweep_get_locked_state (ch_dev_t *dev_ptr)
 Check if the sensor has completed its start-up calibration (locking) procedure. More...
 
uint32_t chx01_freqsweep_get_op_freq (ch_dev_t *dev_ptr)
 
uint32_t chx01_freqsweep_get_range (ch_dev_t *dev_ptr, ch_range_t range_type)
 
uint8_t chx01_freqsweep_init (ch_dev_t *dev_ptr, fw_info_t **fw_info)
 
int chx01_freqsweep_set_dco_divider (ch_dev_t *dev_ptr, uint8_t dco_divider)
 
int chx01_freqsweep_set_dco_start (ch_dev_t *dev_ptr, uint16_t dco_start)
 
int chx01_freqsweep_set_dco_stop (ch_dev_t *dev_ptr, uint16_t dco_stop)
 
uint8_t chx01_freqsweep_set_holdoff (ch_dev_t *dev_ptr, uint8_t holdoff)
 Configure target detection holdoff. More...
 
int chx01_freqsweep_set_pulse_width (ch_dev_t *dev_ptr, uint8_t pulse_width)
 
uint8_t chx01_freqsweep_set_rxqueue_item (ch_dev_t *dev_ptr, uint8_t queue_index, uint8_t samples, uint8_t attenuation, uint8_t gain)
 Write an entry into the receive settings queue. More...
 
uint8_t chx01_freqsweep_set_threshold (ch_dev_t *dev_ptr, uint16_t threshold)
 Configure threshold of detection. More...
 
int chx01_freqsweep_set_tx_length (ch_dev_t *dev_ptr, uint8_t tx_length)
 
void chx01_freqsweep_store_op_freq (ch_dev_t *dev_ptr)
 
void chx01_freqsweep_store_pt_result (ch_dev_t *dev_ptr)
 
void chx01_freqsweep_store_scale_factor (ch_dev_t *dev_ptr)
 

Variables

const uint8_t chx01_freqsweep_fw [CHX01_FW_SIZE]
 

Detailed Description

Chirp CHx01 Frequency Sweep firmware interface.

This file contains function definitions to interface a specific sensor firmware package to SonicLib, including the main initialization routine for the firmware. That routine initializes various fields within the ch_dev_t device descriptor and specifies the proper functions to implement SonicLib API calls. Those may either be common implementations or firmware-specific routines located in this file.

Function Documentation

◆ chx01_freqsweep_get_amplitude()

uint16_t chx01_freqsweep_get_amplitude ( ch_dev_t dev_ptr)

Gets measured intensity from the sensor.

Parameters
dev_ptra pointer to the ch_dev_t device descriptor

This function reads back the amplitude from the sensor. The intensity is representative of the incoming sound pressure.

Returns
Amplitude (arbitrary units).

◆ chx01_freqsweep_get_iq_data()

uint8_t chx01_freqsweep_get_iq_data ( ch_dev_t dev_ptr,
uint8_t *  buf_ptr,
uint16_t  start_sample,
uint16_t  num_samples,
uint8_t  mode 
)

Reads IQ data from sensor and places it into specified buffer.

Parameters
dev_ptrPointer to the ch_dev_t device descriptor
buf_ptrBuffer to which to store IQ data
start_samplestarting sample of requested I/Q data
num_samplesnumber of samples to return I/Q for
modeI/O mode - must be CH_IO_MODE_BLOCK
Returns
0 on success, nonzero on failure

◆ chx01_freqsweep_get_locked_state()

uint8_t chx01_freqsweep_get_locked_state ( ch_dev_t dev_ptr)

Check if the sensor has completed its start-up calibration (locking) procedure.

Parameters
dev_ptra pointer to the ch_dev_t device descriptor
Returns
1 if the sensor is locked, 0 otherwise.

◆ chx01_freqsweep_set_holdoff()

uint8_t chx01_freqsweep_set_holdoff ( ch_dev_t dev_ptr,
uint8_t  holdoff 
)

Configure target detection holdoff.

Parameters
dev_ptra pointer to the ch_dev_t device descriptor
holdoffnumber of samples to discard before starting target detection
Returns
0 if successful.

◆ chx01_freqsweep_set_rxqueue_item()

uint8_t chx01_freqsweep_set_rxqueue_item ( ch_dev_t dev_ptr,
uint8_t  queue_index,
uint8_t  samples,
uint8_t  attenuation,
uint8_t  gain 
)

Write an entry into the receive settings queue.

Parameters
dev_ptra pointer to the ch_dev_t device descriptor
queue_indexwhich position in the queue to write this item
samplessample count for which these settings will be in effect, Range of values 1-127
attenuationRange of values 0-3
gainRange of values 0-4

◆ chx01_freqsweep_set_threshold()

uint8_t chx01_freqsweep_set_threshold ( ch_dev_t dev_ptr,
uint16_t  threshold 
)

Configure threshold of detection.

Parameters
dev_ptra pointer to the ch_dev_t device descriptor
thresholdminimum received echo intensity for detecting a target
Returns
0 if successful.