Skip to content

Commit a96b9b7

Browse files
committed
Add esp32c3 chip support
1 parent 5184e02 commit a96b9b7

File tree

14 files changed

+3015
-0
lines changed

14 files changed

+3015
-0
lines changed

project/esp32c3/.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Prerequisites
2+
*.d
3+
4+
# Compiled Object files
5+
*.slo
6+
*.lo
7+
*.o
8+
*.obj
9+
10+
# Precompiled Headers
11+
*.gch
12+
*.pch
13+
14+
# Compiled Dynamic libraries
15+
*.so
16+
*.dylib
17+
*.dll
18+
19+
# Fortran module files
20+
*.mod
21+
*.smod
22+
23+
# Compiled Static libraries
24+
*.lai
25+
*.la
26+
*.a
27+
*.lib
28+
29+
# Executables
30+
*.exe
31+
*.out
32+
*.app
33+
34+
# Build file
35+
build

project/esp32c3/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The following lines of boilerplate have to be in your project's
2+
# CMakeLists in this exact order for cmake to work correctly
3+
cmake_minimum_required(VERSION 3.5)
4+
5+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
project(PPG_sharer)

project/esp32c3/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
3+
# project subdirectory.
4+
#
5+
6+
PROJECT_NAME := max30102
7+
8+
include $(IDF_PATH)/make/project.mk

