first commit

This commit is contained in:
stuce-bot 2025-06-30 20:47:33 +02:00
commit 5893b00dd2
1669 changed files with 1982740 additions and 0 deletions

View file

@ -0,0 +1,9 @@
/*
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
/*
Example of using only unit component without UnitUnified manager
*/
#include "main/ComponentOnly.cpp"

View file

@ -0,0 +1,25 @@
# M5UnitUnified example
## ComponentOnly
### Overview
This is an example of using only the component of unit without the management mechanism of the unit.
The source uses UnitCO2, so if you want to use other units, you will need to modify it accordingly.
### ArduinoIDE
Install each unit's library with the library manager.
### PlatformIO
For convenience of unit testing, the libraries for each unit are registered in lib\_deps.
Use the env of the applicable Core device.
---
### 概要
ユニットの管理機構を使わず、各ユニットのコンポーネントのみで使用する例です。
ソースでは UnitCO2 を使用していますので、他のユニットを使用する場合は適宜変更が必要です。
### ArduinoIDE
各ユニットのライブラリをライブラリマネージャでインストールしてください。
### PlatformIO
ユニットテストの都合上、各ユニット毎のライブラリは lib\_deps に登録されています
該当する Core デバイスの env を使用しください。

View file

@ -0,0 +1,41 @@
/*
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
/*
Example of using only unit component without UnitUnified manager
If you use other units, change include files(*1), instances(*2), and get values(*3)
*/
#include <M5Unified.h>
#include <M5UnitUnified.h>
#include <M5UnitUnifiedENV.h> // *1 Include the header of the unit to be used
m5::unit::UnitCO2 unit; // *2 Instance of the unit
void setup()
{
M5.begin();
auto pin_num_sda = M5.getPin(m5::pin_name_t::port_a_sda);
auto pin_num_scl = M5.getPin(m5::pin_name_t::port_a_scl);
M5_LOGI("getPin: SDA:%u SCL:%u", pin_num_sda, pin_num_scl);
Wire.begin(pin_num_sda, pin_num_scl, 400 * 1000U);
M5.Display.clear(TFT_DARKGREEN);
if (!unit.assign(Wire) // Assign Wire
|| unit.begin()) { // Begin unit
M5_LOGE("Failed to assign/begin");
M5.Display.clear(TFT_RED);
}
}
void loop()
{
M5.update();
unit.update(); // Explicitly call unit.update() yourself
if (unit.updated()) {
// *3 Obtaining unit-specific measurements
M5_LOGI("CO2:%u Temp:%f Hum:%f", unit.co2(), unit.temperature(), unit.humidity());
}
}