Chirp SonicLib  4.5.2
ch_rangefinder.h
Go to the documentation of this file.
1 
12 /*
13  Copyright 2016-2024, InvenSense, Inc. All rights reserved.
14 
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  DISCLAIMED.
19 
20  */
21 #ifndef CH_RANGEFINDER_H_
22 #define CH_RANGEFINDER_H_
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include <stdint.h>
29 #include <invn/soniclib/soniclib.h>
31 
32 // total number of thresholds
33 #define CH101_COMMON_NUM_THRESHOLDS (6)
34 #define CHX01_COMMON_NUM_THRESHOLDS (6)
35 
36 uint8_t ch_rangefinder_get_algo_config(const ch_dev_t *dev_ptr, ch_rangefinder_algo_config_t *config_ptr);
37 
38 uint8_t ch_rangefinder_set_algo_config(ch_dev_t *dev_ptr, const ch_rangefinder_algo_config_t *config_ptr);
39 
40 uint16_t ch_rangefinder_get_amplitude(ch_dev_t *dev_ptr);
41 
42 uint8_t ch_rangefinder_set_static_range(ch_dev_t *dev_ptr, uint16_t samples);
43 
44 uint8_t ch_rangefinder_set_thresholds(ch_dev_t *dev_ptr, ch_thresholds_t *thresholds_ptr);
45 uint8_t ch_rangefinder_get_thresholds(ch_dev_t *dev_ptr, ch_thresholds_t *thresh_buf_ptr);
46 
47 uint8_t ch_rangefinder_set_rx_holdoff(ch_dev_t *dev_ptr, uint16_t rx_holdoff);
48 uint16_t ch_rangefinder_get_rx_holdoff(ch_dev_t *dev_ptr);
49 
50 uint32_t ch_rangefinder_get_range(ch_dev_t *dev_ptr, ch_range_t range_type);
51 uint32_t ch_rangefinder_get_target_range(ch_dev_t *dev_ptr, uint8_t target_num, ch_range_t range_type);
52 
74 uint32_t ch_get_tof_us(ch_dev_t *dev_ptr);
75 
95 uint16_t ch_get_static_range(const ch_dev_t *dev_ptr);
96 
121 uint8_t ch_set_static_range(ch_dev_t *dev_ptr, uint16_t num_samples);
122 
136 uint8_t ch_get_num_targets(ch_dev_t *dev_ptr);
137 
165 uint32_t ch_get_target_range(ch_dev_t *dev_ptr, uint8_t target_num, ch_range_t range_type);
166 
184 uint16_t ch_get_target_amplitude(ch_dev_t *dev_ptr, uint8_t target_num);
185 
208 uint32_t ch_get_target_tof_us(ch_dev_t *dev_ptr, uint8_t target_num);
209 
217 uint8_t ch_is_target_in_ringdown(ch_dev_t *dev_ptr);
218 
237 uint16_t ch_get_threshold(ch_dev_t *dev_ptr, uint8_t threshold_index);
238 
260 uint8_t ch_set_threshold(ch_dev_t *dev_ptr, uint8_t threshold_index, uint16_t amplitude);
261 
285 uint8_t ch_get_thresholds(ch_dev_t *dev_ptr, ch_thresholds_t *thresh_ptr);
286 
321 uint8_t ch_set_thresholds(ch_dev_t *dev_ptr, ch_thresholds_t *thresh_ptr);
322 
337 uint8_t ch_get_num_thresholds(const ch_dev_t *dev_ptr);
338 
339 uint8_t ch_rangefinder_display_config_info(ch_dev_t *dev_ptr);
340 
341 #ifdef __cplusplus
342 }
343 #endif
344 
345 #endif /* CH_RANGEFINDER_H_ */
uint16_t ch_get_threshold(ch_dev_t *dev_ptr, uint8_t threshold_index)
Get the detection threshold.
Definition: ch_rangefinder.c:411
uint8_t ch_get_num_targets(ch_dev_t *dev_ptr)
Get the number of targets detected in last measurement.
Definition: ch_rangefinder.c:354
uint8_t ch_set_threshold(ch_dev_t *dev_ptr, uint8_t threshold_index, uint16_t amplitude)
Set the detection threshold.
Definition: ch_rangefinder.c:399
uint32_t ch_get_target_range(ch_dev_t *dev_ptr, uint8_t target_num, ch_range_t range_type)
Get the range to a specific target detected in last measurement.
Definition: ch_rangefinder.c:365
uint16_t ch_get_target_amplitude(ch_dev_t *dev_ptr, uint8_t target_num)
Get the amplitude for a specific target detected in last measurement.
Definition: ch_rangefinder.c:369
uint16_t ch_get_static_range(const ch_dev_t *dev_ptr)
Get static target rejection range setting.
Definition: ch_rangefinder.c:301
uint8_t ch_is_target_in_ringdown(ch_dev_t *dev_ptr)
Return if a target is detected near sensor (in the ringdown)
Definition: ch_rangefinder.c:390
uint8_t ch_set_thresholds(ch_dev_t *dev_ptr, ch_thresholds_t *thresh_ptr)
Set detection thresholds.
Definition: ch_rangefinder.c:423
uint32_t ch_get_tof_us(ch_dev_t *dev_ptr)
Get the measured time-of-flight from a sensor in microseconds.
Definition: ch_rangefinder.c:342
uint32_t ch_get_target_tof_us(ch_dev_t *dev_ptr, uint8_t target_num)
Get the measured time-of-flight for a specific target in microseconds.
Definition: ch_rangefinder.c:379
uint8_t ch_get_thresholds(ch_dev_t *dev_ptr, ch_thresholds_t *thresh_ptr)
Get detection thresholds.
Definition: ch_rangefinder.c:436
uint8_t ch_set_static_range(ch_dev_t *dev_ptr, uint16_t num_samples)
Configure static target rejection.
Definition: ch_rangefinder.c:306
uint8_t ch_get_num_thresholds(const ch_dev_t *dev_ptr)
Get number of detection thresholds.
Definition: ch_rangefinder.c:449
Internal driver types for operation with the Chirp ultrasonic sensor.
SonicLib public API and support functions for TDK/InvenSense ultrasonic sensors (originally developed...
ch_range_t
Range data types.
Definition: soniclib.h:218
Chirp sensor device descriptor structure.
Definition: soniclib.h:732
Algorithm configuration.
Definition: ch_rangefinder_types.h:67
Multiple detection threshold structure.
Definition: ch_rangefinder_types.h:42