Skip to content

Commit 05c3b01

Browse files
committed
Merge branch 'develop'
2 parents 70607f7 + bfa1add commit 05c3b01

40 files changed

+5237
-880
lines changed

.github/workflows/arduino-esp-v2-build-check.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- PlotToSerial
6161

6262
unit:
63-
- ''
63+
- UnitHeart
6464

6565
board:
6666
- m5stack-atom
@@ -80,6 +80,16 @@ jobs:
8080
archi:
8181
- esp32
8282

83+
include:
84+
# Specific sketches
85+
- sketch: GraphicalMeter
86+
unit: UnitHeart
87+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
88+
platform: esp32
89+
archi: esp32
90+
platform-version: 2.0.17
91+
board: m5stack-core-esp32
92+
8393
steps:
8494
- name: Checkout
8595
uses: actions/checkout@v4

.github/workflows/arduino-esp-v3-build-check.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- PlotToSerial
6161

6262
unit:
63-
- ''
63+
- UnitHeart
6464

6565
board:
6666
- m5stack_atom
@@ -97,6 +97,56 @@ jobs:
9797
archi:
9898
- esp32
9999

100+
include:
101+
# Specific sketches
102+
- sketch: PlotToSerial
103+
unit: HatHeart
104+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
105+
platform: esp32
106+
archi: esp32
107+
platform-version: 3.0.4
108+
board: m5stack_stickc_plus
109+
- sketch: PlotToSerial
110+
unit: HatHeart
111+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
112+
platform: esp32
113+
archi: esp32
114+
platform-version: 3.0.4
115+
board: m5stack_stickc_plus2
116+
- sketch: GraphicalMeter
117+
unit: UnitHeart
118+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
119+
platform: esp32
120+
archi: esp32
121+
platform-version: 3.0.4
122+
board: m5stack_core
123+
- sketch: GraphicalMeter
124+
unit: HatHeart
125+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
126+
platform: esp32
127+
archi: esp32
128+
platform-version: 3.0.4
129+
board: m5stack_stickc_plus
130+
- sketch: GraphicalMeter
131+
unit: HatHeart
132+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
133+
platform: esp32
134+
archi: esp32
135+
platform-version: 3.0.4
136+
board: m5stack_stickc_plus2
137+
- sketch: DualSensor
138+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
139+
platform: esp32
140+
archi: esp32
141+
platform-version: 3.0.4
142+
board: m5stack_stickc_plus
143+
- sketch: DualSensor
144+
platform-url: https://espressif.github.io/arduino-esp32/package_esp32_index.json
145+
platform: esp32
146+
archi: esp32
147+
platform-version: 3.0.4
148+
board: m5stack_stickc_plus2
149+
100150
steps:
101151
- name: Checkout
102152
uses: actions/checkout@v4

.github/workflows/arduino-m5-build-check.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- PlotToSerial
6161

6262
unit:
63-
- ''
63+
- UnitHeart
6464

6565
board:
6666
- m5stack_atom
@@ -98,6 +98,56 @@ jobs:
9898
archi:
9999
- esp32
100100

101+
include:
102+
# Specific sketches
103+
- sketch: PlotToSerial
104+
unit: HatHeart
105+
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
106+
platform: m5stack
107+
archi: esp32
108+
platform-version: 2.1.2
109+
board: m5stack_stickc_plus
110+
- sketch: PlotToSerial
111+
unit: HatHeart
112+
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
113+
platform: m5stack
114+
archi: esp32
115+
platform-version: 2.1.2
116+
board: m5stack_stickc_plus2
117+
- sketch: GraphicalMeter
118+
unit: UnitHeart
119+
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
120+
platform: m5stack
121+
archi: esp32
122+
platform-version: 2.1.2
123+
board: m5stack_core
124+
- sketch: GraphicalMeter
125+
unit: HatHeart
126+
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
127+
platform: m5stack
128+
archi: esp32
129+
platform-version: 2.1.2
130+
board: m5stack_stickc_plus
131+
- sketch: GraphicalMeter
132+
unit: HatHeart
133+
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
134+
platform: m5stack
135+
archi: esp32
136+
platform-version: 2.1.2
137+
board: m5stack_stickc_plus2
138+
- sketch: DualSensor
139+
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
140+
platform: m5stack
141+
archi: esp32
142+
platform-version: 2.1.2
143+
board: m5stack_stickc_plus
144+
- sketch: DualSensor
145+
platform-url: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
146+
platform: m5stack
147+
archi: esp32
148+
platform-version: 2.1.2
149+
board: m5stack_stickc_plus2
150+
101151
steps:
102152
- name: Checkout
103153
uses: actions/checkout@v4

