Hat Yun is an environmental sensor hat that integrates SHT20, BMP280, and STM32 LED/Light controller.
More...
#include <unit_HatYun.hpp>
|
|
| HatYun (const uint8_t addr=DEFAULT_ADDRESS) |
| |
|
virtual bool | begin () override |
| |
|
virtual void | update (const bool force=false) override |
| |
|
|
config_t | config () const |
| | Gets the configuration.
|
| |
|
void | config (const config_t &cfg) |
| | Set the configuration.
|
| |
|
|
uint16_t | light () const |
| | Oldest light sensor value.
|
| |
|
| bool | startPeriodicMeasurement (const uint32_t interval=1000) |
| | Start periodic light sensor polling.
|
| |
| bool | stopPeriodicMeasurement () |
| | Stop periodic light sensor polling.
|
| |
|
- Note
- LED heat affects SHT20/BMP280 temperature readings due to the compact Hat form factor. Consider lowering brightness or turning off LEDs when accurate temperature measurement is required.
|
| bool | writeLED (const uint8_t num, const uint8_t r, const uint8_t g, const uint8_t b) |
| | Write a single LED color.
|
| |
| bool | writeAllLED (const uint8_t r, const uint8_t g, const uint8_t b) |
| | Write all LEDs to the same color.
|
| |
| bool | writeRainbow (const uint8_t offset=0, const uint8_t brightness=255) |
| | Write rainbow pattern across all LEDs.
|
| |
|
| bool | readLight (uint16_t &value) |
| | Read light sensor value.
|
| |
|
|
UnitSHT20 | sht20 |
| | SHT20 instance (temperature/humidity)
|
| |
|
UnitBMP280 | bmp280 |
| | BMP280 instance (pressure)
|
| |
|
|
bool | start_periodic_measurement (const uint32_t interval) |
| |
|
bool | stop_periodic_measurement () |
| |
|
bool | read_measurement (hatyun::Data &d) |
| |
|
| M5_UNIT_COMPONENT_PERIODIC_MEASUREMENT_ADAPTER_HPP_BUILDER (HatYun, hatyun::Data) |
| |
|
virtual std::shared_ptr< Adapter > | ensure_adapter (const uint8_t ch) |
| |
Hat Yun is an environmental sensor hat that integrates SHT20, BMP280, and STM32 LED/Light controller.
Holds SHT20 (temp/humidity) and BMP280 (pressure) as child components. The STM32-based LED/light controller (I2C 0x38) is accessed directly by this class. Supported boards: M5StickC / M5StickCPlus / M5StickCPlus2
◆ readLight()
| bool m5::unit::HatYun::readLight |
( |
uint16_t & | value | ) |
|
Read light sensor value.
- Parameters
-
| [out] | value | Light sensor value (16-bit) |
- Returns
- True if successful
◆ startPeriodicMeasurement()
| bool m5::unit::HatYun::startPeriodicMeasurement |
( |
const uint32_t | interval = 1000 | ) |
|
|
inline |
Start periodic light sensor polling.
- Parameters
-
| interval | Polling interval in ms (default 1000) |
- Returns
- True if successful
◆ stopPeriodicMeasurement()
| bool m5::unit::HatYun::stopPeriodicMeasurement |
( |
| ) |
|
|
inline |
Stop periodic light sensor polling.
- Returns
- True if successful
◆ writeAllLED()
| bool m5::unit::HatYun::writeAllLED |
( |
const uint8_t | r, |
|
|
const uint8_t | g, |
|
|
const uint8_t | b ) |
Write all LEDs to the same color.
- Parameters
-
| r | Red (0-255) |
| g | Green (0-255) |
| b | Blue (0-255) |
- Returns
- True if successful
◆ writeLED()
| bool m5::unit::HatYun::writeLED |
( |
const uint8_t | num, |
|
|
const uint8_t | r, |
|
|
const uint8_t | g, |
|
|
const uint8_t | b ) |
Write a single LED color.
- Parameters
-
| num | LED index (0-13) |
| r | Red (0-255) |
| g | Green (0-255) |
| b | Blue (0-255) |
- Returns
- True if successful
◆ writeRainbow()
| bool m5::unit::HatYun::writeRainbow |
( |
const uint8_t | offset = 0, |
|
|
const uint8_t | brightness = 255 ) |
Write rainbow pattern across all LEDs.
- Parameters
-
| offset | Hue offset (0-255) for animation |
| brightness | Brightness (0-255) |
- Returns
- True if successful