Chirp SonicLib  4.5.2
ch101_gpr.h
Go to the documentation of this file.
1 
13 /*
14  Copyright 2016-2023, InvenSense, Inc. All rights reserved.
15 
16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  DISCLAIMED.
20 
21  */
22 
23 #ifndef CH101_GPR_H_
24 #define CH101_GPR_H_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #include <stdint.h>
31 #include "ch101.h"
33 #include <invn/soniclib/soniclib.h>
34 
35 /* GPR firmware registers */
36 #define CH101_GPR_REG_OPMODE 0x01
37 #define CH101_GPR_REG_TICK_INTERVAL 0x02
38 #define CH101_GPR_REG_IN_RINGDOWN_IDX 0x04
39 #define CH101_GPR_REG_PERIOD 0x05
40 #define CH101_GPR_REG_CAL_TRIG 0x06
41 #define CH101_GPR_REG_CAL_TRIG 0x06
42 #define CH101_GPR_REG_MAX_RANGE 0x07
43 #define CH101_GPR_REG_IN_RINGDOWN_THS 0x08
44 #define CH101_GPR_REG_REV_CYCLES 0x0C
45 #define CH101_GPR_REG_DCO_PERIOD 0x0E
46 #define CH101_GPR_REG_ST_RANGE 0x12
47 #define CH101_GPR_REG_READY 0x14
48 #define CH101_GPR_REG_IN_RINGDOWN 0x15
49 #define CH101_GPR_REG_TOF_SF 0x16
50 #define CH101_GPR_REG_TOF 0x18
51 #define CH101_GPR_REG_AMPLITUDE 0x1A
52 #define CH101_GPR_REG_CAL_RESULT 0x0A
53 #define CH101_GPR_REG_DATA 0x1C
54 
55 #define CH101_GPR_MAX_SAMPLES (225)
56 
57 extern const char *ch101_gpr_version; // version string in fw .c file
58 extern const uint8_t ch101_gpr_fw_text[];
59 extern const uint8_t ch101_gpr_fw_vec[];
60 extern const uint16_t ch101_gpr_text_size;
61 extern const uint16_t ch101_gpr_vec_size;
62 
63 uint16_t get_ch101_gpr_fw_ram_init_addr(void);
64 uint16_t get_ch101_gpr_fw_ram_init_size(void);
65 
66 const unsigned char *get_ram_ch101_gpr_init_ptr(void);
67 
68 uint8_t ch101_gpr_init(ch_dev_t *dev_ptr, fw_info_t **fw_info);
69 
86 
96 uint16_t ch101_gpr_get_in_ringdown_ths(ch_dev_t *dev_ptr);
97 
107 void ch101_gpr_set_in_ringdown_ths(ch_dev_t *dev_ptr, uint16_t in_ringdown_ths);
108 
121 uint8_t ch101_gpr_get_in_ringdown_idx(ch_dev_t *dev_ptr);
122 
131 void ch101_gpr_set_in_ringdown_idx(ch_dev_t *dev_ptr, uint8_t in_ringdown_idx);
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif
Internal definitions for the Chirp CH101 ultrasonic sensor.
uint8_t ch101_gpr_get_in_ringdown_idx(ch_dev_t *dev_ptr)
Get the sample index that defines the "in ringdown" region.
Definition: ch101_gpr.c:109
uint16_t ch101_gpr_get_in_ringdown_ths(ch_dev_t *dev_ptr)
Get the amplitude threshold for "in ringdown" detection.
Definition: ch101_gpr.c:97
void ch101_gpr_set_in_ringdown_idx(ch_dev_t *dev_ptr, uint8_t in_ringdown_idx)
Set the sample index for "in ringdown" status.
Definition: ch101_gpr.c:117
void ch101_gpr_set_in_ringdown_ths(ch_dev_t *dev_ptr, uint16_t in_ringdown_ths)
Set the amplitude threshold "in ringdown" status.
Definition: ch101_gpr.c:105
uint8_t ch101_gpr_get_target_in_ringdown(ch_dev_t *dev_ptr)
Get the target "in ringdown" status.
Definition: ch101_gpr.c:89
Internal driver functions for operation with the Chirp ultrasonic sensor.
SonicLib public API and support functions for TDK/InvenSense ultrasonic sensors (originally developed...
Chirp sensor device descriptor structure.
Definition: soniclib.h:732
Definition: soniclib.h:658