.github/workflows/platformio-build-check.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- PlotToSerial
5757

5858
unit:
59-
- ''
59+
- UnitHeart
6060

6161
board:
6262
- Core
@@ -112,6 +112,43 @@ jobs:
112112
# - board: Paper
113113
# espressif32: '4_4_0'
114114

115+
include:
116+
# Specific sketches
117+
- example: PlotToSerial
118+
unit: HatHeart
119+
board: StickCPlus
120+
framework: Arduino
121+
espressif32: latest
122+
- example: PlotToSerial
123+
unit: HatHeart
124+
board: StickCPlus2
125+
framework: Arduino
126+
espressif32: latest
127+
- example: GraphicalMeter
128+
unit: UnitHeart
129+
board: Core
130+
framework: Arduino
131+
espressif32: latest
132+
- example: GraphicalMeter
133+
unit: HatHeart
134+
board: StickCPlus
135+
framework: Arduino
136+
espressif32: latest
137+
- example: GraphicalMeter
138+
unit: HatHeart
139+
board: StickCPlus2
140+
framework: Arduino
141+
espressif32: latest
142+
- example: DualSensor
143+
board: StickCPlus
144+
framework: Arduino
145+
espressif32: latest
146+
- example: DualSensor
147+
board: StickCPlus2
148+
framework: Arduino
149+
espressif32: latest
150+
151+
115152
steps:
116153
- name: Checkout
117154
uses: actions/checkout@v4

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ MAX30100 is a complete pulse oximetry and heart-rate sensor system solution desi
1313

1414
The MAX30100 provides very small total solution size without sacrificing optical or electrical performance. Minimal external hardware components are needed for integration into a wearable device.
1515

16+
### SKU:U118
17+
18+
HEART RATE HAT is a blood oxygen heart rate sensor. Integrate MAX30102 to provide a complete pulse oximeter and heart rate sensor system solution. This is a non-pluggable blood oxygen heart rate sensor. The sensor uses I2C communication interface, internally integrates infrared light-emitting diodes, photo-detectors, optical components and low-noise electronic equipment. A certain amount of ambient light suppression function can make the measurement results more accurate. .
19+
1620

1721
## Related Link
1822
See also examples using conventional methods here.
1923

