Chirp SonicLib  4.5.2
ch_rangefinder_types.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_TYPES_H_
22 #define CH_RANGEFINDER_TYPES_H_
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include <stdint.h>
29 #include <invn/soniclib/soniclib.h>
30 
31 // total number of thresholds
32 #define CH101_COMMON_NUM_THRESHOLDS (6)
33 #define CHX01_COMMON_NUM_THRESHOLDS (6)
34 
35 #ifdef INCLUDE_SHASTA_SUPPORT
36 #define CH_NUM_THRESHOLDS (LEN_THRESH)
37 #elif defined(INCLUDE_WHITNEY_SUPPORT)
38 #define CH_NUM_THRESHOLDS (6)
39 #endif
40 
42 typedef struct {
43  ch_thresh_t threshold[CH_NUM_THRESHOLDS];
45 
46 typedef uint8_t (*ch_set_threshold_func_t)(ch_dev_t *dev_ptr, uint8_t threshold_index, uint16_t amplitude);
47 typedef uint16_t (*ch_get_threshold_func_t)(ch_dev_t *dev_ptr, uint8_t threshold_index);
48 typedef uint8_t (*ch_set_thresholds_func_t)(ch_dev_t *dev_ptr, ch_thresholds_t *thresh_ptr);
49 typedef uint8_t (*ch_get_thresholds_func_t)(ch_dev_t *dev_ptr, ch_thresholds_t *thresh_ptr);
50 typedef uint8_t (*ch_set_static_range_func_t)(ch_dev_t *dev_ptr, uint16_t static_range);
51 typedef uint8_t (*ch_set_rx_holdoff_func_t)(ch_dev_t *dev_ptr, uint16_t rx_holdoff);
52 typedef uint16_t (*ch_get_rx_holdoff_func_t)(ch_dev_t *dev_ptr);
53 typedef uint32_t (*ch_get_tof_us_func_t)(ch_dev_t *dev_ptr);
54 
55 typedef struct {
56  ch_set_threshold_func_t set_threshold;
57  ch_get_threshold_func_t get_threshold;
58  ch_set_thresholds_func_t set_thresholds;
59  ch_get_thresholds_func_t get_thresholds;
60  ch_set_static_range_func_t set_static_range;
61  ch_set_rx_holdoff_func_t set_rx_holdoff;
62  ch_get_rx_holdoff_func_t get_rx_holdoff;
63  ch_get_tof_us_func_t get_tof_us;
65 
67 typedef struct {
68  uint16_t static_range;
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* CH_RANGEFINDER_TYPES_H_ */
#define CH_NUM_THRESHOLDS
Definition: ch_rangefinder_types.h:36
SonicLib public API and support functions for TDK/InvenSense ultrasonic sensors (originally developed...
Chirp sensor device descriptor structure.
Definition: soniclib.h:732
Algorithm configuration.
Definition: ch_rangefinder_types.h:67
ch_thresholds_t * thresh_ptr
Definition: ch_rangefinder_types.h:70
uint16_t static_range
Definition: ch_rangefinder_types.h:68
Definition: ch_rangefinder_types.h:55
Detection threshold value.
Definition: soniclib.h:436
Multiple detection threshold structure.
Definition: ch_rangefinder_types.h:42