Chirp SonicLib  4.5.2
ch_driver.h
Go to the documentation of this file.
1 
18 /*
19  Copyright 2016-2023, InvenSense, Inc. All rights reserved.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  DISCLAIMED.
25 
26  */
27 
28 #ifndef CH_DRIVER_H_
29 #define CH_DRIVER_H_
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 // #define USE_PRE_PROD_SERIAL_NUM // if defined, handle pre-production ICU serial number
36 
37 #include <invn/soniclib/soniclib.h>
38 
39 #include <stdint.h>
40 #include <stdlib.h>
41 #include <math.h>
42 #include <string.h>
43 
44 #define CHDRV_I2C_MAX_WRITE_BYTES 256
46 #define CHDRV_NB_TRANS_TYPE_STD (0)
47 #define CHDRV_NB_TRANS_TYPE_PROG (1)
48 #define CHDRV_NB_TRANS_TYPE_EXTERNAL (2)
50 /*** Definitions relative to CHx01 sensors */
51 
52 /* Programming interface register addresses */
53 #define CH_PROG_REG_PING 0x00
54 #define CH_PROG_REG_CPU 0x42
55 #define CH_PROG_REG_STAT 0x43
56 #define CH_PROG_REG_CTL 0x44
57 #define CH_PROG_REG_ADDR 0x05
58 #define CH_PROG_REG_CNT 0x07
59 #define CH_PROG_REG_DATA 0x06
61 #define CH_PROG_ADDR_WDT_REG (0x0120)
62 #define CH_PROG_ADDR_PMUT_CNTRL4_REG (0x01A6)
63 #define CH_PROG_ADDR_DEV_I2C_ADDR_REG (0x01C5)
64 #define CH_PROG_ADDR_IDLE_LOC (CHX01_PROG_MEM_ADDR + CHX01_PROG_MEM_SIZE - 4)
66 #define PMUT_CNTRL4_HVVSS_FON (0x0200)
67 #define PMUT_CNTRL4_HVVDD_FON (0x0400)
68 
69 #define CH_PROG_SIZEOF(R) ((R)&0x40 ? 1 : 2)
72 #define CH_PROG_XFER_SIZE (256)
74 /*** End of definitions relative to CHx01 sensors */
75 
76 #define CHDRV_DEBUG_PIN_NUM (0)
78 #define CHDRV_MAX_QUEUE_LENGTH \
79  CHIRP_MAX_NUM_SENSORS
81 #define CHDRV_FREQLOCK_TIMEOUT_MS \
82  100
84 #define CHDRV_BANDWIDTH_INDEX_1 6
85 #define CHDRV_BANDWIDTH_INDEX_2 \
86  (CHDRV_BANDWIDTH_INDEX_1 + 1)
89 #define CHDRV_SCALEFACTOR_INDEX 4
91 #define CHDRV_TRIGGER_PULSE_US 5
92 #define CHDRV_DELAY_OVERHEAD_US (0)
93 #define CHDRV_PRETRIGGER_DELAY_US 600
94 #define CHDRV_POST_TRIG_IEN_DELAY_US \
95  10
96 #define CHDRV_POST_ALGO_INIT_DELAY_MS 3
97 #define CHDRV_DELAY_EN_CHARGE_PUMP_MS (5)
98 #define CHDRV_EVENT_TIMEOUT_MS (750)
100 #define CHDRV_I2C_SPEED_DEFAULT_HZ (400000)
103 typedef struct chdrv_transaction {
104  uint8_t type;
105  uint8_t rd_wrb;
106  uint8_t xfer_num;
107  uint16_t addr;
108  uint16_t nbytes;
110  uint8_t *databuf;
112 
114 typedef struct chdrv_queue {
115  uint8_t read_pending;
116  uint8_t running;
117  uint8_t len;
118  uint8_t idx;
121 
137 void chdrv_group_measure_rtc(ch_group_t *grp_ptr);
138 
157 
171 uint32_t chdrv_one_way_range(ch_dev_t *dev_ptr, uint16_t tof, uint16_t tof_sf);
172 
186 uint32_t chdrv_round_trip_range(ch_dev_t *dev_ptr, uint16_t tof, uint16_t tof_sf);
187 
201 int chdrv_group_queue(ch_group_t *grp_ptr, ch_dev_t *instance, uint8_t rd_wrb, uint8_t type, uint16_t addr,
202  uint16_t nbytes, uint8_t *data);
203 
223 int chdrv_external_queue(ch_group_t *grp_ptr, ch_dev_t *instance, uint8_t rd_wrb, uint16_t addr, uint16_t nbytes,
224  uint8_t *data);
225 
233 void chdrv_group_start_nb(ch_group_t *grp_ptr);
234 
244 void chdrv_group_irq_handler(ch_group_t *grp_ptr, uint8_t bus_index);
245 
246 #ifdef INCLUDE_WHITNEY_SUPPORT
258 int chdrv_wait_for_lock(ch_dev_t *dev_ptr, uint16_t timeout_ms);
259 
273 
274 #endif // INCLUDE_WHITNEY_SUPPORT
275 
287 int chdrv_group_hw_trigger(ch_group_t *grp_ptr);
288 
304 int chdrv_hw_trigger(ch_dev_t *dev_ptr);
305 
320 int chdrv_prog_ping(ch_dev_t *dev_ptr);
321 
339 int chdrv_detect_and_program(ch_dev_t *dev_ptr);
340 
358 
377 int chdrv_init(ch_dev_t *dev_ptr, uint8_t i2c_addr, uint8_t io_index, uint8_t bus_index, uint16_t part_number);
378 
388 int chdrv_group_prepare(ch_group_t *grp_ptr);
389 
410 uint8_t chdrv_group_start(ch_group_t *grp_ptr);
411 
422 int chdrv_restart(ch_dev_t *dev_ptr);
423 
433 int chdrv_write_byte(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t data);
434 
444 int chdrv_write_word(ch_dev_t *dev_ptr, uint16_t mem_addr, uint16_t data);
445 
455 int chdrv_read_byte(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t *data);
456 
466 int chdrv_read_word(ch_dev_t *dev_ptr, uint16_t mem_addr, uint16_t *data);
467 
479 int chdrv_burst_read(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t *data, uint16_t len);
480 
489 int chdrv_read_buf_addr(ch_dev_t *dev_ptr);
490 
502 int chdrv_burst_write(ch_dev_t *dev_ptr, uint16_t mem_addr, const uint8_t *data, uint16_t num_bytes);
503 
514 int chdrv_soft_reset(ch_dev_t *dev_ptr);
515 
525 int chdrv_group_hard_reset(ch_group_t *grp_ptr);
526 
537 int chdrv_group_soft_reset(ch_group_t *grp_ptr);
538 
551 int chdrv_set_idle(ch_dev_t *dev_ptr);
552 
564 int chdrv_prog_write(ch_dev_t *dev_ptr, uint8_t reg_addr, uint16_t data);
565 
578 int chdrv_prog_i2c_write(ch_dev_t *dev_ptr, const uint8_t *message, uint16_t len);
579 
592 int chdrv_prog_i2c_read(ch_dev_t *dev_ptr, uint8_t *message, uint16_t len);
593 
607 int chdrv_prog_i2c_read_nb(ch_dev_t *dev_ptr, uint8_t *message, uint16_t len);
608 
622 int chdrv_prog_mem_write(ch_dev_t *dev_ptr, uint16_t addr, const uint8_t *message, uint16_t nbytes);
623 
635 void chdrv_pretrigger_delay_set(ch_group_t *grp_ptr, uint16_t delay_us);
636 
649 uint8_t chdrv_sys_ctrl_read(ch_dev_t *dev_ptr, uint8_t *reg_value_ptr);
650 
665 uint8_t chdrv_sys_ctrl_write(ch_dev_t *dev_ptr, uint8_t reg_value);
666 
678 uint8_t chdrv_dbg_reg_read(ch_dev_t *dev_ptr, uint8_t reg_id, uint16_t *reg_value_ptr);
679 
693 uint8_t chdrv_dbg_reg_write(ch_dev_t *dev_ptr, uint8_t reg_id, uint16_t reg_value);
694 
721 uint8_t chdrv_int_notify(ch_group_t *grp_ptr, uint8_t dev_num);
722 
735 void chdrv_int_callback(ch_group_t *grp_ptr, uint8_t dev_num);
736 
754 void chdrv_int_callback_deferred(ch_group_t *grp_ptr, uint8_t dev_num);
755 
756 #ifdef INCLUDE_SHASTA_SUPPORT
757 
770 uint8_t chdrv_event_trigger(ch_dev_t *dev_ptr, uint16_t event);
771 
784 uint8_t chdrv_event_trigger_and_wait(ch_dev_t *dev_ptr, uint16_t event);
785 
803 uint8_t chdrv_otpmem_read(ch_dev_t *dev_ptr);
804 
821 uint8_t chdrv_otpmem_copy(ch_dev_t *dev_ptr, otp_copy_t *otp_copy_ptr);
822 
833 uint8_t chdrv_algo_init(ch_dev_t *dev_ptr);
834 
845 uint8_t chdrv_algo_info_read(ch_dev_t *dev_ptr, ICU_ALGO_SHASTA_INFO *algo_info_ptr);
846 
858 uint8_t chdrv_algo_cfg_read(ch_dev_t *dev_ptr, void *algo_cfg_ptr);
859 
871 uint8_t chdrv_algo_cfg_write(ch_dev_t *dev_ptr, const void *algo_cfg_ptr);
872 
884 uint8_t chdrv_algo_out_read(ch_dev_t *dev_ptr, void *algo_out_ptr);
885 
897 uint8_t chdrv_algo_state_read(ch_dev_t *dev_ptr, void *algo_state_ptr);
898 
915 uint8_t chdrv_meas_queue_write(ch_dev_t *dev_ptr, measurement_queue_t *q_buf_ptr);
916 
933 uint8_t chdrv_meas_queue_read(ch_dev_t *dev_ptr, measurement_queue_t *q_buf_ptr);
934 
935 #endif
936 
952 void chdrv_trig_assert(ch_dev_t *dev_ptr);
953 
969 void chdrv_trig_deassert(ch_dev_t *dev_ptr);
970 
986 void chdrv_trig_group_assert(ch_group_t *grp_ptr);
987 
1003 void chdrv_trig_group_deassert(ch_group_t *grp_ptr);
1004 
1018 void chdrv_trig_set_dir_out(ch_dev_t *dev_ptr);
1019 
1034 
1050 void chdrv_int_group_assert(ch_group_t *grp_ptr);
1051 
1067 void chdrv_int_group_deassert(ch_group_t *grp_ptr);
1068 
1082 void chdrv_int_set_dir_in(ch_dev_t *dev_ptr);
1083 
1097 void chdrv_int_group_set_dir_in(ch_group_t *grp_ptr);
1098 
1113 
1131 void chdrv_int_interrupt_enable(ch_dev_t *dev_ptr);
1132 
1150 void chdrv_int_interrupt_disable(ch_dev_t *dev_ptr);
1151 
1170 
1189 
1200 uint32_t chdrv_cpu_freq_calculate(ch_dev_t *dev_ptr);
1201 
1215 uint32_t chdrv_cpu_freq_adjust(ch_dev_t *dev_ptr, uint32_t pmut_freq);
1216 
1226 uint8_t chdrv_run_bist(ch_dev_t *dev_ptr);
1227 
1238 void chdrv_group_measure_pmut(ch_group_t *grp_ptr);
1239 
1240 uint8_t chdrv_check_reset_state(ch_dev_t *dev_ptr, uint8_t *reset_state);
1241 
1242 #ifdef __cplusplus
1243 }
1244 #endif
1245 
1246 #endif /* CH_DRIVER_H_ */
int chdrv_hw_trigger(ch_dev_t *dev_ptr)
Start a measurement in hardware triggered mode on one sensor.
Definition: ch_driver.c:2080
void chdrv_group_irq_handler(ch_group_t *grp_ptr, uint8_t bus_index)
Continue a non-blocking readout.
Definition: ch_driver.c:1762
int chdrv_group_hard_reset(ch_group_t *grp_ptr)
Perform a hard reset on a group of sensors.
Definition: ch_driver.c:2963
uint32_t chdrv_cpu_freq_adjust(ch_dev_t *dev_ptr, uint32_t pmut_freq)
Adjust sensor micro-controller CPU frequency.
Definition: ch_driver.c:1335
struct chdrv_transaction chdrv_transaction_t
Transaction control structure.
uint32_t chdrv_one_way_range(ch_dev_t *dev_ptr, uint16_t tof, uint16_t tof_sf)
Convert the sensor register values to a range using the calibration data in the ch_dev_t struct.
Definition: ch_driver.c:1675
int chdrv_prog_i2c_read(ch_dev_t *dev_ptr, uint8_t *message, uint16_t len)
Read bytes from a CHx01 device in programming mode.
Definition: ch_driver.c:431
void chdrv_int_interrupt_enable(ch_dev_t *dev_ptr)
Enable interrupts on the interrupt line for a sensor.
Definition: ch_driver.c:275
uint8_t chdrv_otpmem_read(ch_dev_t *dev_ptr)
Read OTP memory contents.
Definition: ch_driver.c:896
int chdrv_set_idle(ch_dev_t *dev_ptr)
Put CHx01 sensor(s) in idle state.
Definition: ch_driver.c:2543
uint8_t chdrv_algo_cfg_read(ch_dev_t *dev_ptr, void *algo_cfg_ptr)
Read the algorithm configuration data from a sensor.
Definition: ch_driver.c:1226
uint8_t chdrv_check_reset_state(ch_dev_t *dev_ptr, uint8_t *reset_state)
Check if sensor reset has occurred.
Definition: ch_driver.c:3034
void chdrv_int_set_dir_in(ch_dev_t *dev_ptr)
Configure the interrupt line for a sensor as an input.
Definition: ch_driver.c:239
int chdrv_group_hw_trigger(ch_group_t *grp_ptr)
Start a measurement in hardware triggered mode.
Definition: ch_driver.c:2004
struct chdrv_queue chdrv_queue_t
Queue structure, for non-blocking access.
uint8_t chdrv_dbg_reg_read(ch_dev_t *dev_ptr, uint8_t reg_id, uint16_t *reg_value_ptr)
Read the debug register from a sensor.
Definition: ch_driver.c:846
int chdrv_read_buf_addr(ch_dev_t *dev_ptr)
Read the IQ buffer address from the sensor and store in dev_ptr.
Definition: ch_driver.c:2343
void chdrv_int_group_assert(ch_group_t *grp_ptr)
Assert the interrupt lines for all sensors in a group.
Definition: ch_driver.c:215
void chdrv_int_group_set_dir_in(ch_group_t *grp_ptr)
Configure the interrupt lines for all sensors in a group as inputs.
Definition: ch_driver.c:251
void chdrv_int_group_deassert(ch_group_t *grp_ptr)
De-assert the interrupt lines for all sensors in a group.
Definition: ch_driver.c:227
int chdrv_prog_ping(ch_dev_t *dev_ptr)
Detect a connected sensor.
Definition: ch_driver.c:2459
uint8_t chdrv_event_trigger(ch_dev_t *dev_ptr, uint16_t event)
Trigger an event on a sensor and return immediately.
Definition: ch_driver.c:651
uint8_t chdrv_algo_cfg_write(ch_dev_t *dev_ptr, const void *algo_cfg_ptr)
Write the algorithm configuration data to a sensor.
Definition: ch_driver.c:1236
uint8_t chdrv_dbg_reg_write(ch_dev_t *dev_ptr, uint8_t reg_id, uint16_t reg_value)
Write the debug register in a sensor.
Definition: ch_driver.c:871
int chdrv_group_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)
Add an I2C/SPI transaction to the non-blocking queue.
Definition: ch_driver.c:1707
void chdrv_int_callback(ch_group_t *grp_ptr, uint8_t dev_num)
Driver callback routine for sensor interrupt.
Definition: ch_driver.c:746
void chdrv_group_measure_rtc_no_pulse(ch_group_t *grp_ptr)
Calibrate the sensor real-time clock without using a pulse.
Definition: ch_driver.c:1602
uint8_t chdrv_algo_out_read(ch_dev_t *dev_ptr, void *algo_out_ptr)
Read the algorithm output data from a sensor.
Definition: ch_driver.c:1243
int chdrv_prog_write(ch_dev_t *dev_ptr, uint8_t reg_addr, uint16_t data)
Write to a CHx01 programming register.
Definition: ch_driver.c:2120
void chdrv_trig_assert(ch_dev_t *dev_ptr)
Assert the hardware trigger line for a sensor.
Definition: ch_driver.c:325
void chdrv_trig_set_dir_out(ch_dev_t *dev_ptr)
Configure the hardware trigger line for a sensor as an output.
Definition: ch_driver.c:373
int chdrv_prog_mem_write(ch_dev_t *dev_ptr, uint16_t addr, const uint8_t *message, uint16_t nbytes)
Write to CHx01 sensor memory.
Definition: ch_driver.c:2154
int chdrv_group_wait_for_lock(ch_group_t *grp_ptr)
Wait for all sensors to finish start-up procedure.
Definition: ch_driver.c:1980
void chdrv_int_callback_deferred(ch_group_t *grp_ptr, uint8_t dev_num)
Driver callback deferred routine for sensor interrupt.
Definition: ch_driver.c:760
void chdrv_int_interrupt_disable(ch_dev_t *dev_ptr)
Disable interrupts on the interrupt line for a sensor.
Definition: ch_driver.c:287
void chdrv_group_measure_rtc(ch_group_t *grp_ptr)
Calibrate the sensor real-time clock against the host microcontroller clock.
Definition: ch_driver.c:1519
uint8_t chdrv_event_trigger_and_wait(ch_dev_t *dev_ptr, uint16_t event)
Trigger an event on a sensor and wait for completion.
Definition: ch_driver.c:685
int chdrv_write_word(ch_dev_t *dev_ptr, uint16_t mem_addr, uint16_t data)
Write 16 bits to a sensor application register.
Definition: ch_driver.c:544
uint8_t chdrv_group_start(ch_group_t *grp_ptr)
Initialize and start a group of sensors.
Definition: ch_driver.c:2864
uint32_t chdrv_round_trip_range(ch_dev_t *dev_ptr, uint16_t tof, uint16_t tof_sf)
Convert the sensor register values to a round-trip range using the calibration data in the ch_dev_t s...
int chdrv_restart(ch_dev_t *dev_ptr)
Restart a sensor.
Definition: ch_driver.c:2891
void chdrv_int_group_set_dir_out(ch_group_t *grp_ptr)
Configure the interrupt lines for all sensors in a group as outputs.
Definition: ch_driver.c:263
int chdrv_write_byte(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t data)
Write byte to a sensor application register.
Definition: ch_driver.c:472
void chdrv_int_group_interrupt_disable(ch_group_t *grp_ptr)
Disable interrupts on the interrupt lines for all sensors in a group.
Definition: ch_driver.c:311
uint32_t chdrv_cpu_freq_calculate(ch_dev_t *dev_ptr)
Calculate sensor micro-controller CPU frequency, in Hz.
Definition: ch_driver.c:1394
void chdrv_trig_group_assert(ch_group_t *grp_ptr)
Assert the hardware trigger lines for all sensors in a group.
Definition: ch_driver.c:349
uint8_t chdrv_otpmem_copy(ch_dev_t *dev_ptr, otp_copy_t *otp_copy_ptr)
Copy OTP memory contents.
Definition: ch_driver.c:954
uint8_t chdrv_sys_ctrl_write(ch_dev_t *dev_ptr, uint8_t reg_value)
Write the system control register in a sensor.
Definition: ch_driver.c:827
uint8_t chdrv_meas_queue_read(ch_dev_t *dev_ptr, measurement_queue_t *q_buf_ptr)
Read the measurement queue from a sensor.
Definition: ch_driver.c:1193
int chdrv_group_prepare(ch_group_t *grp_ptr)
Initialize data structures and hardware for sensor interaction and reset sensors.
Definition: ch_driver.c:2609
uint8_t chdrv_algo_init(ch_dev_t *dev_ptr)
Initialize the measurement algorithm on a sensor.
Definition: ch_driver.c:1206
uint8_t chdrv_meas_queue_write(ch_dev_t *dev_ptr, measurement_queue_t *q_buf_ptr)
Write the measurement queue to a sensor.
Definition: ch_driver.c:1175
void chdrv_group_measure_pmut(ch_group_t *grp_ptr)
Measure the ultrasonic transducer frequency & bandwidth.
Definition: ch_driver.c:1630
int chdrv_read_byte(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t *data)
Read byte from a sensor application register.
Definition: ch_driver.c:571
void chdrv_int_group_interrupt_enable(ch_group_t *grp_ptr)
Enable interrupts on the interrupt lines for all sensors in a group.
Definition: ch_driver.c:299
int chdrv_soft_reset(ch_dev_t *dev_ptr)
Perform a soft reset on a sensor.
Definition: ch_driver.c:2921
int chdrv_prog_i2c_read_nb(ch_dev_t *dev_ptr, uint8_t *message, uint16_t len)
Read bytes from a CHx01 device in programming mode, non-blocking.
Definition: ch_driver.c:453
void chdrv_trig_group_deassert(ch_group_t *grp_ptr)
De-assert the hardware trigger lines for all sensors in a group.
Definition: ch_driver.c:361
void chdrv_pretrigger_delay_set(ch_group_t *grp_ptr, uint16_t delay_us)
Set the pre-trigger delay for rx-only sensors.
Definition: ch_driver.c:3014
int chdrv_detect_and_program(ch_dev_t *dev_ptr)
Detect, program, and start a sensor.
Definition: ch_driver.c:2518
int chdrv_group_soft_reset(ch_group_t *grp_ptr)
Perform a soft reset on a group of sensors.
Definition: ch_driver.c:2992
int chdrv_wait_for_lock(ch_dev_t *dev_ptr, uint16_t timeout_ms)
Wait for an individual sensor to finish start-up procedure.
Definition: ch_driver.c:1952
#define CHDRV_MAX_QUEUE_LENGTH
Definition: ch_driver.h:79
int chdrv_external_queue(ch_group_t *grp_ptr, ch_dev_t *instance, uint8_t rd_wrb, uint16_t addr, uint16_t nbytes, uint8_t *data)
Add an I2C/SPI transaction for an external device to the non-blocking queue.
uint8_t chdrv_algo_state_read(ch_dev_t *dev_ptr, void *algo_state_ptr)
Read the algorithm state data from a sensor.
Definition: ch_driver.c:1253
void chdrv_trig_group_set_dir_out(ch_group_t *grp_ptr)
Configure the hardware trigger lines for all sensors in a group as outputs.
Definition: ch_driver.c:385
void chdrv_group_start_nb(ch_group_t *grp_ptr)
Start a non-blocking sensor readout.
Definition: ch_driver.c:1740
uint8_t chdrv_algo_info_read(ch_dev_t *dev_ptr, ICU_ALGO_SHASTA_INFO *algo_info_ptr)
Read the algorithm information data from a sensor.
Definition: ch_driver.c:1216
int chdrv_init(ch_dev_t *dev_ptr, uint8_t i2c_addr, uint8_t io_index, uint8_t bus_index, uint16_t part_number)
Initialize the sensor device configuration.
int chdrv_burst_read(ch_dev_t *dev_ptr, uint16_t mem_addr, uint8_t *data, uint16_t len)
Read multiple bytes from a sensor application register location.
Definition: ch_driver.c:593
int chdrv_read_word(ch_dev_t *dev_ptr, uint16_t mem_addr, uint16_t *data)
Read 16 bits from a sensor application register.
Definition: ch_driver.c:638
uint8_t chdrv_run_bist(ch_dev_t *dev_ptr)
Run built-in self test (BIST) on sensor.
Definition: ch_driver.c:1434
int chdrv_burst_write(ch_dev_t *dev_ptr, uint16_t mem_addr, const uint8_t *data, uint16_t num_bytes)
Write multiple bytes to a sensor application register location.
Definition: ch_driver.c:497
uint8_t chdrv_int_notify(ch_group_t *grp_ptr, uint8_t dev_num)
Notify SonicLib that a sensor interrupt was received.
Definition: ch_driver.c:726
uint8_t chdrv_sys_ctrl_read(ch_dev_t *dev_ptr, uint8_t *reg_value_ptr)
Read the system control register from a sensor.
Definition: ch_driver.c:809
int chdrv_group_detect_and_program(ch_group_t *grp_ptr)
Detect, program, and start all sensors in a group.
Definition: ch_driver.c:2580
int chdrv_prog_i2c_write(ch_dev_t *dev_ptr, const uint8_t *message, uint16_t len)
Write bytes to a CHx01 device in programming mode.
Definition: ch_driver.c:410
void chdrv_trig_deassert(ch_dev_t *dev_ptr)
De-assert the hardware trigger line for a sensor.
Definition: ch_driver.c:337
SonicLib public API and support functions for TDK/InvenSense ultrasonic sensors (originally developed...
Chirp sensor device descriptor structure.
Definition: soniclib.h:732
Chirp sensor group descriptor structure.
Definition: soniclib.h:704
Queue structure, for non-blocking access.
Definition: ch_driver.h:115
chdrv_transaction_t transaction[CHDRV_MAX_QUEUE_LENGTH]
Definition: ch_driver.h:120
uint8_t running
Definition: ch_driver.h:117
uint8_t read_pending
Definition: ch_driver.h:116
uint8_t len
Definition: ch_driver.h:118
uint8_t idx
Definition: ch_driver.h:119
Transaction control structure.
Definition: ch_driver.h:104
uint8_t * databuf
Definition: ch_driver.h:111
uint8_t xfer_num
Definition: ch_driver.h:107
uint16_t addr
Definition: ch_driver.h:108
uint16_t nbytes
Definition: ch_driver.h:109
uint8_t rd_wrb
Definition: ch_driver.h:106
uint8_t type
Definition: ch_driver.h:105
ch_dev_t * dev_ptr
Definition: ch_driver.h:110
Definition: icu_algo_info.h:10