2024
- [Unit HEART & Datasheet](https://docs.m5stack.com/ja/unit/heart)
25+
- [Hat Heart & Datasheet](https://docs.m5stack.com/en/hat/hat_heart_rate)
2126

2227
## Required Libraries:
2328

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
/*
7+
Example of using M5UnitUnified to connect both UnitHeart and HatHeart
8+
*/
9+
#include "main/DualSensor.cpp"
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
/*
7+
Example of using M5UnitUnified to connect both UnitHeart and HatHeart
8+
*/
9+
#include <M5Unified.h>
10+
#include <M5UnitUnified.h>
11+
#include <M5UnitUnifiedHEART.h>
12+
#include <Wire.h>
13+
#include "../src/view.hpp"
14+
15+
namespace {
16+
auto& lcd = M5.Display;
17+
m5::unit::UnitUnified Units;
18+
m5::unit::UnitHeart unit;
19+
m5::unit::HatHeart hat;
20+
21+
View* view[2]{};
22+
23+
} // namespace
24+
25+
using namespace m5::unit::max30102;
26+
27+
void setup()
28+
{
29+
// Configuration for using Wire1
30+
auto m5cfg = M5.config();
31+
m5cfg.pmic_button = false; // Disable BtnPWR
32+
m5cfg.internal_imu = false; // Disable internal IMU
33+
m5cfg.internal_rtc = false; // Disable internal RTC
34+
M5.begin(m5cfg);
35+
36+
auto board = M5.getBoard();
37+
if (board != m5::board_t::board_M5StickCPlus && board != m5::board_t::board_M5StickCPlus2) {
38+
M5_LOGE("Example for StickCPlus/CPlus2");
39+
lcd.clear(TFT_RED);
40+
while (true) {
41+
m5::utility::delay(10000);
42+
}
43+
}
44+
45+
// The screen shall be in landscape mode
46+
if (lcd.height() > lcd.width()) {
47+
lcd.setRotation(1);
48+
}
49+
50+
// Setup required to use HatHEART
51+
pinMode(25, INPUT_PULLUP);
52+
pinMode(26, OUTPUT);
53+
54+
// Wire settings
55+
auto pin_num_sda = M5.getPin(m5::pin_name_t::port_a_sda);
56+
auto pin_num_scl = M5.getPin(m5::pin_name_t::port_a_scl);
57+
Wire.end();
58+
Wire.begin(pin_num_sda, pin_num_scl, 400 * 1000U);
59+
60+
Wire1.end();
61+
Wire1.begin(0, 26, 400 * 1000U);
62+
63+
// UnitHeart connected to GROOVE with Wire
64+
// HatHeart connected to PIN sockect with Wire1
65+
if (!Units.add(unit, Wire) || !Units.add(hat, Wire1) || !Units.begin()) {
66+
M5_LOGE("Failed to begin");
67+
lcd.clear(TFT_RED);
68+
while (true) {
69+
m5::utility::delay(10000);
70+
}
71+
}
72+
73+
M5_LOGI("M5UnitUnified has been begun");
74+
M5_LOGI("%s", Units.debugInfo().c_str());
75+
76+
lcd.startWrite();
77+
78+
view[0] = new View(lcd.width() >> 1, lcd.height(), true);
79+
view[1] = new View(lcd.width() >> 1, lcd.height(), false);
80+
view[0]->_monitor.setSamplingRate(unit.caluculateSamplingRate());
81+
view[1]->_monitor.setSamplingRate(hat.caluculateSamplingRate());
82+
view[0]->push(&lcd, lcd.width() >> 1, 0);
83+
view[1]->push(&lcd, 0, 0);
84+
}
85+
86+
void loop()
87+
{
88+
M5.update();
89+
Units.update();
90+
91+
if (unit.updated()) {
92+
if (unit.overflow()) {
93+
M5_LOGW("OVERFLOW U:%u", unit.overflow());
94+
}
95+
while (unit.available()) {
96+
view[0]->push_back(unit.ir(), unit.red());
97+
view[0]->update();
98+
unit.discard();
99+
}
100+
view[0]->render();
101+
view[0]->push(&lcd, lcd.width() >> 1, 0);
102+
}
103+
104+
if (hat.updated()) {
105+
if (hat.overflow()) {
106+
M5_LOGW("OVERFLOW H:%u", hat.overflow());
107+
}
108+
while (hat.available()) {
109+
view[1]->push_back(hat.ir(), hat.red());
110+
view[1]->update();
111+
hat.discard();
112+
}
113+
view[1]->render();
114+
view[1]->push(&lcd, 0, 0);
115+
}
116+
117+
if (M5.BtnA.wasClicked()) {
118+
view[0]->clear();
119+
view[1]->clear();
120+
}
121+
}

0 commit comments

Comments
 (0)