Skip to content

Commit bdf3268

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

File tree

14 files changed

+3013
-0
lines changed

14 files changed

+3013
-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(max30102)

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