project/esp32c3/README.md

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,290 @@
1+
### 1. chip
2+
3+
#### 1.1 chip info
4+
5+
chip name : ESP32-C3.
6+
7+
extern oscillator : 8MHz.
8+
9+
iic pin: SCL/SDA GPIO2/GPIO3.
10+
11+
gpio pin: INT GPIO7.
12+
13+
### 2. shell
14+
15+
#### 2.1 shell parameter
16+
17+
baud rate: 115200
18+
19+
data bits : 8
20+
21+
stop bits: 1
22+
23+
parity: none
24+
25+
flow control: none
26+
27+
### 3. max30102
28+
29+
#### 3.1 command Instruction
30+
31+
​ max30102 is a basic command which can test all max30102 driver function:
32+
33+
​ -i show max30102 chip and driver information.
34+
35+
​ -h show max30102 help.
36+
37+
​ -p show max30102 pin connections of the current board.
38+
39+
​ -t (reg | fifo <times>)
40+
41+
​ -t reg run max30102 register test.
42+
43+
​ -t fifo <times> run max30102 fifo test. times means test times.
44+
45+
​ -c fifo <times> run max30102 fifo function. times means read times.
46+
47+
#### 3.2 command example
48+
49+
```shell
50+
esp32c3> max30102 -i
51+
52+
max30102: chip is Maxim Integrated MAX30102.
53+
max30102: manufacturer is Maxim Integrated.
54+
max30102: interface is IIC.
55+
max30102: driver version is 1.0.
56+
max30102: min supply voltage is 1.7V.
57+
max30102: max supply voltage is 2.0V.
58+
max30102: max current is 20.00mA.
59+
max30102: max temperature is 85.0C.
60+
max30102: min temperature is -40.0C.
61+
```
62+
63+
```shell
64+
esp32c3> max30102 -p
65+
66+
max30102: SCL connected to GPIO3(BCM).
67+
max30102: SDA connected to GPIO2(BCM).
68+
max30102: INT connected to GPIO17(BCM).
69+
```
70+
71+
```shell
72+
esp32c3> max30102 -t reg
73+
74+
max30102: chip is Maxim Integrated MAX30102.
75+
max30102: manufacturer is Maxim Integrated.
76+
max30102: interface is IIC.
77+
max30102: driver version is 1.0.
78+
max30102: min supply voltage is 1.7V.
79+
max30102: max supply voltage is 2.0V.
80+
max30102: max current is 20.00mA.
81+
max30102: max temperature is 85.0C.
82+
max30102: min temperature is -40.0C.
83+
max30102: start register test.
84+
I (40327) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
85+
I (40327) gpio: GPIO[3]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
86+
I (40327) max30102: max30102_interface_iic_init:init success!SCL:2,SDA:3
87+
88+
max30102: max30102_set_interrupt/max30102_get_interrupt test.
89+
max30102: enable fifo full.
90+
max30102: check interrupt ok.
91+
max30102: disable fifo full.
92+
max30102: check interrupt ok.
93+
max30102: enable ppg ready.
94+
max30102: check interrupt ok.
95+
max30102: disable ppg ready.
96+
max30102: check interrupt ok.
97+
max30102: enable alc ovf.
98+
max30102: check interrupt ok.
99+
max30102: disable alc ovf.
100+
max30102: check interrupt ok.
101+
max30102: enable die temp ready.
102+
max30102: check interrupt ok.
103+
max30102: disable die temp ready.
104+
max30102: check interrupt ok.
105+
max30102: max30102_set_fifo_write_pointer/max30102_get_fifo_write_pointer test.
106+
max30102: set fifo write pointer 2.
107+
max30102: max30102_set_fifo_overflow_counter/max30102_get_fifo_overflow_counter test.
108+
max30102: set fifo overflow counter 8.
109+
max30102: max30102_set_fifo_read_pointer/max30102_get_fifo_read_pointer test.
110+
max30102: set fifo read pointer 4.
111+
max30102: max30102_set_fifo_data/max30102_get_fifo_data test.
112+
max30102: set fifo data 25.
113+
max30102: max30102_set_fifo_sample_averaging/max30102_get_fifo_sample_averaging test.
114+
max30102: set sample averaging 1.
115+
max30102: check sample ok.
116+
max30102: set sample averaging 2.
117+
max30102: check sample ok.
118+
max30102: set sample averaging 4.
119+
max30102: check sample ok.
120+
max30102: set sample averaging 8.
121+
max30102: check sample ok.
122+
max30102: set sample averaging 16.
123+
max30102: check sample ok.
124+
max30102: set sample averaging 32.
125+
max30102: check sample ok.
126+
max30102: max30102_set_fifo_roll/max30102_get_fifo_roll test.
127+
max30102: enable fifo roll.
128+
max30102: check roll ok.
129+
max30102: disable fifo roll.
130+
max30102: check roll ok.
131+
max30102: max30102_set_fifo_almost_full/max30102_get_fifo_almost_full test.
132+
max30102: set fifo almost full 0.
133+
max30102: check fifo almost full ok.
134+
max30102: max30102_set_shutdown/max30102_get_shutdown test.
135+
max30102: enable shutdown.
136+
max30102: check shutdown ok.
137+
max30102: disable shutdown.
138+
max30102: check shutdown ok.
139+
max30102: max30102_set_mode/max30102_get_mode test.
140+
max30102: set heart rate mode.
141+
max30102: check mode ok.
142+
max30102: set spo2 mode.
143+
max30102: check mode ok.
144+
max30102: set multi led mode.
145+
max30102: check mode ok.
146+
max30102: max30102_set_spo2_adc_range/max30102_get_spo2_adc_range test.
147+
max30102: set spo2 adc range 2048.
148+
max30102: check spo2 adc range ok.
149+
max30102: set spo2 adc range 4096.
150+
max30102: check spo2 adc range ok.
151+
max30102: set spo2 adc range 8192.
152+
max30102: check spo2 adc range ok.
153+
max30102: set spo2 adc range 16384.
154+
max30102: check spo2 adc range ok.
155+
max30102: max30102_set_spo2_sample_rate/max30102_get_spo2_sample_rate test.
156+
max30102: set spo2 sample rate 50Hz.
157+
max30102: check spo2 sample rate ok.
158+
max30102: set spo2 sample rate 100Hz.
159+
max30102: check spo2 sample rate ok.
160+
max30102: set spo2 sample rate 200Hz.
161+
max30102: check spo2 sample rate ok.
162+
max30102: set spo2 sample rate 400Hz.
163+
max30102: check spo2 sample rate ok.
164+
max30102: set spo2 sample rate 800Hz.
165+
max30102: check spo2 sample rate ok.
166+
max30102: set spo2 sample rate 1000Hz.
167+
max30102: check spo2 sample rate ok.
168+
max30102: set spo2 sample rate 1600Hz.
169+
max30102: check spo2 sample rate ok.
170+
max30102: set spo2 sample rate 3200Hz.
171+
max30102: check spo2 sample rate ok.
172+
max30102: max30102_set_adc_resolution/max30102_get_adc_resolution test.
173+
max30102: set adc resolution 15 bits.
174+
max30102: check adc resolution ok.
175+
max30102: set adc resolution 16 bits.
176+
max30102: check adc resolution ok.
177+
max30102: set adc resolution 17 bits.
178+
max30102: check adc resolution ok.
179+
max30102: set adc resolution 18 bits.
180+
max30102: check adc resolution ok.
181+
max30102: max30102_set_led_red_pulse_amplitude/max30102_get_led_red_pulse_amplitude test.
182+
max30102: set led red pulse amplitude 180.
183+
max30102: check led red pulse amplitude ok.
184+
max30102: max30102_set_led_ir_pulse_amplitude/max30102_get_led_ir_pulse_amplitude test.
185+
max30102: set led ir pulse amplitude 120.
186+
max30102: check led ir pulse amplitude ok.
187+
max30102: max30102_set_slot/max30102_get_slot test.
188+
max30102: set slot1 led none.
189+
max30102: check slot1 ok.
190+
max30102: set slot1 led red.
191+
max30102: check slot1 ok.
192+
max30102: set slot1 led ir.
193+
max30102: check slot1 ok.
194+
max30102: set slot2 led none.
195+
max30102: check slot2 ok.
196+
max30102: set slot2 led red.
197+
max30102: check slot2 ok.
198+
max30102: set slot2 led ir.
199+
max30102: check slot2 ok.
200+
max30102: set slot3 led none.
201+
max30102: check slot3 ok.
202+
max30102: set slot3 led red.
203+
max30102: check slot3 ok.
204+
max30102: set slot3 led ir.
205+
max30102: check slot3 ok.
206+
max30102: set slot4 led none.
207+
max30102: check slot4 ok.
208+
max30102: set slot4 led red.
209+
max30102: check slot4 ok.
210+
max30102: set slot4 led ir.
211+
max30102: check slot4 ok.
212+
max30102: max30102_set_die_temperature/max30102_get_die_temperature test.
213+
max30102: disable die temperature.
214+
max30102: check die temperature ok.
215+
max30102: enable die temperature.
216+
max30102: check die temperature ok.
217+
max30102: max30102_get_id test.
218+
max30102: revision id is 0x03 part id is 0x15.
219+
max30102: max30102_get_interrupt_status test.
220+
max30102: interrupt status fifo full is 0.
221+
max30102: interrupt status ppg ready is 0.
222+
max30102: interrupt status alc ovf is 0.
223+
max30102: interrupt status pwr ready is 0.
224+
max30102: interrupt status die temp ready is 0.
225+
max30102: max30102_reset test.
226+
max30102: check reset ok.
227+
max30102: finish register test.
228+
```
229+
230+
```shell
231+
esp32c3> max30102 -t fifo 3
232+
233+
I (68257) gpio: GPIO[7]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
234+
Minimum free heap size: 293568 bytes
235+
max30102: chip is Maxim Integrated MAX30102.
236+
max30102: manufacturer is Maxim Integrated.
237+
max30102: interface is IIC.
238+
max30102: driver version is 1.0.
239+
max30102: min supply voltage is 1.7V.
240+
max30102: max supply voltage is 2.0V.
241+
max30102: max current is 20.00mA.
242+
max30102: max temperature is 85.0C.
243+
max30102: min temperature is -40.0C.
244+
max30102: start fifo test.
245+
I (68257) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
246+
I (68257) gpio: GPIO[3]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
247+
I (68267) max30102: max30102_interface_iic_init:init success!SCL:2,SDA:3
248+
249+
max30102: irq die temp rdy.
250+
max30102: temperature is 27.2500C.
251+
max30102: irq fifo full with 17.
252+
max30102: irq fifo full with 17.
253+
max30102: irq fifo full with 17.
254+
max30102: finish fifo test.
255+
```
256+
257+
```shell
258+
esp32c3> max30102 -c fifo 3
259+
260+
I (89147) gpio: GPIO[7]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:2
261+
Minimum free heap size: 288956 bytes
262+
I (89147) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
263+
I (89147) gpio: GPIO[3]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
264+
I (89147) max30102: max30102_interface_iic_init:init success!SCL:2,SDA:3
265+
266+
max30102: irq fifo full with 17.
267+
max30102: 1/3.
268+
max30102: irq fifo full with 17.
269+
max30102: 2/3.
270+
max30102: irq fifo full with 17.
271+
max30102: 3/3.
272+
```
273+
274+
```shell
275+
esp32c3> max30102 -h
276+
277+
max30102 -i
278+
show max30102 chip and driver information.
279+
max30102 -h
280+
show max30102 help.
281+
max30102 -p
282+
show max30102 pin connections of the current board.
283+
max30102 -t reg
284+
run max30102 register test.
285+
max30102 -t fifo <times>
286+
run max30102 fifo test.times means test times.
287+
max30102 -c fifo <times>
288+
run max30102 fifo function.times means read times.
289+
```
290+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set(src_files
2+
"../../../../src/driver_max30102.c"
3+
"interface/driver_max30102_interface_esp32.c"
4+
"../../../../test/driver_max30102_fifo_test.c"
5+
"../../../../test/driver_max30102_register_test.c"
6+
"../../../../example/driver_max30102_fifo.c"
7+
8+
)
9+
10+
set(include_files
11+
"../../../../src"
12+
"../../../../interface"
13+
"../../../../test"
14+
"../../../../example"
15+
)
16+
17+
idf_component_register(SRCS ${src_files}
18+
INCLUDE_DIRS ${include_files}
19+
REQUIRES driver
20+
)

0 commit comments

Comments
 (0)