first commit v2.0.1
This commit is contained in:
2511
CHIRP/drivers/inc/Doxyfile
Normal file
2511
CHIRP/drivers/inc/Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
47
CHIRP/drivers/inc/README.md
Normal file
47
CHIRP/drivers/inc/README.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# Chirp SonicLib
|
||||
|
||||
## Summary
|
||||
|
||||
Chirp SonicLib is a set of API functions and sensor driver routines designed
|
||||
to easily control Chirp ultrasonic sensors from an embedded C application. It allows an
|
||||
application developer to obtain ultrasonic range data from one or more devices, without
|
||||
needing to develop special low-level code to interact with the sensors directly.
|
||||
|
||||
The SonicLib API functions provide a consistent interface for an application to use
|
||||
Chirp sensors in various situations. This is especially important, because
|
||||
all Chirp sensors are completely software-defined, including the register map. The
|
||||
SonicLib interfaces allow an application to use different Chirp sensor firmware images,
|
||||
without requiring code changes. Only a single initialization parameter must be modified,
|
||||
and one line added to a header file, to use a new sensor firmware version.
|
||||
|
||||
\note All operation of the sensor is controlled through the set of functions, data structures,
|
||||
and symbolic values defined in the soniclib.h header file. You should not need to modify this file
|
||||
or the SonicLib functions, or use lower-level internal functions such as described in
|
||||
the ch_driver.h file. Using any of these non-public methods will reduce your ability to
|
||||
benefit from future enhancements and releases from Chirp.
|
||||
|
||||
## SonicLib API
|
||||
**The main documentation for the SonicLib API is in the soniclib.h header file.**
|
||||
That file contains definitions of all public interfaces that applications
|
||||
use to interact with the sensor.
|
||||
|
||||
## Required Board Support Package
|
||||
SonicLib also defines a set of board support package (BSP) functions that
|
||||
are specific to the hardware platform being used. The chirp_bsp.h file
|
||||
contains the definitions of these hardware interfaces. These interfaces
|
||||
allow the standard SonicLib functions to interact with the peripheral
|
||||
devices and other resources on the board. The BSP implementation is NOT
|
||||
part of SonicLib, and must be provided by the developer, board vendor,
|
||||
or Chirp. Contact Chirp for more information on available BSPs.
|
||||
|
||||
## Chirp Driver (internal)
|
||||
SonicLib includes internal driver functions to interact directly with the sensor.
|
||||
These modules are distributed as source code, to simplify integration with your embedded
|
||||
application and for reference only. These functions are described in the ch_driver.h
|
||||
header file. You should not modify these functions or call them directly from your application.
|
||||
|
||||
## Support
|
||||
support@chirpmicro.com
|
||||
|
||||
## Copyright
|
||||
© Copyright 2016-2021, Chirp Microsystems. All rights reserved.
|
47
CHIRP/drivers/inc/ch101.h
Normal file
47
CHIRP/drivers/inc/ch101.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*! \file ch101.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 ultrasonic sensor.
|
||||
*
|
||||
* This file contains various hardware-defined values for the CH101 sensor.
|
||||
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_H_
|
||||
#define CH101_H_
|
||||
|
||||
#define CH101_DATA_MEM_SIZE 0x800
|
||||
#define CH101_DATA_MEM_ADDR 0x0200
|
||||
#define CH101_PROG_MEM_SIZE 0x800
|
||||
#define CH101_PROG_MEM_ADDR 0xF800
|
||||
#define CH101_FW_SIZE CH101_PROG_MEM_SIZE
|
||||
|
||||
#define CH101_BANDWIDTH_INDEX_1 6 /*!< Index of first sample to use for calculating bandwidth. */
|
||||
#define CH101_BANDWIDTH_INDEX_2 (CH101_BANDWIDTH_INDEX_1 + 1) /*!< Index of second sample to use for calculating bandwidth. */
|
||||
#define CH101_SCALEFACTOR_INDEX 4 /*!< Index for calculating scale factor. */
|
||||
|
||||
#define CH101_MAX_TICK_INTERVAL 256
|
||||
|
||||
#endif
|
212
CHIRP/drivers/inc/ch101_finaltest.h
Normal file
212
CHIRP/drivers/inc/ch101_finaltest.h
Normal file
@@ -0,0 +1,212 @@
|
||||
/*!
|
||||
* \file ch101_finaltest.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 Finaltest sensor firmware.
|
||||
*
|
||||
* This file contains function definitions, register offsets and other interfaces
|
||||
* for use with the CH101 Finaltest sensor firmware. Many of these are designed for
|
||||
* compatibility with the Chirp Finaltest production test system.
|
||||
* These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220A, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CH101_FINALTEST_H_
|
||||
#define CH101_FINALTEST_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// finaltest firmware registers
|
||||
#define CH101_FINALTEST_REG_REGMAPFMT 0x00
|
||||
#define CH101_FINALTEST_REG_OPMODE 0x01
|
||||
#define CH101_FINALTEST_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_FINALTEST_REG_WBCFG 0x04
|
||||
#define CH101_FINALTEST_REG_PERIOD 0x05
|
||||
#define CH101_FINALTEST_REG_CAL_TRIG 0x06
|
||||
#define CH101_FINALTEST_REG_MAX_RANGE 0x07
|
||||
#define CH101_FINALTEST_REG_DCOSTART 0x08
|
||||
#define CH101_FINALTEST_REG_CAL_RESULT 0x0A
|
||||
#define CH101_FINALTEST_REG_DCOSTOP 0x0C
|
||||
#define CH101_FINALTEST_REG_TXLENGTH 0x0E
|
||||
#define CH101_FINALTEST_REG_READY 0x0F
|
||||
#define CH101_FINALTEST_REG_PULSE_WIDTH 0x10
|
||||
#define CH101_FINALTEST_REG_HOLDOFF 0x11
|
||||
#define CH101_FINALTEST_REG_THRESHOLD 0x12
|
||||
#define CH101_FINALTEST_REG_RXQUEUE 0x14
|
||||
#define CH101_FINALTEST_REG_TOF_SF 0x22
|
||||
#define CH101_FINALTEST_REG_TOF 0x24
|
||||
#define CH101_FINALTEST_REG_AMPLITUDE 0x26
|
||||
#define CH101_FINALTEST_REG_DCOCODE 0x28
|
||||
#define CH101_FINALTEST_REG_DATA 0x2A
|
||||
|
||||
|
||||
// Maximum number of samples that can be stored; max value of MAX_RANGE
|
||||
#define CH101_FINALTEST_MAX_SAMPLES 150
|
||||
|
||||
// Number of RXQUEUE 16-bit entries
|
||||
#define CH101_FINALTEST_RXQUEUE_ITEMS 7
|
||||
|
||||
// Bit width of each field in RXQUEUE items
|
||||
#define CH101_FINALTEST_RXQUEUE_BITS_SAMPLES 7
|
||||
#define CH101_FINALTEST_RXQUEUE_BITS_ATTEN 2
|
||||
#define CH101_FINALTEST_RXQUEUE_BITS_GAIN 3
|
||||
|
||||
// Position of lowest bit in each field of RXQUEUE items
|
||||
#define CH101_FINALTEST_RXQUEUE_BITPOS_SAMPLES 3
|
||||
#define CH101_FINALTEST_RXQUEUE_BITPOS_ATTEN (CH101_FINALTEST_RXQUEUE_BITPOS_SAMPLES + CH101_FINALTEST_RXQUEUE_BITS_SAMPLES)
|
||||
#define CH101_FINALTEST_RXQUEUE_BITPOS_GAIN (CH101_FINALTEST_RXQUEUE_BITPOS_ATTEN + CH101_FINALTEST_RXQUEUE_BITS_ATTEN)
|
||||
|
||||
// Values for Rx attenuation IN RXQUEUE items
|
||||
#define CH101_FINALTEST_RXQUEUE_ATTEN120 0
|
||||
#define CH101_FINALTEST_RXQUEUE_ATTEN60 1
|
||||
#define CH101_FINALTEST_RXQUEUE_ATTEN30 2
|
||||
#define CH101_FINALTEST_RXQUEUE_ATTEN1 3
|
||||
|
||||
// Values for Rx gain IN RXQUEUE items
|
||||
#define CH101_FINALTEST_RXQUEUE_GAIN1P6 0
|
||||
#define CH101_FINALTEST_RXQUEUE_GAIN3P8 1
|
||||
#define CH101_FINALTEST_RXQUEUE_GAIN5P7 2
|
||||
#define CH101_FINALTEST_RXQUEUE_GAIN12P3 3
|
||||
#define CH101_FINALTEST_RXQUEUE_GAIN25P6 4
|
||||
|
||||
// Enumerated values for various registers
|
||||
#define CH101_FINALTEST_OPMODE_IDLE 0x00
|
||||
#define CH101_FINALTEST_OPMODE_FREERUN 0x02
|
||||
#define CH101_FINALTEST_OPMODE_TRIGGERED 0x10
|
||||
#define CH101_FINALTEST_OPMODE_RX_ONLY 0x20
|
||||
|
||||
#define CH101_FINALTEST_PERIOD_IDLE 0
|
||||
#define CH101_FINALTEST_TICK_INTERVAL_IDLE 2048
|
||||
|
||||
#define CH101_FINALTEST_READY_NOTLOCKED 0x00
|
||||
#define CH101_FINALTEST_READY_NOTREADY 0x01
|
||||
#define CH101_FINALTEST_READY_FREQ_LOCKED_BM 0x04
|
||||
|
||||
|
||||
|
||||
// ASIC firmware linkage
|
||||
extern const char *ch101_finaltest_version; // version string in fw .c file
|
||||
|
||||
extern const uint8_t ch101_finaltest_fw[CH101_FW_SIZE];
|
||||
|
||||
|
||||
const unsigned char * get_ram_ch101_finaltest_init_ptr(void);
|
||||
uint16_t get_ch101_finaltest_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_finaltest_fw_ram_init_size(void);
|
||||
|
||||
|
||||
uint8_t ch101_finaltest_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t io_index, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
typedef enum { // XXX redundant definition from soniclib.h to resolve circular #include's
|
||||
CH101_FINALTEST_RANGE_ECHO_ONE_WAY = 0, /*!< One way - gets full pulse/echo distance & divides by 2. */
|
||||
CH101_FINALTEST_RANGE_ECHO_ROUND_TRIP = 1, /*!< Round trip - full pulse/echo distance. */
|
||||
CH101_FINALTEST_RANGE_DIRECT = 2, /*!< Direct - for receiving node in pitch-catch mode. */
|
||||
} ch101_finaltest_range_t;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Write an entry into the receive settings queue
|
||||
*
|
||||
* \param dev_ptr a pointer to the ch_dev_t device descriptor
|
||||
* \param queue_index which position in the queue to write this item
|
||||
* \param samples sample count for which these settings will be in effect, Range of values 1-127
|
||||
* \param attenuation Range of values 0-3, see Final Test interface description
|
||||
* \param gain Range of values 0-4, see Final Test interface description
|
||||
*/
|
||||
uint8_t ch101_finaltest_set_rxqueue_item( ch_dev_t* dev_ptr, uint8_t queue_index,
|
||||
uint8_t samples, uint8_t attenuation, uint8_t gain );
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Configure threshold of detection.
|
||||
*
|
||||
* \param dev_ptr a pointer to the ch_dev_t device descriptor
|
||||
* \param threshold minimum received echo intensity for detecting a target
|
||||
*
|
||||
* \return 0 if successful.
|
||||
*/
|
||||
uint8_t ch101_finaltest_set_threshold(ch_dev_t *dev_ptr, uint16_t threshold);
|
||||
|
||||
|
||||
uint32_t ch101_finaltest_get_range(ch_dev_t *dev_ptr, ch101_finaltest_range_t range_type);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Gets measured amplitude from the sensor.
|
||||
*
|
||||
* \param dev_ptr a pointer to the ch_dev_t device descriptor
|
||||
*
|
||||
* This function reads back the amplitude from the sensor. The amplitude is representative of the incoming sound pressure.
|
||||
*
|
||||
* \return Amplitude (arbitrary units).
|
||||
*/
|
||||
uint16_t ch101_finaltest_get_amplitude(ch_dev_t *dev_ptr);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Reads IQ data from sensor and places it into specified buffer.
|
||||
* \param dev_ptr Pointer to the ch_dev_t device descriptor
|
||||
* \param buf_ptr Buffer to which to store IQ data
|
||||
* \param start_sample starting sample of requested I/Q data
|
||||
* \param num_samples number of samples to return I/Q for
|
||||
* \param mode I/O mode - must be CH_IO_MODE_BLOCK
|
||||
* \return 0 on success, nonzero on failure
|
||||
*/
|
||||
|
||||
uint8_t ch101_finaltest_get_iq_data(ch_dev_t *dev_ptr, uint8_t /*ch_iq_sample_t*/ *buf_ptr, uint16_t start_sample, uint16_t num_samples,
|
||||
uint8_t /*ch_io_mode_t*/ mode);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Check if the sensor has completed its start-up calibration (locking) procedure.
|
||||
*
|
||||
* \param dev_ptr a pointer to the ch_dev_t device descriptor
|
||||
*
|
||||
* \return 1 if the sensor is locked, 0 otherwise.
|
||||
*/
|
||||
uint8_t ch101_finaltest_get_locked_state(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch101_finaltest_store_pt_result(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch101_finaltest_store_op_freq(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch101_finaltest_store_bandwidth(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch101_finaltest_store_scale_factor(ch_dev_t *dev_ptr);
|
||||
|
||||
int ch101_finaltest_set_pulse_width(ch_dev_t *dev_ptr,uint8_t pulse_width);
|
||||
|
||||
int ch101_finaltest_set_tx_length(ch_dev_t *dev_ptr, uint8_t tx_length);
|
||||
|
||||
uint32_t ch101_finaltest_get_op_freq(ch_dev_t *dev_ptr);
|
||||
|
||||
|
||||
#endif /* CH101_FINALTEST_H_ */
|
71
CHIRP/drivers/inc/ch101_floor.h
Normal file
71
CHIRP/drivers/inc/ch101_floor.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*! \file ch101_floor.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 Floor Detection enabled firmware
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 Floor
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_FLOOR_H_
|
||||
#define CH101_FLOOR_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_FLOOR_REG_OPMODE 0x01
|
||||
#define CH101_FLOOR_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_FLOOR_REG_RX_WIN_END 0x04
|
||||
#define CH101_FLOOR_REG_PERIOD 0x05
|
||||
#define CH101_FLOOR_REG_CAL_TRIG 0x06
|
||||
#define CH101_FLOOR_REG_MAX_RANGE 0x07
|
||||
#define CH101_FLOOR_REG_CALC 0x08
|
||||
#define CH101_FLOOR_REG_RX_GAIN_ATTEN_1 0x10
|
||||
#define CH101_FLOOR_REG_RX_HOLDOFF 0x11
|
||||
#define CH101_FLOOR_REG_RX_GAIN_ATTEN_2 0x12
|
||||
#define CH101_FLOOR_REG_READY 0x14
|
||||
#define CH101_FLOOR_REG_TOF_SF 0x16
|
||||
#define CH101_FLOOR_REG_AMPLITUDE_LOW 0x18
|
||||
#define CH101_FLOOR_REG_AMPLITUDE_HIGH 0x1A
|
||||
#define CH101_FLOOR_REG_CAL_RESULT 0x0A
|
||||
#define CH101_FLOOR_REG_DATA 0x1C
|
||||
|
||||
#define CH101_FLOOR_MAX_SAMPLES (150)
|
||||
|
||||
extern const char *ch101_floor_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_floor_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_floor_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_floor_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_floor_init_ptr(void);
|
||||
|
||||
uint8_t ch101_floor_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
99
CHIRP/drivers/inc/ch101_gppc.h
Normal file
99
CHIRP/drivers/inc/ch101_gppc.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/*! \file ch101_gppc.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPPC sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPPC
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPPC_H_
|
||||
#define CH101_GPPC_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPPC firmware registers */
|
||||
#define CH101_GPPC_REG_OPMODE 0x01
|
||||
#define CH101_GPPC_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPPC_REG_I2C_READ_OFFSET 0x04
|
||||
#define CH101_GPPC_REG_PERIOD 0x05
|
||||
#define CH101_GPPC_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPPC_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPPC_REG_TX_LENGTH 0x08
|
||||
#define CH101_GPPC_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPPC_REG_DCO_SET 0x0C
|
||||
#define CH101_GPPC_REG_THRESHOLD 0x0E
|
||||
#define CH101_GPPC_REG_TX_BITS 0x10
|
||||
#define CH101_GPPC_REG_RX_HOLDOFF 0x11
|
||||
#define CH101_GPPC_REG_ST_COEFF 0x13
|
||||
#define CH101_GPPC_REG_READY 0x14
|
||||
#define CH101_GPPC_REG_BIT_LENGTH 0x15
|
||||
#define CH101_GPPC_REG_TOF_SF 0x16
|
||||
#define CH101_GPPC_REG_TOF 0x18
|
||||
#define CH101_GPPC_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPPC_REG_RX_PULSE_LENGTH 0x1C
|
||||
#define CH101_GPPC_REG_DATA 0x1E
|
||||
|
||||
#define CH101_GPPC_MAX_SAMPLES (350)
|
||||
|
||||
#define CH101_GPPC_READY_FREQ_LOCKED (0x04)
|
||||
|
||||
#define CH101_GPPC_THRESHOLD_NUMBER 1
|
||||
|
||||
#define CH_SF_LOCK_FOUND (0)
|
||||
#define CH_SF_LOCK_START (1)
|
||||
#define CH_DCO_LOW 100
|
||||
#define CH_DCO_HIGH 250
|
||||
#define CH_DCO_SEARCH_THRESHOLD 100 //Hz, if error is above this, do a search
|
||||
#define DEBUG_DCO_SEARCH(X) X
|
||||
//#define DEBUG_DCO_SEARCH(X)
|
||||
|
||||
/* signal modulation */
|
||||
#define CH_TXMOD_DATA_MAX (31) /* max value of the modulated Tx data set by users*/
|
||||
#define MAX_NUM_OF_MOD_DATA (8) /* max number of modulated data */
|
||||
#define MAX_FUDGE_FACTOR (5)
|
||||
#define CH_PARITY_BIT (5) /* parity bit of Tx bits */
|
||||
#define CH_TXBITS_BITMASK (0x40) /* bit mask for Tx bits */
|
||||
#define CH_RXDEMOD_DATA_BITMASK (0x1F) /* bit mask for demodulated RX data */
|
||||
|
||||
extern const char *ch101_gppc_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gppc_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gppc_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gppc_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gppc_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gppc_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
uint32_t ch101_gppc_set_new_dco_code(ch_dev_t *dev_ptr, uint16_t dcocode);
|
||||
uint8_t ch101_gppc_set_frequency(ch_dev_t *dev_ptr, uint32_t target_freq_Hz);
|
||||
|
||||
|
||||
|
||||
#endif
|
73
CHIRP/drivers/inc/ch101_gpr.h
Normal file
73
CHIRP/drivers/inc/ch101_gpr.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*! \file ch101_gpr.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220A, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_H_
|
||||
#define CH101_GPR_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_REG_OPMODE 0x01
|
||||
#define CH101_GPR_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_REG_PERIOD 0x05
|
||||
#define CH101_GPR_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_REG_CALC 0x08
|
||||
#define CH101_GPR_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_REG_READY 0x14
|
||||
#define CH101_GPR_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_REG_TOF 0x18
|
||||
#define CH101_GPR_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_MAX_SAMPLES (225)
|
||||
|
||||
|
||||
|
||||
extern const char *ch101_gpr_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
76
CHIRP/drivers/inc/ch101_gpr_narrow.h
Normal file
76
CHIRP/drivers/inc/ch101_gpr_narrow.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*! \file ch101_gpr_narrow.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Narrow-FoV sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR
|
||||
* Narrow-FoV sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220A, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_NARROW_H_
|
||||
#define CH101_GPR_NARROW_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_NARROW_REG_OPMODE 0x01
|
||||
#define CH101_GPR_NARROW_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_NARROW_REG_PERIOD 0x05
|
||||
#define CH101_GPR_NARROW_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_NARROW_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_NARROW_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_NARROW_REG_CALC 0x08
|
||||
#define CH101_GPR_NARROW_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_NARROW_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_NARROW_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_NARROW_REG_READY 0x14
|
||||
#define CH101_GPR_NARROW_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_NARROW_REG_TOF 0x18
|
||||
#define CH101_GPR_NARROW_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_NARROW_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_NARROW_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_NARROW_MAX_SAMPLES (225)
|
||||
|
||||
|
||||
|
||||
extern const char *ch101_gpr_narrow_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_narrow_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_narrow_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_narrow_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_narrow_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_narrow_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
void ch101_gpr_narrow_store_pt_result(ch_dev_t *dev_ptr);
|
||||
|
||||
|
||||
|
||||
#endif
|
76
CHIRP/drivers/inc/ch101_gpr_narrow_wd.h
Normal file
76
CHIRP/drivers/inc/ch101_gpr_narrow_wd.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*! \file ch101_gpr_narrow_wd.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Narrow-FoV sensor firmware. (watchdog enabled)
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR
|
||||
* Narrow-FoV sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220A, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_NARROW_WD_H_
|
||||
#define CH101_GPR_NARROW_WD_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_NARROW_WD_REG_OPMODE 0x01
|
||||
#define CH101_GPR_NARROW_WD_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_NARROW_WD_REG_PERIOD 0x05
|
||||
#define CH101_GPR_NARROW_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_NARROW_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_NARROW_WD_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_NARROW_WD_REG_CALC 0x08
|
||||
#define CH101_GPR_NARROW_WD_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_NARROW_WD_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_NARROW_WD_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_NARROW_WD_REG_READY 0x14
|
||||
#define CH101_GPR_NARROW_WD_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_NARROW_WD_REG_TOF 0x18
|
||||
#define CH101_GPR_NARROW_WD_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_NARROW_WD_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_NARROW_WD_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_NARROW_WD_MAX_SAMPLES (225)
|
||||
|
||||
|
||||
|
||||
extern const char *ch101_gpr_narrow_wd_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_narrow_wd_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_narrow_wd_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_narrow_wd_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_narrow_wd_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_narrow_wd_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
void ch101_gpr_narrow_wd_store_pt_result(ch_dev_t *dev_ptr);
|
||||
|
||||
|
||||
|
||||
#endif
|
73
CHIRP/drivers/inc/ch101_gpr_open.h
Normal file
73
CHIRP/drivers/inc/ch101_gpr_open.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*! \file ch101_gpr_open.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Open sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR Open
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2019, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_OPEN_H_
|
||||
#define CH101_GPR_OPEN_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_OPEN_REG_OPMODE 0x01
|
||||
#define CH101_GPR_OPEN_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_OPEN_REG_PERIOD 0x05
|
||||
#define CH101_GPR_OPEN_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_OPEN_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_OPEN_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_OPEN_REG_CALC 0x08
|
||||
#define CH101_GPR_OPEN_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_OPEN_REG_READY 0x14
|
||||
#define CH101_GPR_OPEN_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_OPEN_REG_TOF 0x18
|
||||
#define CH101_GPR_OPEN_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_OPEN_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_OPEN_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_OPEN_CTR (0x2B368)
|
||||
#define CH101_GPR_OPEN_MAX_SAMPLES (150)
|
||||
|
||||
extern const char *ch101_gpr_open_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_open_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_open_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_open_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_open_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_open_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
void ch101_gpr_open_store_pt_result(ch_dev_t *dev_ptr);
|
||||
|
||||
|
||||
|
||||
#endif
|
72
CHIRP/drivers/inc/ch101_gpr_rxopt.h
Normal file
72
CHIRP/drivers/inc/ch101_gpr_rxopt.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*! \file ch101_gpr_rxopt.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Rx-optimized sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR
|
||||
* Rx-optimized sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_RXOPT_H_
|
||||
#define CH101_GPR_RXOPT_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR Rx-optimized firmware registers */
|
||||
#define CH101_GPR_RXOPT_REG_OPMODE 0x01
|
||||
#define CH101_GPR_RXOPT_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_RXOPT_REG_PERIOD 0x05
|
||||
#define CH101_GPR_RXOPT_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_RXOPT_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_RXOPT_REG_CALC 0x08
|
||||
#define CH101_GPR_RXOPT_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_RXOPT_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_RXOPT_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_RXOPT_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_RXOPT_REG_READY 0x14
|
||||
#define CH101_GPR_RXOPT_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_RXOPT_REG_TOF 0x18
|
||||
#define CH101_GPR_RXOPT_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_RXOPT_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_RXOPT_MAX_SAMPLES (225)
|
||||
|
||||
extern const char *ch101_gpr_rxopt_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_rxopt_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_rxopt_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_rxopt_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_rxopt_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_rxopt_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
72
CHIRP/drivers/inc/ch101_gpr_rxopt_narrow.h
Normal file
72
CHIRP/drivers/inc/ch101_gpr_rxopt_narrow.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*! \file ch101_gpr_rxopt_narrow.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Rx-optimized sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR
|
||||
* Rx-optimized sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_RXOPT_NARROW_H_
|
||||
#define CH101_GPR_RXOPT_NARROW_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR Rx-optimized firmware registers */
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_OPMODE 0x01
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_PERIOD 0x05
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_CALC 0x08
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_READY 0x14
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_TOF 0x18
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_RXOPT_NARROW_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_RXOPT_NARROW_MAX_SAMPLES (225)
|
||||
|
||||
extern const char *ch101_gpr_rxopt_narrow_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_rxopt_narrow_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_rxopt_narrow_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_rxopt_narrow_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_rxopt_narrow_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_rxopt_narrow_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
72
CHIRP/drivers/inc/ch101_gpr_rxopt_narrow_wd.h
Normal file
72
CHIRP/drivers/inc/ch101_gpr_rxopt_narrow_wd.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*! \file ch101_gpr_rxopt_narrow_wd.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Rx-optimized sensor firmware. (watchdog enabled)
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR
|
||||
* Rx-optimized sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_RXOPT_NARROW_WD_H_
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR Rx-optimized firmware registers */
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_OPMODE 0x01
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_PERIOD 0x05
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_CALC 0x08
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_READY 0x14
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_TOF 0x18
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_RXOPT_NARROW_WD_MAX_SAMPLES (225)
|
||||
|
||||
extern const char *ch101_gpr_rxopt_narrow_wd_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_rxopt_narrow_wd_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_rxopt_narrow_wd_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_rxopt_narrow_wd_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_rxopt_narrow_wd_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_rxopt_narrow_wd_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
72
CHIRP/drivers/inc/ch101_gpr_rxopt_wd.h
Normal file
72
CHIRP/drivers/inc/ch101_gpr_rxopt_wd.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*! \file ch101_gpr_rxopt_wd.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Rx-optimized sensor firmware. (watchdog enabled)
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR
|
||||
* Rx-optimized sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_RXOPT_WD_H_
|
||||
#define CH101_GPR_RXOPT_WD_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR Rx-optimized firmware registers */
|
||||
#define CH101_GPR_RXOPT_WD_REG_OPMODE 0x01
|
||||
#define CH101_GPR_RXOPT_WD_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_RXOPT_WD_REG_PERIOD 0x05
|
||||
#define CH101_GPR_RXOPT_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_RXOPT_WD_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_RXOPT_WD_REG_CALC 0x08
|
||||
#define CH101_GPR_RXOPT_WD_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_RXOPT_WD_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_RXOPT_WD_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_RXOPT_WD_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_RXOPT_WD_REG_READY 0x14
|
||||
#define CH101_GPR_RXOPT_WD_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_RXOPT_WD_REG_TOF 0x18
|
||||
#define CH101_GPR_RXOPT_WD_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_RXOPT_WD_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_RXOPT_WD_MAX_SAMPLES (225)
|
||||
|
||||
extern const char *ch101_gpr_rxopt_wd_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_rxopt_wd_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_rxopt_wd_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_rxopt_wd_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_rxopt_wd_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_rxopt_wd_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
72
CHIRP/drivers/inc/ch101_gpr_sr.h
Normal file
72
CHIRP/drivers/inc/ch101_gpr_sr.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*! \file ch101_gpr_sr.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Short-range sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR Short-range
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_SR_H_
|
||||
#define CH101_GPR_SR_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_SR_REG_OPMODE 0x01
|
||||
#define CH101_GPR_SR_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_SR_REG_PERIOD 0x05
|
||||
#define CH101_GPR_SR_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_SR_REG_CALC 0x08
|
||||
#define CH101_GPR_SR_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_SR_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_SR_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_SR_REG_READY 0x14
|
||||
#define CH101_GPR_SR_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_SR_REG_TOF 0x18
|
||||
#define CH101_GPR_SR_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_SR_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_SR_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_SR_MAX_SAMPLES (225)
|
||||
|
||||
extern const char *ch101_gpr_sr_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_sr_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_sr_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_sr_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_sr_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_sr_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr,
|
||||
uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
72
CHIRP/drivers/inc/ch101_gpr_sr_narrow.h
Normal file
72
CHIRP/drivers/inc/ch101_gpr_sr_narrow.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*! \file ch101_gpr_sr_narrow.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Short-range Narrow-FoV sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR Short-range
|
||||
* Narrow-FoV sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_SR_NARROW_H_
|
||||
#define CH101_GPR_SR_NARROW_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_SR_NARROW_REG_OPMODE 0x01
|
||||
#define CH101_GPR_SR_NARROW_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_SR_NARROW_REG_PERIOD 0x05
|
||||
#define CH101_GPR_SR_NARROW_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_NARROW_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_NARROW_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_SR_NARROW_REG_CALC 0x08
|
||||
#define CH101_GPR_SR_NARROW_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_SR_NARROW_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_SR_NARROW_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_SR_NARROW_REG_READY 0x14
|
||||
#define CH101_GPR_SR_NARROW_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_SR_NARROW_REG_TOF 0x18
|
||||
#define CH101_GPR_SR_NARROW_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_SR_NARROW_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_SR_NARROW_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_SR_NARROW_MAX_SAMPLES (225)
|
||||
|
||||
extern const char *ch101_gpr_sr_narrow_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_sr_narrow_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_sr_narrow_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_sr_narrow_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_sr_narrow_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_sr_narrow_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr,
|
||||
uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
72
CHIRP/drivers/inc/ch101_gpr_sr_narrow_wd.h
Normal file
72
CHIRP/drivers/inc/ch101_gpr_sr_narrow_wd.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*! \file ch101_gpr_sr_narrow_wd.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Short-range Narrow-FoV sensor firmware. (watchdog enabled)
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR Short-range
|
||||
* Narrow-FoV sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_SR_NARROW_WD_H_
|
||||
#define CH101_GPR_SR_NARROW_WD_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_OPMODE 0x01
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_PERIOD 0x05
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_CALC 0x08
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_READY 0x14
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_TOF 0x18
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_SR_NARROW_WD_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_SR_NARROW_WD_MAX_SAMPLES (225)
|
||||
|
||||
extern const char *ch101_gpr_sr_narrow_wd_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_sr_narrow_wd_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_sr_narrow_wd_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_sr_narrow_wd_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_sr_narrow_wd_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_sr_narrow_wd_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr,
|
||||
uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
74
CHIRP/drivers/inc/ch101_gpr_sr_open.h
Normal file
74
CHIRP/drivers/inc/ch101_gpr_sr_open.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*! \file ch101_gpr_sr_open.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Short-range Open sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR Short-rangeOpen
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2019, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_SR_OPEN_H_
|
||||
#define CH101_GPR_SR_OPEN_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_SR_OPEN_REG_OPMODE 0x01
|
||||
#define CH101_GPR_SR_OPEN_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_SR_OPEN_REG_PERIOD 0x05
|
||||
#define CH101_GPR_SR_OPEN_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_OPEN_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_OPEN_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_SR_OPEN_REG_CALC 0x08
|
||||
#define CH101_GPR_SR_OPEN_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_SR_OPEN_REG_READY 0x14
|
||||
#define CH101_GPR_SR_OPEN_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_SR_OPEN_REG_TOF 0x18
|
||||
#define CH101_GPR_SR_OPEN_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_SR_OPEN_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_SR_OPEN_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_SR_OPEN_CTR (0x2B368)
|
||||
#define CH101_GPR_SR_OPEN_MAX_SAMPLES (150)
|
||||
|
||||
extern const char *ch101_gpr_sr_open_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_sr_open_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_sr_open_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_sr_open_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_sr_open_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_sr_open_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr,
|
||||
uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
void ch101_gpr_sr_open_store_pt_result(ch_dev_t *dev_ptr);
|
||||
|
||||
|
||||
|
||||
#endif
|
72
CHIRP/drivers/inc/ch101_gpr_sr_wd.h
Normal file
72
CHIRP/drivers/inc/ch101_gpr_sr_wd.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*! \file ch101_gpr_sr_wd.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR Short-range sensor firmware. (watchdog enabled)
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR Short-range
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_SR_WD_H_
|
||||
#define CH101_GPR_SR_WD_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_SR_WD_REG_OPMODE 0x01
|
||||
#define CH101_GPR_SR_WD_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_SR_WD_REG_PERIOD 0x05
|
||||
#define CH101_GPR_SR_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_SR_WD_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_SR_WD_REG_CALC 0x08
|
||||
#define CH101_GPR_SR_WD_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_SR_WD_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_SR_WD_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_SR_WD_REG_READY 0x14
|
||||
#define CH101_GPR_SR_WD_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_SR_WD_REG_TOF 0x18
|
||||
#define CH101_GPR_SR_WD_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_SR_WD_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_SR_WD_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_SR_WD_MAX_SAMPLES (225)
|
||||
|
||||
extern const char *ch101_gpr_sr_wd_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_sr_wd_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_sr_wd_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_sr_wd_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_sr_wd_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_sr_wd_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr,
|
||||
uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
73
CHIRP/drivers/inc/ch101_gpr_wd.h
Normal file
73
CHIRP/drivers/inc/ch101_gpr_wd.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*! \file ch101_gpr_wd.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 GPR sensor firmware. (watchdog enabled)
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 GPR
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220A, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_GPR_WD_H_
|
||||
#define CH101_GPR_WD_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_GPR_WD_REG_OPMODE 0x01
|
||||
#define CH101_GPR_WD_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_GPR_WD_REG_PERIOD 0x05
|
||||
#define CH101_GPR_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_WD_REG_CAL_TRIG 0x06
|
||||
#define CH101_GPR_WD_REG_MAX_RANGE 0x07
|
||||
#define CH101_GPR_WD_REG_CALC 0x08
|
||||
#define CH101_GPR_WD_REG_REV_CYCLES 0x0C
|
||||
#define CH101_GPR_WD_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_GPR_WD_REG_ST_RANGE 0x12
|
||||
#define CH101_GPR_WD_REG_READY 0x14
|
||||
#define CH101_GPR_WD_REG_TOF_SF 0x16
|
||||
#define CH101_GPR_WD_REG_TOF 0x18
|
||||
#define CH101_GPR_WD_REG_AMPLITUDE 0x1A
|
||||
#define CH101_GPR_WD_REG_CAL_RESULT 0x0A
|
||||
#define CH101_GPR_WD_REG_DATA 0x1C
|
||||
|
||||
#define CH101_GPR_WD_MAX_SAMPLES (225)
|
||||
|
||||
|
||||
|
||||
extern const char *ch101_gpr_wd_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_gpr_wd_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_gpr_wd_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_gpr_wd_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_gpr_wd_init_ptr(void);
|
||||
|
||||
uint8_t ch101_gpr_wd_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
71
CHIRP/drivers/inc/ch101_liquid.h
Normal file
71
CHIRP/drivers/inc/ch101_liquid.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*! \file ch101_liquid.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 Liquid Level Sensing enabled firmware
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 Liquid
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2021, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_LIQUID_H_
|
||||
#define CH101_LIQUID_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR firmware registers */
|
||||
#define CH101_LIQUID_REG_OPMODE 0x01
|
||||
#define CH101_LIQUID_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_LIQUID_REG_RX_WIN_END 0x04
|
||||
#define CH101_LIQUID_REG_PERIOD 0x05
|
||||
#define CH101_LIQUID_REG_CAL_TRIG 0x06
|
||||
#define CH101_LIQUID_REG_MAX_RANGE 0x07
|
||||
#define CH101_LIQUID_REG_CALC 0x08
|
||||
#define CH101_LIQUID_REG_RX_GAIN_ATTEN_1 0x10
|
||||
#define CH101_LIQUID_REG_RX_HOLDOFF 0x11
|
||||
#define CH101_LIQUID_REG_RX_GAIN_ATTEN_2 0x12
|
||||
#define CH101_LIQUID_REG_READY 0x14
|
||||
#define CH101_LIQUID_REG_TOF_SF 0x16
|
||||
#define CH101_LIQUID_REG_AMPLITUDE_LOW 0x18
|
||||
#define CH101_LIQUID_REG_AMPLITUDE_HIGH 0x1A
|
||||
#define CH101_LIQUID_REG_CAL_RESULT 0x0A
|
||||
#define CH101_LIQUID_REG_DATA 0x1C
|
||||
|
||||
#define CH101_LIQUID_MAX_SAMPLES (225)
|
||||
|
||||
extern const char *ch101_liquid_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_liquid_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_liquid_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_liquid_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_liquid_init_ptr(void);
|
||||
|
||||
uint8_t ch101_liquid_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
78
CHIRP/drivers/inc/ch101_sonicsync.h
Normal file
78
CHIRP/drivers/inc/ch101_sonicsync.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*! \file ch101_sonicsync.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH101 SonicSync sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH101 SonicSync
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2019, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH101_SONICSYNC_H_
|
||||
#define CH101_SONICSYNC_H_
|
||||
|
||||
#include "ch101.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* SmartSonic SonicSync firmware registers */
|
||||
#define CH101_SONICSYNC_REG_OPMODE 0x01
|
||||
#define CH101_SONICSYNC_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_SONICSYNC_REG_PERIOD 0x05
|
||||
#define CH101_SONICSYNC_REG_MAX_RANGE 0x07
|
||||
#define CH101_SONICSYNC_REG_TIME_PLAN 0x09
|
||||
#define CH101_SONICSYNC_REG_STAT_RANGE 0x12
|
||||
#define CH101_SONICSYNC_REG_STAT_COEFF 0x13
|
||||
#define CH101_SONICSYNC_REG_READY 0x14
|
||||
#define CH101_SONICSYNC_REG_TOF_SF 0x16
|
||||
#define CH101_SONICSYNC_REG_TOF 0x18
|
||||
#define CH101_SONICSYNC_REG_AMPLITUDE 0x1A
|
||||
#define CH101_SONICSYNC_REG_CAL_TRIG 0x06
|
||||
#define CH101_SONICSYNC_REG_CAL_RESULT 0x0A
|
||||
#define CH101_SONICSYNC_REG_DATA 0x1C
|
||||
|
||||
#define CH101_SONICSYNC_MAX_SAMPLES (150)
|
||||
|
||||
#define CH101_SONICSYNC_READY_FREQ_LOCKED (0x02 | 0x04)
|
||||
|
||||
extern const char * ch101_sonicsync_master_version; // version string in fw .c file
|
||||
extern const char * ch101_sonicsync_slave_version; // version string in fw .c file
|
||||
extern const uint8_t ch101_sonicsync_master_fw[CH101_FW_SIZE];
|
||||
extern const uint8_t ch101_sonicsync_slave_fw[CH101_FW_SIZE];
|
||||
|
||||
uint16_t get_ch101_sonicsync_master_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_sonicsync_master_fw_ram_init_size(void);
|
||||
uint16_t get_ch101_sonicsync_slave_fw_ram_init_addr(void);
|
||||
uint16_t get_ch101_sonicsync_slave_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch101_sonicsync_master_init_ptr(void);
|
||||
const unsigned char * get_ram_ch101_sonicsync_slave_init_ptr(void);
|
||||
|
||||
uint8_t ch101_sonicsync_master_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
uint8_t ch101_sonicsync_slave_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
uint8_t ch_sonicsync_get_locked_state(ch_dev_t *dev_ptr);
|
||||
|
||||
#endif
|
48
CHIRP/drivers/inc/ch201.h
Normal file
48
CHIRP/drivers/inc/ch201.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*! \file ch201.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH201 ultrasonic sensor.
|
||||
*
|
||||
* This file contains various hardware-defined values for the CH201 sensor.
|
||||
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH201_H_
|
||||
#define CH201_H_
|
||||
|
||||
|
||||
#define CH201_DATA_MEM_SIZE 0x800
|
||||
#define CH201_DATA_MEM_ADDR 0x0200
|
||||
#define CH201_PROG_MEM_SIZE 0x800
|
||||
#define CH201_PROG_MEM_ADDR 0xF800
|
||||
#define CH201_FW_SIZE CH201_PROG_MEM_SIZE
|
||||
|
||||
#define CH201_BANDWIDTH_INDEX_1 6 /*!< Index of first sample to use for calculating bandwidth. */
|
||||
#define CH201_BANDWIDTH_INDEX_2 (CH201_BANDWIDTH_INDEX_1 + 1) /*!< Index of second sample to use for calculating bandwidth. */
|
||||
#define CH201_SCALEFACTOR_INDEX 4 /*!< Index for calculating scale factor. */
|
||||
|
||||
#define CH201_MAX_TICK_INTERVAL 256
|
||||
|
||||
#endif
|
229
CHIRP/drivers/inc/ch201_finaltest.h
Normal file
229
CHIRP/drivers/inc/ch201_finaltest.h
Normal file
@@ -0,0 +1,229 @@
|
||||
/*!
|
||||
* \file ch201_finaltest.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH201 Finaltest sensor firmware.
|
||||
*
|
||||
* This file contains function definitions, register offsets and other interfaces
|
||||
* for use with the CH201 Finaltest sensor firmware. Many of these are designed for
|
||||
* compatibility with the Chirp Finaltest production test system.
|
||||
* These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220A, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH201_FINALTEST_H_
|
||||
#define CH201_FINALTEST_H_
|
||||
|
||||
#include "ch201.h"
|
||||
#include "soniclib.h"
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#define CH201_FINALTEST_REG_REGMAPFMT 0x00
|
||||
#define CH201_FINALTEST_REG_OPMODE 0x01
|
||||
#define CH201_FINALTEST_REG_TICK_INTERVAL 0x02
|
||||
#define CH201_FINALTEST_REG_WBCFG 0x04
|
||||
#define CH201_FINALTEST_REG_PERIOD 0x05
|
||||
#define CH201_FINALTEST_REG_CAL_TRIG 0x06
|
||||
#define CH201_FINALTEST_REG_MAX_RANGE 0x07
|
||||
#define CH201_FINALTEST_REG_DCOSTART 0x08
|
||||
#define CH201_FINALTEST_REG_CAL_RESULT 0x0A
|
||||
#define CH201_FINALTEST_REG_DCOSTOP 0x0C
|
||||
#define CH201_FINALTEST_REG_TXLENGTH 0x0E
|
||||
#define CH201_FINALTEST_REG_READY 0x0F
|
||||
#define CH201_FINALTEST_REG_PULSE_WIDTH 0x10
|
||||
#define CH201_FINALTEST_REG_HOLDOFF 0x11
|
||||
#define CH201_FINALTEST_REG_THRESHOLD 0x12
|
||||
#define CH201_FINALTEST_REG_RXQUEUE 0x14
|
||||
#define CH201_FINALTEST_REG_TOF_SF 0x22
|
||||
#define CH201_FINALTEST_REG_TOF 0x24
|
||||
#define CH201_FINALTEST_REG_AMPLITUDE 0x26
|
||||
#define CH201_FINALTEST_REG_DCOCODE 0x28
|
||||
#define CH201_FINALTEST_REG_DATA 0x2A
|
||||
|
||||
// Maximum number of samples that can be stored; max value of MAX_RANGE
|
||||
#define CH201_FINALTEST_MAX_SAMPLES 450
|
||||
|
||||
// Number of RXQUEUE 16-bit entries
|
||||
#define CH201_FINALTEST_RXQUEUE_ITEMS 7
|
||||
|
||||
// Bit width of each field in RXQUEUE items
|
||||
#define CH201_FINALTEST_RXQUEUE_BITS_SAMPLES 7
|
||||
#define CH201_FINALTEST_RXQUEUE_BITS_ATTEN 2
|
||||
#define CH201_FINALTEST_RXQUEUE_BITS_GAIN 3
|
||||
|
||||
// Position of lowest bit in each field of RXQUEUE items
|
||||
#define CH201_FINALTEST_RXQUEUE_BITPOS_SAMPLES 3
|
||||
#define CH201_FINALTEST_RXQUEUE_BITPOS_ATTEN (CH201_FINALTEST_RXQUEUE_BITPOS_SAMPLES + CH201_FINALTEST_RXQUEUE_BITS_SAMPLES)
|
||||
#define CH201_FINALTEST_RXQUEUE_BITPOS_GAIN (CH201_FINALTEST_RXQUEUE_BITPOS_ATTEN + CH201_FINALTEST_RXQUEUE_BITS_ATTEN )
|
||||
|
||||
// Values for Rx attenuation IN RXQUEUE items
|
||||
#define CH201_FINALTEST_RXQUEUE_ATTEN120 0
|
||||
#define CH201_FINALTEST_RXQUEUE_ATTEN60 1
|
||||
#define CH201_FINALTEST_RXQUEUE_ATTEN30 2
|
||||
#define CH201_FINALTEST_RXQUEUE_ATTEN1 3
|
||||
|
||||
// Values for Rx gain IN RXQUEUE items
|
||||
#define CH201_FINALTEST_RXQUEUE_GAIN1P6 0
|
||||
#define CH201_FINALTEST_RXQUEUE_GAIN3P8 1
|
||||
#define CH201_FINALTEST_RXQUEUE_GAIN5P7 2
|
||||
#define CH201_FINALTEST_RXQUEUE_GAIN12P3 3
|
||||
#define CH201_FINALTEST_RXQUEUE_GAIN25P6 4
|
||||
|
||||
// Enumerated values for various registers
|
||||
#define CH201_FINALTEST_OPMODE_IDLE 0x00
|
||||
#define CH201_FINALTEST_OPMODE_FREERUN 0x02
|
||||
#define CH201_FINALTEST_OPMODE_TRIGGERED 0x10
|
||||
#define CH201_FINALTEST_OPMODE_RX_ONLY 0x20
|
||||
|
||||
#define CH201_FINALTEST_PERIOD_IDLE 0
|
||||
#define CH201_FINALTEST_TICK_INTERVAL_IDLE 2048
|
||||
|
||||
#define CH201_FINALTEST_READY_NOTLOCKED 0x00
|
||||
#define CH201_FINALTEST_READY_NOTREADY 0x01
|
||||
#define CH201_FINALTEST_READY_FREQ_LOCKED_BM 0x04
|
||||
|
||||
|
||||
// ASIC firmware linkage
|
||||
extern const char *ch201_finaltest_version; // version string in fw .c file
|
||||
|
||||
extern const uint8_t ch201_finaltest_fw[CH201_FW_SIZE];
|
||||
|
||||
|
||||
const unsigned char * get_ram_ch201_finaltest_init_ptr(void);
|
||||
uint16_t get_ch201_finaltest_fw_ram_init_addr(void);
|
||||
uint16_t get_ch201_finaltest_fw_ram_init_size(void);
|
||||
|
||||
|
||||
|
||||
uint8_t ch201_finaltest_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t io_index, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
typedef enum { // XXX redundant definition from soniclib.h to resolve circular #include's
|
||||
CH201_FINALTEST_RANGE_ECHO_ONE_WAY = 0, /*!< One way - gets full pulse/echo distance & divides by 2. */
|
||||
CH201_FINALTEST_RANGE_ECHO_ROUND_TRIP = 1, /*!< Round trip - full pulse/echo distance. */
|
||||
CH201_FINALTEST_RANGE_DIRECT = 2, /*!< Direct - for receiving node in pitch-catch mode. */
|
||||
} ch201_finaltest_range_t;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Write an entry into the receive settings queue
|
||||
*
|
||||
* \param dev_ptr a pointer to the ch_dev_t device descriptor
|
||||
* \param queue_index which position in the queue to write this item
|
||||
* \param samples sample count for which these settings will be in effect, Range of values 1-127
|
||||
* \param attenuation Range of values 0-3, see Final Test interface description
|
||||
* \param gain Range of values 0-4, see Final Test interface description
|
||||
*/
|
||||
uint8_t ch201_finaltest_set_rxqueue_item( ch_dev_t* dev_ptr, uint8_t queue_index,
|
||||
uint8_t samples, uint8_t attenuation, uint8_t gain );
|
||||
|
||||
/*!
|
||||
* \brief Set the MAX_RANGE register directly.
|
||||
*
|
||||
* \param dev_ptr a pointer to the ch_dev_t device descriptor
|
||||
* \param samples Value to write to MAX_RANGE register, determining length of data used in target detection
|
||||
*
|
||||
* \return 0 if successful
|
||||
*/
|
||||
uint8_t ch201_finaltest_set_samples( ch_dev_t* dev_ptr, uint8_t samples );
|
||||
|
||||
uint8_t ch201_finaltest_set_max_range(ch_dev_t *dev_ptr, uint16_t max_range_mm);
|
||||
|
||||
/*!
|
||||
* \brief Configure threshold of detection.
|
||||
*
|
||||
* \param dev_ptr a pointer to the ch_dev_t device descriptor
|
||||
* \param threshold minimum received echo intensity for detecting a target
|
||||
*
|
||||
* \return 0 if successful.
|
||||
*/
|
||||
uint8_t ch201_finaltest_set_threshold(ch_dev_t *dev_ptr, uint16_t threshold);
|
||||
|
||||
/*!
|
||||
* \brief Configure target detection holdoff.
|
||||
*
|
||||
* \param dev_ptr a pointer to the ch_dev_t device descriptor
|
||||
* \param holdoff number of samples to discard before starting target detection
|
||||
*
|
||||
* \return 0 if successful.
|
||||
*/
|
||||
uint8_t ch201_finaltest_set_holdoff(ch_dev_t *dev_ptr, uint8_t holdoff);
|
||||
|
||||
uint32_t ch201_finaltest_get_range(ch_dev_t *dev_ptr, ch201_finaltest_range_t range_type);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Gets measured intensity from the sensor.
|
||||
*
|
||||
* \param dev_ptr a 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.
|
||||
*
|
||||
* \return Amplitude (arbitrary units).
|
||||
*/
|
||||
uint16_t ch201_finaltest_get_amplitude(ch_dev_t *dev_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Reads IQ data from sensor and places it into specified buffer.
|
||||
* \param dev_ptr Pointer to the ch_dev_t device descriptor
|
||||
* \param buf_ptr Buffer to which to store IQ data
|
||||
* \param start_sample starting sample of requested I/Q data
|
||||
* \param num_samples number of samples to return I/Q for
|
||||
* \param mode I/O mode - must be CH_IO_MODE_BLOCK
|
||||
* \return 0 on success, nonzero on failure
|
||||
*/
|
||||
uint8_t ch201_finaltest_get_iq_data(ch_dev_t *dev_ptr, uint8_t /*ch_iq_sample_t*/ *buf_ptr, uint16_t start_sample, uint16_t num_samples,
|
||||
uint8_t /*ch_io_mode_t*/ mode);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Check if the sensor has completed its start-up calibration (locking) procedure.
|
||||
*
|
||||
* \param dev_ptr a pointer to the ch_dev_t device descriptor
|
||||
*
|
||||
* \return 1 if the sensor is locked, 0 otherwise.
|
||||
*/
|
||||
uint8_t ch201_finaltest_get_locked_state(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch201_finaltest_prepare_pulse_timer(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch201_finaltest_store_pt_result(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch201_finaltest_store_op_freq(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch201_finaltest_store_bandwidth(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch201_finaltest_store_scale_factor(ch_dev_t *dev_ptr);
|
||||
|
||||
int ch201_finaltest_set_pulse_width(ch_dev_t *dev_ptr,uint8_t pulse_width);
|
||||
|
||||
int ch201_finaltest_set_tx_length(ch_dev_t *dev_ptr, uint8_t tx_length);
|
||||
|
||||
uint32_t ch201_finaltest_get_op_freq(ch_dev_t *dev_ptr);
|
||||
|
||||
|
||||
#endif /* CH201_FINALTEST_H_ */
|
76
CHIRP/drivers/inc/ch201_gprmt.h
Normal file
76
CHIRP/drivers/inc/ch201_gprmt.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*! \file ch201_gprmt.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH201 GPR Multi-threshold sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH201 GPR
|
||||
* Multi-threshold sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH201_GPRMT_H_
|
||||
#define CH201_GPRMT_H_
|
||||
|
||||
#include "ch201.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR with multi thresholds firmware registers */
|
||||
#define CH201_GPRMT_REG_OPMODE 0x01
|
||||
#define CH201_GPRMT_REG_TICK_INTERVAL 0x02
|
||||
#define CH201_GPRMT_REG_LOW_GAIN_RXLEN 0x04
|
||||
#define CH201_GPRMT_REG_PERIOD 0x05
|
||||
#define CH201_GPRMT_REG_CAL_TRIG 0x06
|
||||
#define CH201_GPRMT_REG_MAX_RANGE 0x07
|
||||
#define CH201_GPRMT_REG_THRESH_LEN_0 0x08
|
||||
#define CH201_GPRMT_REG_THRESH_LEN_1 0x09
|
||||
#define CH201_GPRMT_REG_CAL_RESULT 0x0A
|
||||
#define CH201_GPRMT_REG_THRESH_LEN_2 0x0C
|
||||
#define CH201_GPRMT_REG_THRESH_LEN_3 0x0D
|
||||
#define CH201_GPRMT_REG_TX_LENGTH 0x10
|
||||
#define CH201_GPRMT_REG_ST_RANGE 0x12
|
||||
#define CH201_GPRMT_REG_READY 0x14
|
||||
#define CH201_GPRMT_REG_THRESH_LEN_4 0x15
|
||||
#define CH201_GPRMT_REG_THRESHOLDS 0x16 // start of array of six 2-byte threshold levels
|
||||
#define CH201_GPRMT_REG_TOF_SF 0x22
|
||||
#define CH201_GPRMT_REG_TOF 0x24
|
||||
#define CH201_GPRMT_REG_AMPLITUDE 0x26
|
||||
#define CH201_GPRMT_REG_DATA 0x28
|
||||
|
||||
#define CH201_GPRMT_MAX_SAMPLES (450) // max number of samples
|
||||
#define CH201_GPRMT_NUM_THRESHOLDS (6) // total number of thresholds
|
||||
|
||||
extern const char *ch201_gprmt_version; // version string in fw .c file
|
||||
extern const uint8_t ch201_gprmt_fw[CH201_FW_SIZE];
|
||||
|
||||
uint16_t get_ch201_gprmt_fw_ram_init_addr(void);
|
||||
uint16_t get_ch201_gprmt_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch201_gprmt_init_ptr(void);
|
||||
|
||||
uint8_t ch201_gprmt_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
74
CHIRP/drivers/inc/ch201_gprmt_wd.h
Normal file
74
CHIRP/drivers/inc/ch201_gprmt_wd.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*! \file ch201_gprmt_wd.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH201 GPR Multi-threshold sensor firmware. (watchdog enabled)
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH201 GPR
|
||||
* Multi-threshold sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH201_GPRMT_WD_H_
|
||||
#define CH201_GPRMT_WD_H_
|
||||
|
||||
#include "ch201.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR with multi thresholds firmware registers */
|
||||
#define CH201_GPRMT_WD_REG_OPMODE 0x01
|
||||
#define CH201_GPRMT_WD_REG_TICK_INTERVAL 0x02
|
||||
#define CH201_GPRMT_WD_REG_PERIOD 0x05
|
||||
#define CH201_GPRMT_WD_REG_CAL_TRIG 0x06
|
||||
#define CH201_GPRMT_WD_REG_MAX_RANGE 0x07
|
||||
#define CH201_GPRMT_WD_REG_THRESH_LEN_0 0x08
|
||||
#define CH201_GPRMT_WD_REG_THRESH_LEN_1 0x09
|
||||
#define CH201_GPRMT_WD_REG_CAL_RESULT 0x0A
|
||||
#define CH201_GPRMT_WD_REG_THRESH_LEN_2 0x0C
|
||||
#define CH201_GPRMT_WD_REG_THRESH_LEN_3 0x0D
|
||||
#define CH201_GPRMT_WD_REG_ST_RANGE 0x12
|
||||
#define CH201_GPRMT_WD_REG_READY 0x14
|
||||
#define CH201_GPRMT_WD_REG_THRESH_LEN_4 0x15
|
||||
#define CH201_GPRMT_WD_REG_THRESHOLDS 0x16 // start of array of six 2-byte threshold levels
|
||||
#define CH201_GPRMT_WD_REG_TOF_SF 0x22
|
||||
#define CH201_GPRMT_WD_REG_TOF 0x24
|
||||
#define CH201_GPRMT_WD_REG_AMPLITUDE 0x26
|
||||
#define CH201_GPRMT_WD_REG_DATA 0x28
|
||||
|
||||
#define CH201_GPRMT_WD_MAX_SAMPLES (450) // max number of samples
|
||||
#define CH201_GPRMT_WD_NUM_THRESHOLDS (6) // total number of thresholds
|
||||
|
||||
extern const char *ch201_gprmt_wd_version; // version string in fw .c file
|
||||
extern const uint8_t ch201_gprmt_wd_fw[CH201_FW_SIZE];
|
||||
|
||||
uint16_t get_ch201_gprmt_wd_fw_ram_init_addr(void);
|
||||
uint16_t get_ch201_gprmt_wd_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch201_gprmt_wd_init_ptr(void);
|
||||
|
||||
uint8_t ch201_gprmt_wd_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
|
||||
#endif
|
77
CHIRP/drivers/inc/ch201_gprstr.h
Normal file
77
CHIRP/drivers/inc/ch201_gprstr.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*! \file ch201_gprstr.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH201 GPR Static Target Rejection sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH201 GPR
|
||||
* Static Target Rejection sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH201_GPRSTR_H_
|
||||
#define CH201_GPRSTR_H_
|
||||
|
||||
#include "ch201.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR with STR firmware registers */
|
||||
#define CH201_GPRSTR_REG_OPMODE 0x01
|
||||
#define CH201_GPRSTR_REG_TICK_INTERVAL 0x02
|
||||
#define CH201_GPRSTR_REG_LOW_GAIN_RXLEN 0x04
|
||||
#define CH201_GPRSTR_REG_PERIOD 0x05
|
||||
#define CH201_GPRSTR_REG_CAL_TRIG 0x06
|
||||
#define CH201_GPRSTR_REG_MAX_RANGE 0x07
|
||||
#define CH201_GPRSTR_REG_INTCFG 0x08
|
||||
#define CH201_GPRSTR_REG_CAL_RESULT 0x0A
|
||||
#define CH201_GPRSTR_REG_THRESH_1 0x0C
|
||||
#define CH201_GPRSTR_REG_THRESH_0 0x0E
|
||||
#define CH201_GPRSTR_REG_TX_LENGTH 0x10
|
||||
#define CH201_GPRSTR_REG_RX_HOLDOFF 0x11
|
||||
#define CH201_GPRSTR_REG_STAT_RANGE 0x12
|
||||
#define CH201_GPRSTR_REG_STAT_COEFF 0x13
|
||||
#define CH201_GPRSTR_REG_READY 0x14
|
||||
#define CH201_GPRSTR_REG_TOF_SF 0x16
|
||||
#define CH201_GPRSTR_REG_TOF 0x18
|
||||
#define CH201_GPRSTR_REG_AMPLITUDE 0x1A
|
||||
#define CH201_GPRSTR_REG_DATA 0x1C
|
||||
|
||||
#define CH201_GPRSTR_MAX_SAMPLES (290)
|
||||
|
||||
#define CH201_GPRSTR_NUM_THRESHOLDS (2)
|
||||
#define CH201_GPRSTR_STAT_COEFF_DEFAULT (6) // default value for stationary target coefficient
|
||||
#define CH201_GPRSTR_MIN_STR_SAMPLES (14) // min number of STR samples, to provide ringdown filter
|
||||
|
||||
extern const char *ch201_gprstr_version; // version string in fw .c file
|
||||
extern const uint8_t ch201_gprstr_fw[CH201_FW_SIZE];
|
||||
|
||||
uint16_t get_ch201_gprstr_fw_ram_init_addr(void);
|
||||
uint16_t get_ch201_gprstr_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch201_gprstr_init_ptr(void);
|
||||
|
||||
uint8_t ch201_gprstr_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
#endif
|
77
CHIRP/drivers/inc/ch201_gprstr_wd.h
Normal file
77
CHIRP/drivers/inc/ch201_gprstr_wd.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*! \file ch201_gprstr_wd.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH201 GPR Static Target Rejection sensor firmware. (watchdog enabled)
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH201 GPR
|
||||
* Static Target Rejection sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH201_GPRSTR_WD_H_
|
||||
#define CH201_GPRSTR_WD_H_
|
||||
|
||||
#include "ch201.h"
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* GPR with STR firmware registers (watchdog enabled) */
|
||||
#define CH201_GPRSTR_WD_REG_OPMODE 0x01
|
||||
#define CH201_GPRSTR_WD_REG_TICK_INTERVAL 0x02
|
||||
#define CH201_GPRSTR_WD_REG_LOW_GAIN_RXLEN 0x04
|
||||
#define CH201_GPRSTR_WD_REG_PERIOD 0x05
|
||||
#define CH201_GPRSTR_WD_REG_CAL_TRIG 0x06
|
||||
#define CH201_GPRSTR_WD_REG_MAX_RANGE 0x07
|
||||
#define CH201_GPRSTR_WD_REG_INTCFG 0x08
|
||||
#define CH201_GPRSTR_WD_REG_CAL_RESULT 0x0A
|
||||
#define CH201_GPRSTR_WD_REG_THRESH_1 0x0C
|
||||
#define CH201_GPRSTR_WD_REG_THRESH_0 0x0E
|
||||
#define CH201_GPRSTR_WD_REG_TX_LENGTH 0x10
|
||||
#define CH201_GPRSTR_WD_REG_RX_HOLDOFF 0x11
|
||||
#define CH201_GPRSTR_WD_REG_STAT_RANGE 0x12
|
||||
#define CH201_GPRSTR_WD_REG_STAT_COEFF 0x13
|
||||
#define CH201_GPRSTR_WD_REG_READY 0x14
|
||||
#define CH201_GPRSTR_WD_REG_TOF_SF 0x16
|
||||
#define CH201_GPRSTR_WD_REG_TOF 0x18
|
||||
#define CH201_GPRSTR_WD_REG_AMPLITUDE 0x1A
|
||||
#define CH201_GPRSTR_WD_REG_DATA 0x1C
|
||||
|
||||
#define CH201_GPRSTR_WD_MAX_SAMPLES (290)
|
||||
|
||||
#define CH201_GPRSTR_WD_NUM_THRESHOLDS (2)
|
||||
#define CH201_GPRSTR_WD_STAT_COEFF_DEFAULT (6) // default value for stationary target coefficient
|
||||
#define CH201_GPRSTR_WD_MIN_STR_SAMPLES (14) // min number of STR samples, to provide ringdown filter
|
||||
|
||||
extern const char *ch201_gprstr_wd_version; // version string in fw .c file
|
||||
extern const uint8_t ch201_gprstr_wd_fw[CH201_FW_SIZE];
|
||||
|
||||
uint16_t get_ch201_gprstr_wd_fw_ram_init_addr(void);
|
||||
uint16_t get_ch201_gprstr_wd_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch201_gprstr_wd_init_ptr(void);
|
||||
|
||||
uint8_t ch201_gprstr_wd_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
|
||||
#endif
|
92
CHIRP/drivers/inc/ch201_presence.h
Normal file
92
CHIRP/drivers/inc/ch201_presence.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*! \file ch201_presence.h
|
||||
*
|
||||
* \brief Internal definitions for the Chirp CH201 presence detection sensor firmware.
|
||||
*
|
||||
* This file contains register offsets and other values for use with the CH201 presence
|
||||
* sensor firmware. These values are subject to change without notice.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH201_PRESENCE_H_
|
||||
#define CH201_PRESENCE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "ch201.h"
|
||||
#include "soniclib.h"
|
||||
|
||||
/* Presence detection firmware registers */
|
||||
#define CH201_PRESENCE_REG_OPMODE (0x01)
|
||||
#define CH201_PRESENCE_REG_TICK_INTERVAL (0x02)
|
||||
#define CH201_PRESENCE_REG_LOW_GAIN_RXLEN (0x04)
|
||||
#define CH201_PRESENCE_REG_PERIOD (0x05)
|
||||
#define CH201_PRESENCE_REG_CAL_TRIG (0x06)
|
||||
#define CH201_PRESENCE_REG_MAX_RANGE (0x07)
|
||||
#define CH201_PRESENCE_REG_THRESH_LEN_0 (0x08)
|
||||
#define CH201_PRESENCE_REG_THRESH_LEN_1 (0x09)
|
||||
#define CH201_PRESENCE_REG_CAL_RESULT (0x0A)
|
||||
#define CH201_PRESENCE_REG_THRESH_LEN_2 (0x0C)
|
||||
#define CH201_PRESENCE_REG_THRESH_LEN_3 (0x0D)
|
||||
#define CH201_PRESENCE_REG_TX_LENGTH (0x10)
|
||||
#define CH201_PRESENCE_PMUTRINGLENGTH (0x12)
|
||||
#define CH201_PRESENCE_DECIMATION (0x13)
|
||||
#define CH201_PRESENCE_REG_READY (0x14)
|
||||
#define CH201_PRESENCE_REG_THRESH_LEN_4 (0x15)
|
||||
#define CH201_PRESENCE_REG_THRESHOLDS (0x16) // start of array of six 2-byte threshold levels
|
||||
#define CH201_PRESENCE_REG_TOF_SF (0x22)
|
||||
#define CH201_PRESENCE_REG_TOF (0x24)
|
||||
#define CH201_PRESENCE_REG_AMPLITUDE (0x26)
|
||||
#define CH201_PRESENCE_REG_DATA (0x28)
|
||||
|
||||
#define CH201_PRESENCE_MAX_SAMPLES (300) // max number of samples
|
||||
#define CH201_PRESENCE_NUM_THRESHOLDS (6) // total number of thresholds
|
||||
|
||||
// Enumerated values for various registers
|
||||
#define CH201_PRESENCE_DECIMATION_MASK (0x03)
|
||||
#define CH201_PRESENCE_DECIMATION_NO (0x00)
|
||||
#define CH201_PRESENCE_DECIMATION_2 (0x01)
|
||||
#define CH201_PRESENCE_DECIMATION_3 (0x02)
|
||||
#define CH201_PRESENCE_DECIMATION_4 (0x03)
|
||||
|
||||
#define CH201_PRESENCE_CORDIC_MASK (0x80)
|
||||
#define CH201_PRESENCE_CORDIC_EN (0x80)
|
||||
#define CH201_PRESENCE_CORDIC_DIS (0x00)
|
||||
|
||||
#define CH201_PRESENCE_READY_FREQ_LOCKED (0x04)
|
||||
#define CH201_PRESENCE_FREQCOUNTERCYCLES (1150)
|
||||
|
||||
extern const char *ch201_presence_version; // version string in fw .c file
|
||||
extern const uint8_t ch201_presence_fw[CH201_FW_SIZE];
|
||||
|
||||
uint16_t get_ch201_presence_fw_ram_init_addr(void);
|
||||
uint16_t get_ch201_presence_fw_ram_init_size(void);
|
||||
|
||||
const unsigned char * get_ram_ch201_presence_init_ptr(void);
|
||||
|
||||
uint8_t ch201_presence_init(ch_dev_t *dev_ptr, ch_group_t *grp_ptr, uint8_t i2c_addr, uint8_t dev_num, uint8_t i2c_bus_index);
|
||||
uint8_t ch201_presence_set_decimation(ch_dev_t *dev_ptr, uint8_t decimation);
|
||||
uint8_t ch201_presence_enable_cordic(ch_dev_t *dev_ptr, uint8_t enable);
|
||||
|
||||
#endif
|
173
CHIRP/drivers/inc/ch_common.h
Normal file
173
CHIRP/drivers/inc/ch_common.h
Normal file
@@ -0,0 +1,173 @@
|
||||
/*! \file ch_common.h
|
||||
*
|
||||
* \brief Internal driver functions for operation with the Chirp ultrasonic sensor.
|
||||
*
|
||||
* This file contains common implementations of sensor support routines. These are
|
||||
* suitable for use with most standard sensor firmware images. The firmware-specific
|
||||
* init function will set up various function pointers to either the common implementations
|
||||
* in this file, or corresponding firmware-specific implementations.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH_COMMON_H_
|
||||
#define CH_COMMON_H_
|
||||
|
||||
#include "soniclib.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* CH-x01 common definitions */
|
||||
|
||||
#define CH_COMMON_BANDWIDTH_INDEX_1 6 // first sample of BIST data for b/w calc
|
||||
#define CH_COMMON_BANDWIDTH_INDEX_2 7 // second sample of BIST data for b/w calc
|
||||
|
||||
/* CH-101 common definitions */
|
||||
|
||||
#define CH101_COMMON_REG_OPMODE 0x01
|
||||
#define CH101_COMMON_REG_TICK_INTERVAL 0x02
|
||||
#define CH101_COMMON_REG_PERIOD 0x05
|
||||
#define CH101_COMMON_REG_CAL_TRIG 0x06
|
||||
#define CH101_COMMON_REG_MAX_RANGE 0x07
|
||||
#define CH101_COMMON_REG_TIME_PLAN 0x09
|
||||
#define CH101_COMMON_REG_CAL_RESULT 0x0A
|
||||
#define CH101_COMMON_REG_REV_CYCLES 0x0C
|
||||
#define CH101_COMMON_REG_DCO_PERIOD 0x0E
|
||||
#define CH101_COMMON_REG_RX_HOLDOFF 0x11
|
||||
#define CH101_COMMON_REG_STAT_RANGE 0x12
|
||||
#define CH101_COMMON_REG_STAT_COEFF 0x13
|
||||
#define CH101_COMMON_REG_READY 0x14
|
||||
#define CH101_COMMON_REG_TOF_SF 0x16
|
||||
#define CH101_COMMON_REG_TOF 0x18
|
||||
#define CH101_COMMON_REG_AMPLITUDE 0x1A
|
||||
#define CH101_COMMON_REG_DATA 0x1C
|
||||
|
||||
#define CH101_COMMON_I2CREGS_OFFSET 0
|
||||
|
||||
#define CH101_COMMON_READY_FREQ_LOCKED (0x02) // XXX need more values (?)
|
||||
|
||||
#define CH101_COMMON_FREQCOUNTERCYCLES (128)
|
||||
|
||||
#define CH101_COMMON_STAT_COEFF_DEFAULT (6) // default value for stationary target coefficient
|
||||
#define CH101_COMMON_NUM_THRESHOLDS (6) // total number of thresholds
|
||||
|
||||
/* CH-201 common definitions */
|
||||
|
||||
#define CH201_COMMON_REG_OPMODE 0x01
|
||||
#define CH201_COMMON_REG_TICK_INTERVAL 0x02
|
||||
#define CH201_COMMON_REG_LOW_GAIN_RXLEN 0x04
|
||||
#define CH201_COMMON_REG_PERIOD 0x05
|
||||
#define CH201_COMMON_REG_CAL_TRIG 0x06
|
||||
#define CH201_COMMON_REG_MAX_RANGE 0x07
|
||||
#define CH201_COMMON_REG_THRESH_LEN_0 0x08
|
||||
#define CH201_COMMON_REG_THRESH_LEN_1 0x09
|
||||
#define CH201_COMMON_REG_CAL_RESULT 0x0A
|
||||
#define CH201_COMMON_REG_THRESH_LEN_2 0x0C
|
||||
#define CH201_COMMON_REG_THRESH_LEN_3 0x0D
|
||||
#define CH201_COMMON_REG_TX_LENGTH 0x10
|
||||
#define CH201_COMMON_REG_RX_HOLDOFF 0x11
|
||||
#define CH201_COMMON_REG_ST_RANGE 0x12
|
||||
#define CH201_COMMON_REG_READY 0x14
|
||||
#define CH201_COMMON_REG_THRESH_LEN_4 0x15
|
||||
#define CH201_COMMON_REG_THRESHOLDS 0x16 // start of array of six 2-byte threshold levels
|
||||
#define CH201_COMMON_REG_TOF_SF 0x22
|
||||
#define CH201_COMMON_REG_TOF 0x24
|
||||
#define CH201_COMMON_REG_AMPLITUDE 0x26
|
||||
#define CH201_COMMON_REG_DATA 0x28
|
||||
|
||||
#define CH201_COMMON_I2CREGS_OFFSET 0
|
||||
|
||||
#define CH201_COMMON_READY_FREQ_LOCKED (0x02) // XXX need more values (?)
|
||||
|
||||
#define CH201_COMMON_FREQCOUNTERCYCLES (128)
|
||||
|
||||
#define CH201_COMMON_NUM_THRESHOLDS (6) // total number of thresholds
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
uint8_t ch_common_set_mode(ch_dev_t *dev_ptr, ch_mode_t mode);
|
||||
|
||||
uint8_t ch_common_fw_load(ch_dev_t *dev_ptr);
|
||||
|
||||
uint8_t ch_common_set_sample_interval(ch_dev_t *dev_ptr, uint16_t interval_ms);
|
||||
|
||||
uint8_t ch_common_set_num_samples( ch_dev_t* dev_ptr, uint16_t num_samples );
|
||||
|
||||
uint8_t ch_common_set_max_range(ch_dev_t *dev_ptr, uint16_t max_range_mm);
|
||||
|
||||
uint8_t ch_common_set_static_range(ch_dev_t *dev_ptr, uint16_t samples);
|
||||
|
||||
uint32_t ch_common_get_range(ch_dev_t *dev_ptr, ch_range_t range_type);
|
||||
|
||||
uint16_t ch_common_get_amplitude(ch_dev_t *dev_ptr);
|
||||
|
||||
uint8_t ch_common_get_locked_state(ch_dev_t *dev_ptr);
|
||||
|
||||
uint32_t ch_common_get_op_freq(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch_common_prepare_pulse_timer(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch_common_store_pt_result(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch_common_store_op_freq(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch_common_store_bandwidth(ch_dev_t *dev_ptr);
|
||||
|
||||
void ch_common_store_scale_factor(ch_dev_t *dev_ptr);
|
||||
|
||||
uint8_t ch_common_set_thresholds(ch_dev_t *dev_ptr, ch_thresholds_t *thresholds_ptr);
|
||||
|
||||
uint8_t ch_common_get_thresholds(ch_dev_t *dev_ptr, ch_thresholds_t *thresholds_ptr);
|
||||
|
||||
uint16_t ch_common_mm_to_samples(ch_dev_t *dev_ptr, uint16_t num_mm);
|
||||
|
||||
uint16_t ch_common_samples_to_mm(ch_dev_t *dev_ptr, uint16_t num_samples);
|
||||
|
||||
uint8_t ch_common_get_iq_data(ch_dev_t *dev_ptr, ch_iq_sample_t *buf_ptr, uint16_t start_sample, uint16_t num_samples, ch_io_mode_t nonblock);
|
||||
|
||||
uint8_t ch_common_set_sample_window(ch_dev_t *dev_ptr, uint16_t start_sample, uint16_t end_sample);
|
||||
|
||||
uint8_t ch_common_set_time_plan(ch_dev_t *dev_ptr, ch_time_plan_t time_plan);
|
||||
|
||||
ch_time_plan_t ch_common_get_time_plan(ch_dev_t *dev_ptr);
|
||||
uint16_t ch_common_get_amplitude_avg(ch_dev_t *dev_ptr);
|
||||
|
||||
uint8_t ch_common_get_amplitude_data(ch_dev_t *dev_ptr, uint16_t *buf_ptr, uint16_t start_sample, uint16_t num_samples,
|
||||
ch_io_mode_t mode);
|
||||
|
||||
uint8_t ch_common_set_rx_holdoff(ch_dev_t *dev_ptr, uint16_t rx_holdoff);
|
||||
uint16_t ch_common_get_rx_holdoff(ch_dev_t *dev_ptr);
|
||||
|
||||
uint8_t ch_common_set_rx_low_gain(ch_dev_t *dev_ptr, uint16_t num_samples);
|
||||
uint16_t ch_common_get_rx_low_gain(ch_dev_t *dev_ptr);
|
||||
|
||||
uint8_t ch_common_set_tx_length(ch_dev_t *dev_ptr, uint8_t num_cycles);
|
||||
uint8_t ch_common_get_tx_length(ch_dev_t *dev_ptr);
|
||||
|
||||
uint8_t ch_common_set_cal_result(ch_dev_t *dev_ptr, ch_cal_result_t *cal_ptr);
|
||||
uint8_t ch_common_get_cal_result(ch_dev_t *dev_ptr, ch_cal_result_t *cal_ptr);
|
||||
|
||||
#endif /* CH_COMMON_H_ */
|
||||
|
597
CHIRP/drivers/inc/ch_driver.h
Normal file
597
CHIRP/drivers/inc/ch_driver.h
Normal file
@@ -0,0 +1,597 @@
|
||||
/*! \file ch_driver.h
|
||||
*
|
||||
* \brief Internal driver functions for operation with the Chirp ultrasonic sensor.
|
||||
*
|
||||
* This file contains definitions for the internal Chirp sensor driver functions
|
||||
* and structures within SonicLib. These functions are provided in source code form
|
||||
* to simplify integration with an embedded application and for reference only.
|
||||
*
|
||||
* The Chirp driver functions provide an interface between the SonicLib public API
|
||||
* layer and the actual sensor devices. The driver manages all software-defined
|
||||
* aspects of the Chirp sensor, including the register set.
|
||||
*
|
||||
* You should not need to edit this file or call the driver functions directly. Doing so
|
||||
* will reduce your ability to benefit from future enhancements and releases from Chirp.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright <20> 2016-2020, Chirp Microsystems. All rights reserved.
|
||||
*
|
||||
* Chirp Microsystems CONFIDENTIAL
|
||||
*
|
||||
* 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 CHIRP MICROSYSTEMS 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.
|
||||
*
|
||||
* You can contact the authors of this program by email at support@chirpmicro.com
|
||||
* or by mail at 2560 Ninth Street, Suite 220, Berkeley, CA 94710.
|
||||
*/
|
||||
|
||||
#ifndef CH_DRIVER_H_
|
||||
#define CH_DRIVER_H_
|
||||
|
||||
//#define CHDRV_DEBUG
|
||||
|
||||
#include "chirp_board_config.h"
|
||||
#include "soniclib.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#ifdef CHDRV_DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define CHDRV_I2C_MAX_WRITE_BYTES 256 /*!< maximum number of bytes in a single I2C write */
|
||||
|
||||
#define CHDRV_NB_TRANS_TYPE_STD (0) /*!< standard non-blocking I/O transaction */
|
||||
#define CHDRV_NB_TRANS_TYPE_PROG (1) /*!< non-blocking I/O via low-level programming interface */
|
||||
#define CHDRV_NB_TRANS_TYPE_EXTERNAL (2) /*!< externally requested non-blocking I/O transaction */
|
||||
|
||||
/* Programming interface register addresses */
|
||||
#define CH_PROG_REG_PING 0x00 /*!< Read-only register used during device discovery. */
|
||||
#define CH_PROG_REG_CPU 0x42 /*!< Processor control register address. */
|
||||
#define CH_PROG_REG_STAT 0x43 /*!< Processor status register address. */
|
||||
#define CH_PROG_REG_CTL 0x44 /*!< Data transfer control register address. */
|
||||
#define CH_PROG_REG_ADDR 0x05 /*!< Data transfer starting address register address. */
|
||||
#define CH_PROG_REG_CNT 0x07 /*!< Data transfer size register address. */
|
||||
#define CH_PROG_REG_DATA 0x06 /*!< Data transfer value register address. */
|
||||
|
||||
#define CH_PROG_SIZEOF(R) ( (R) & 0x40 ? 1 : 2 )
|
||||
/*!< Macro to determine programming register size. */
|
||||
|
||||
#define CH_PROG_XFER_SIZE (256) /*!< max size of a read operation via programming interface */
|
||||
|
||||
#define CHDRV_DEBUG_PIN_NUM (0) /*!< debug pin number (index) to use for debug indication */
|
||||
|
||||
|
||||
#define CHDRV_MAX_I2C_QUEUE_LENGTH CHIRP_MAX_NUM_SENSORS /*!< Max queued non-blocking I2C transactions - value from chirp_board_config.h */
|
||||
|
||||
#define CHDRV_FREQLOCK_TIMEOUT_MS 100 /*!< Time to wait in chdrv_group_start() for sensor
|
||||
initialization, in milliseconds. */
|
||||
#define CHDRV_BANDWIDTH_INDEX_1 6 /*!< Index of first sample to use for calculating bandwidth. */
|
||||
#define CHDRV_BANDWIDTH_INDEX_2 (CHDRV_BANDWIDTH_INDEX_1 + 1) /*!< Index of second sample to
|
||||
use for calculating bandwidth. */
|
||||
|
||||
#define CHDRV_SCALEFACTOR_INDEX 4 /*!< Index for calculating scalefactor. */
|
||||
|
||||
#define CHDRV_TRIGGER_PULSE_US 5 /*!< Length of INT pulse to trigger sensor, in microseconds - minimum 800ns. */
|
||||
#define CHDRV_DELAY_OVERHEAD_US 12 /*!< Tuning parameter to adjust pre-trigger timing */
|
||||
#define CHDRV_PRETRIGGER_DELAY_US 600 /*!< Time to delay between triggering rx-only and tx/rx nodes, in us */
|
||||
|
||||
|
||||
|
||||
//! Hook routine pointer typedefs
|
||||
typedef uint8_t (*chdrv_discovery_hook_t)(ch_dev_t *dev_ptr);
|
||||
|
||||
|
||||
//! I2C transaction control structure
|
||||
typedef struct chdrv_i2c_transaction {
|
||||
uint8_t type; /*!< I2C transaction type: 0 = std, 1 = prog interface, 2 = external */
|
||||
uint8_t rd_wrb; /*!< Read/write indicator: 0 if write operation, 1 if read operation */
|
||||
uint8_t xfer_num; /*!< current transfer within this transaction */
|
||||
uint16_t addr; /*!< I2C address */
|
||||
uint16_t nbytes; /*!< Number of bytes to transfer */
|
||||
ch_dev_t *dev_ptr; /*!< Pointer to ch_dev_t descriptor structure for individual sensor */
|
||||
uint8_t *databuf; /*!< Pointer to buffer to receive data or containing data to send */
|
||||
} chdrv_i2c_transaction_t;
|
||||
|
||||
|
||||
//! I2C queue structure, for non-blocking access
|
||||
typedef struct chdrv_i2c_queue {
|
||||
uint8_t read_pending; /*!< Read transaction status: non-zero if read operation is pending */
|
||||
uint8_t running; /*!< I2C transaction status: non-zero if I/O operation in progress */
|
||||
uint8_t len; /*!< Number of transactions in queue */
|
||||
uint8_t idx; /*!< Index of current transaction within queue */
|
||||
chdrv_i2c_transaction_t transaction[CHDRV_MAX_I2C_QUEUE_LENGTH]; /*!< List of transactions in queue */
|
||||
} chdrv_i2c_queue_t;
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Calibrate the sensor real-time clock against the host microcontroller clock.
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
*
|
||||
* This function sends a pulse (timed by the host MCU) on the INT line to each device in the group, then reads back the
|
||||
* count of sensor RTC cycles that elapsed during that pulse on each individual device. The result is stored in the ch_dev_t
|
||||
* descriptor structure for each device and is subsequently used during range calculations.
|
||||
*
|
||||
* The length of the pulse is grp_ptr->rtc_cal_pulse_ms milliseconds (typically 100ms).
|
||||
*
|
||||
* \note The calibration pulse is sent to all devices in the group at the same time. Therefore all connected devices will
|
||||
* see the same reference pulse length.
|
||||
*
|
||||
*/
|
||||
void chdrv_group_measure_rtc(ch_group_t *grp_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Convert the sensor register values to a range using the calibration data in the ch_dev_t struct.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param tof value of TOF register
|
||||
* \param tof_sf value of TOF_SF register
|
||||
*
|
||||
* \return range in millimeters, or \a CH_NO_TARGET (0xFFFFFFFF) if no object is detected.
|
||||
* The range result format is fixed point with 5 binary fractional digits (divide by 32 to convert to mm).
|
||||
*
|
||||
* This function takes the time-of-flight and scale factor values from the sensor,
|
||||
* and computes the actual one-way range based on the formulas given in the sensor datasheet.
|
||||
*/
|
||||
uint32_t chdrv_one_way_range(ch_dev_t *dev_ptr, uint16_t tof, uint16_t tof_sf);
|
||||
|
||||
/*!
|
||||
* \brief Convert the sensor register values to a round-trip range using the calibration data in the ch_dev_t struct.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param tof value of TOF register
|
||||
* \param tof_sf value of TOF_SF register
|
||||
*
|
||||
* \return range in millimeters, or \a CH_NO_TARGET (0xFFFFFFFF) if no object is detected.
|
||||
* The range result format is fixed point with 5 binary fractional digits (divide by 32 to convert to mm).
|
||||
*
|
||||
* This function takes the time-of-flight and scale factor values from the sensor,
|
||||
* and computes the actual round-trip range based on the formulas given in the sensor datasheet.
|
||||
*/
|
||||
uint32_t chdrv_round_trip_range(ch_dev_t *dev_ptr, uint16_t tof, uint16_t tof_sf);
|
||||
|
||||
/*!
|
||||
* \brief Add an I2C transaction to the non-blocking queue
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
* \param instance pointer to an individual descriptor structure for a sensor
|
||||
* \param rd_wrb read/write indicator: 0 if write operation, 1 if read operation
|
||||
* \param type I2C transaction type: 0 = std, 1 = prog interface, 2 = external
|
||||
* \param addr I2C address for transfer
|
||||
* \param nbytes number of bytes to read/write
|
||||
* \param data pointer to buffer to receive data or containing data to send
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*/
|
||||
int chdrv_group_i2c_queue(ch_group_t *grp_ptr, ch_dev_t *instance, uint8_t rd_wrb, uint8_t type, uint16_t addr, uint16_t nbytes, uint8_t *data);
|
||||
|
||||
/*!
|
||||
* \brief Add an I2C transaction for an external device to the non-blocking queue
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
* \param instance pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param rd_wrb read/write indicator: 0 if write operation, 1 if read operation
|
||||
* \param addr I2C address for transfer
|
||||
* \param nbytes number of bytes to read/write
|
||||
* \param data pointer to buffer to receive data or containing data to send
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
* This function queues an I2C transaction for an "external" device (i.e. not a Chirp sensor). It is used when the
|
||||
* I2C bus is shared between the Chirp sensor(s) and other devices.
|
||||
*
|
||||
* The transaction is flagged for special handling when the I/O operation completes. Specifically, the
|
||||
* \a chbsp_external_i2c_irq_handler() will be called by the driver to allow the board support packate (BSP)
|
||||
* to perform any necessary operations.
|
||||
*/
|
||||
int chdrv_external_i2c_queue(ch_group_t *grp_ptr, ch_dev_t *instance, uint8_t rd_wrb, uint16_t addr,
|
||||
uint16_t nbytes, uint8_t *data);
|
||||
|
||||
/*!
|
||||
* \brief Start a non-blocking sensor readout
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
*
|
||||
* This function starts a non-blocking I/O operation on the specified group of sensors.
|
||||
*/
|
||||
void chdrv_group_i2c_start_nb(ch_group_t *grp_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Continue a non-blocking readout
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
* \param i2c_bus_index index value identifying I2C bus within group
|
||||
*
|
||||
* Call this function once from your I2C interrupt handler each time it executes.
|
||||
* It will call \a chdrv_group_i2c_complete_callback() when all transactions are complete.
|
||||
*/
|
||||
void chdrv_group_i2c_irq_handler(ch_group_t *grp_ptr, uint8_t i2c_bus_index);
|
||||
|
||||
/*!
|
||||
* \brief Wait for an individual sensor to finish start-up procedure.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param timeout_ms number of milliseconds to wait for sensor to finish start-up before returning failure
|
||||
*
|
||||
* \return 0 if startup sequence finished, non-zero if startup sequence timed out or sensor is not connected
|
||||
*
|
||||
* After the sensor is programmed, it executes an internal start-up and self-test sequence. This
|
||||
* function waits the specified time in milliseconds for the sensor to finish this sequence.
|
||||
*/
|
||||
int chdrv_wait_for_lock(ch_dev_t *dev_ptr, uint16_t timeout_ms );
|
||||
|
||||
/*!
|
||||
* \brief Wait for all sensors to finish start-up procedure.
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
*
|
||||
* \return 0 if startup sequence finished on all detected sensors, non-zero if startup sequence
|
||||
* timed out on any sensor(s).
|
||||
*
|
||||
* After each sensor is programmed, it executes an internal start-up and self-test sequence. This
|
||||
* function waits for all sensor devices to finish this sequence. For each device, the maximum
|
||||
* time to wait is \a CHDRV_FREQLOCK_TIMEOUT_MS milliseconds.
|
||||
*/
|
||||
int chdrv_group_wait_for_lock(ch_group_t *grp_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Start a measurement in hardware triggered mode.
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
*
|
||||
* \return 0 if success, non-zero if \a grp_ptr pointer is invalid
|
||||
*
|
||||
* This function starts a triggered measurement on each sensor in a group, by briefly asserting
|
||||
* the INT line to each device. Each sensor must have already been placed in hardware triggered
|
||||
* mode before this function is called.
|
||||
*/
|
||||
int chdrv_group_hw_trigger(ch_group_t *grp_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Start a measurement in hardware triggered mode on one sensor.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
*
|
||||
* \return 0 if success, non-zero if \a dev_ptr pointer is invalid
|
||||
*
|
||||
* This function starts a triggered measurement on a single sensor, by briefly asserting the INT
|
||||
* line to the device. The sensor must have already been placed in hardware triggered mode before
|
||||
* this function is called.
|
||||
*
|
||||
* \note This function requires implementing the optional chirp_bsp.h functions to control the
|
||||
* INT pin direction and level for individual sensors (\a chbsp_set_io_dir_in(), \a chbsp_set_io_dir_out(),
|
||||
* \a chbsp_io_set(), and \a chbsp_io_clear()).
|
||||
*/
|
||||
int chdrv_hw_trigger(ch_dev_t *dev_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Detect a connected sensor.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
*
|
||||
* \return 1 if sensor is found, 0 if no sensor is found
|
||||
*
|
||||
* This function checks for a sensor on the I2C bus by attempting to reset, halt, and read from the
|
||||
* device using the programming interface I2C address (0x45).
|
||||
*
|
||||
* In order for the device to respond, the PROG pin for the device must be asserted before this
|
||||
* function is called. If there are multiple sensors in an application, only one device's PROG pin
|
||||
* should be active at any time.
|
||||
*/
|
||||
int chdrv_prog_ping(ch_dev_t *dev_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Detect, program, and start a sensor.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
*
|
||||
* \return 0 if write to sensor succeeded, non-zero otherwise
|
||||
*
|
||||
* This function probes the I2C bus for the device. If it is found, the sensor firmware is
|
||||
* programmed into the device, and the application I2C address is set. Then the sensor is reset
|
||||
* and execution starts.
|
||||
*
|
||||
* Once started, the sensor device will begin an internal initialization and self-test sequence.
|
||||
* The \a chdrv_wait_for_lock() function may be used to wait for this sequence to complete.
|
||||
*
|
||||
* \note This routine will leave the PROG pin de-asserted when it completes.
|
||||
*/
|
||||
int chdrv_detect_and_program(ch_dev_t *dev_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Detect, program, and start all sensors in a group.
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
*
|
||||
* \return 0 for success, non-zero if write(s) failed to any sensor initially detected as present
|
||||
*
|
||||
* This function probes the I2C bus for each device in the group. For each detected sensor, the
|
||||
* firmware is programmed into the device, and the application I2C address is set. Then the sensor
|
||||
* is reset and execution starts.
|
||||
*
|
||||
* Once started, each device will begin an internal initialization and self-test sequence. The
|
||||
* \a chdrv_group_wait_for_lock() function may be used to wait for this sequence to complete on all
|
||||
* devices in the group.
|
||||
*
|
||||
* \note This routine will leave the PROG pin de-asserted for all devices in the group when it completes.
|
||||
*/
|
||||
int chdrv_group_detect_and_program(ch_group_t *grp_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Initialize the sensor device configuration.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure to be initialized
|
||||
* \param i2c_addr I2C address to assign to this device. This will be the "application I2C
|
||||
address" used to access the device after it is initialized. Each sensor
|
||||
on an I2C interface must use a unique application I2C address.
|
||||
* \param io_index index identifying this device. Each sensor in a group must have a
|
||||
* unique \a io_index value.
|
||||
* \param i2c_bus_index index identifying the I2C interface (bus) to use with this device
|
||||
* \param part_number integer part number for sensor (e.g. 101 for CH101 device, or 201 for CH201))
|
||||
*
|
||||
* \return 0 (always)
|
||||
*
|
||||
* This function initializes the ch_dev_t descriptor structure for the device with the specified values.
|
||||
*/
|
||||
int chdrv_init(ch_dev_t *dev_ptr, uint8_t i2c_addr, uint8_t io_index, uint8_t i2c_bus_index,
|
||||
uint16_t part_number);
|
||||
|
||||
/*!
|
||||
* \brief Initialize data structures and hardware for sensor interaction and reset sensors.
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
*
|
||||
* \return 0 if hardware initialization is successful, non-zero otherwise
|
||||
*
|
||||
* This function is called internally by \a chdrv_group_start().
|
||||
*/
|
||||
int chdrv_group_prepare(ch_group_t* grp_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Initalize and start a group of sensors.
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
*
|
||||
* \return 0 if successful, 1 if device doesn't respond
|
||||
*
|
||||
* This function resets each sensor in programming mode, transfers the firmware image to the sensor's
|
||||
* on-chip memory, changes the sensor's application I2C address from the default, then starts the
|
||||
* sensor and sends a timed pulse on the INT line for real-time clock calibration.
|
||||
*
|
||||
* This function assumes firmware-specific initialization has already been performed for each ch_dev_t
|
||||
* descriptor in the sensor group. (See \a ch_init()).
|
||||
*/
|
||||
int chdrv_group_start(ch_group_t *grp_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Write byte to a sensor application register.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param reg_addr register address
|
||||
* \param data data value to transmit
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*/
|
||||
int chdrv_write_byte(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t data);
|
||||
|
||||
/*!
|
||||
* \brief Write 16 bits to a sensor application register.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param mem_addr sensor memory/register address
|
||||
* \param data data value to transmit
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*/
|
||||
int chdrv_write_word(ch_dev_t *dev_ptr, uint16_t mem_addr, uint16_t data);
|
||||
|
||||
/*!
|
||||
* \brief Read byte from a sensor application register.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param mem_addr sensor memory/register address
|
||||
* \param data pointer to receive buffer
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*/
|
||||
int chdrv_read_byte(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t *data);
|
||||
|
||||
/*!
|
||||
* \brief Read 16 bits from a sensor application register.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param mem_addr sensor memory/register address
|
||||
* \param data pointer to receive buffer
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*/
|
||||
int chdrv_read_word(ch_dev_t *dev_ptr, uint16_t mem_addr, uint16_t * data);
|
||||
|
||||
/*!
|
||||
* \brief Read multiple bytes from a sensor application register location.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param mem_addr sensor memory/register address
|
||||
* \param data pointer to receive buffer
|
||||
* \param len number of bytes to read
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
*/
|
||||
int chdrv_burst_read(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t *data, uint16_t len);
|
||||
|
||||
/*!
|
||||
* \brief Write multiple bytes to a sensor application register location.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param mem_addr sensor memory/register address
|
||||
* \param data pointer to transmit buffer containing data to send
|
||||
* \param len number of bytes to write
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
*/
|
||||
int chdrv_burst_write(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t *data, uint8_t len);
|
||||
|
||||
/*!
|
||||
* \brief Perform a soft reset on a sensor.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
* \param mem_addr sensor memory/register address
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
* This function performs a soft reset on an individual sensor by writing to a special control register.
|
||||
*/
|
||||
int chdrv_soft_reset(ch_dev_t *dev_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Perform a hard reset on a group of sensors.
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
* This function performs a hardware reset on each device in a group of sensors by asserting each device's RESET_N pin.
|
||||
*/
|
||||
int chdrv_group_hard_reset(ch_group_t *grp_ptr );
|
||||
|
||||
/*!
|
||||
* \brief Perform a soft reset on a group of sensors.
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t descriptor structure for a group of sensors
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
* This function performs a soft reset on each device in a group of sensors by writing to a special
|
||||
* control register.
|
||||
*/
|
||||
int chdrv_group_soft_reset(ch_group_t *grp_ptr );
|
||||
|
||||
/*!
|
||||
* \brief Put sensor(s) in idle state
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t descriptor structure for a sensor
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
* This function places the sensor in an idle state by loading an idle loop instruction sequence.
|
||||
* This is used only during early initialization of the device. This is NOT the same as putting a
|
||||
* running device into "idle mode" by using the \a ch_set_mode() function.
|
||||
*/
|
||||
int chdrv_set_idle(ch_dev_t *dev_ptr );
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Write to a sensor programming register.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t config structure for a sensor
|
||||
* \param reg_addr sensor programming register address.
|
||||
* \param data 8-bit or 16-bit data to transmit.
|
||||
*
|
||||
* \return 0 if write to sensor succeeded, non-zero otherwise
|
||||
*
|
||||
* This function writes a value to a sensor programming register.
|
||||
*/
|
||||
int chdrv_prog_write(ch_dev_t *dev_ptr, uint8_t reg_addr, uint16_t data);
|
||||
|
||||
/*!
|
||||
* \brief Write bytes to a sensor device in programming mode.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t config structure for a sensor
|
||||
* \param message pointer to a buffer containing the bytes to write
|
||||
* \param len number of bytes to write
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
* This function writes bytes to the device using the programming I2C address. The
|
||||
* PROG line for the device must have been asserted before this function is called.
|
||||
*/
|
||||
int chdrv_prog_i2c_write(ch_dev_t *dev_ptr, uint8_t *message, uint16_t len);
|
||||
|
||||
/*!
|
||||
* \brief Read bytes from a sensor device in programming mode.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t config structure for a sensor
|
||||
* \param message pointer to a buffer where read bytes will be placed
|
||||
* \param len number of bytes to read
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
* This function reads bytes from the device using the programming I2C address. The
|
||||
* PROG line for the device must have been asserted before this function is called.
|
||||
*/
|
||||
int chdrv_prog_i2c_read(ch_dev_t *dev_ptr, uint8_t *message, uint16_t len);
|
||||
|
||||
/*!
|
||||
* \brief Read bytes from a sensor device in programming mode, non-blocking.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t config structure for a sensor
|
||||
* \param message pointer to a buffer where read bytes will be placed
|
||||
* \param len number of bytes to read
|
||||
*
|
||||
* \return 0 if successful, non-zero otherwise
|
||||
*
|
||||
* This function temporarily changes the device I2C address to the low-level programming
|
||||
* interface, and issues a non-blocking read request. The PROG line for the device must have
|
||||
* been asserted before this function is called.
|
||||
*/
|
||||
int chdrv_prog_i2c_read_nb(ch_dev_t *dev_ptr, uint8_t *message, uint16_t len);
|
||||
|
||||
/*!
|
||||
* \brief Write to sensor memory.
|
||||
*
|
||||
* \param dev_ptr pointer to the ch_dev_t config structure for a sensor
|
||||
* \param addr sensor programming register start address
|
||||
* \param message pointer to data to transmit
|
||||
* \param nbytes number of bytes to write
|
||||
*
|
||||
* \return 0 if write to sensor succeeded, non-zero otherwise
|
||||
*
|
||||
* This function writes to sensor memory using the low-level programming interface. The type
|
||||
* of write is automatically determined based on data length and target address alignment.
|
||||
*/
|
||||
int chdrv_prog_mem_write(ch_dev_t *dev_ptr, uint16_t addr, uint8_t *message, uint16_t nbytes);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Register a hook routine to be called after device discovery.
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t config structure for a group of sensors
|
||||
* \param hook_func_ptr address of hook routine to be called
|
||||
*
|
||||
* This function sets a pointer to a hook routine, which will be called from the
|
||||
* Chirp driver when each device is discovered on the I2C bus, before the device is initialized.
|
||||
*
|
||||
* This function should be called between \a ch_init() and \a ch_group_start().
|
||||
*/
|
||||
void chdrv_discovery_hook_set(ch_group_t *grp_ptr, chdrv_discovery_hook_t hook_func_ptr);
|
||||
|
||||
/*!
|
||||
* \brief Set the pre-trigger delay for rx-only sensors
|
||||
*
|
||||
* \param grp_ptr pointer to the ch_group_t config structure for a group of sensors
|
||||
* \param delay_us time to delay between triggering rx-only and tx/rx nodes, in microseconds
|
||||
*
|
||||
* This function sets a delay interval that will be inserted between triggering rx-only sensors
|
||||
* and tx/rx sensors. This delay allows the rx-only sensor(s) to settle from any startup disruption
|
||||
* (e.g. PMUT "ringdown") before the ultrasound pulse is generated by the tx node.
|
||||
*
|
||||
*/
|
||||
void chdrv_pretrigger_delay_set(ch_group_t *grp_ptr, uint16_t delay_us);
|
||||
|
||||
#endif /* CH_DRIVER_H_ */
|
49
CHIRP/drivers/inc/ch_math_utils.h
Normal file
49
CHIRP/drivers/inc/ch_math_utils.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/*!
|
||||
* \file ch_math_utils.h
|
||||
* \date July 20, 2017
|
||||
* \author nparikh
|
||||
* \copyright Copyright 2017 Chirp Microsystems. All rights reserved.
|
||||
* \brief Functions for performing fixed point arithmetic.
|
||||
* https://github.com/dmoulding/log2fix
|
||||
* https://github.com/chmike/fpsqrt
|
||||
*/
|
||||
|
||||
#ifndef CH_MATH_UTILS_H_
|
||||
#define CH_MATH_UTILS_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define FRACT_BITS 16
|
||||
|
||||
#define INT2FIXED(x) ((x) << FRACT_BITS)
|
||||
#define FLOAT2FIXED(x) ((fixed_t)((x) * (1 << FRACT_BITS)))
|
||||
|
||||
#define FIXED2INT(x) ((x) >> FRACT_BITS)
|
||||
#define FIXED2FLOAT(x) (((float)(x)) / (1 << FRACT_BITS))
|
||||
|
||||
#define FIXEDDIV(x,y) ((fixed_t)(((uint64_t)(x) << FRACT_BITS) / (y)))
|
||||
#define FIXEDMUL(x,y) ((fixed_t)(((x) >> (FRACT_BITS/2)) * ((y) >> (FRACT_BITS/2))))
|
||||
|
||||
#define FIXED_PI 0x3243FU
|
||||
|
||||
#define INV_LOG2_E_Q1DOT31 0x58b90bfcU // Inverse log base 2 of e, Q1.31 format
|
||||
|
||||
#define Q31_TO_Q16_SHIFT_BITS 15 // Shift Q31 format by 15 bits to give Q16
|
||||
#define Q31_TO_Q16_SHIFT_1 10 // Number of bits to shift in first step
|
||||
#define Q31_TO_Q16_SHIFT_2 (Q31_TO_Q16_SHIFT_BITS - Q31_TO_Q16_SHIFT_1)
|
||||
// Number of bits to shift in second step
|
||||
|
||||
|
||||
typedef uint32_t fixed_t;
|
||||
|
||||
fixed_t FP_sqrt(fixed_t x);
|
||||
|
||||
fixed_t FP_log2(fixed_t x);
|
||||
|
||||
fixed_t FP_log(fixed_t x);
|
||||
|
||||
int32_t sqrt_int32( int32_t v );
|
||||
|
||||
#endif /* CH_MATH_UTILS_H_ */
|
1041
CHIRP/drivers/inc/chirp_bsp.h
Normal file
1041
CHIRP/drivers/inc/chirp_bsp.h
Normal file
File diff suppressed because it is too large
Load Diff
1887
CHIRP/drivers/inc/soniclib.h
Normal file
1887
CHIRP/drivers/inc/soniclib.h
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user