10#ifndef M5_UNIT_WEIGHT_I2C_UNIT_MINISCALES_HPP
11#define M5_UNIT_WEIGHT_I2C_UNIT_MINISCALES_HPP
22class UnitMiniScales :
public UnitWeightI2C {
23 M5_UNIT_COMPONENT_HPP_BUILDER(UnitMiniScales, 0x26);
38 virtual ~UnitMiniScales()
42 virtual void update(
const bool force =
false)
override;
82 return writeLEDColor((rgb32 >> 16) & 0xFF, (rgb32 >> 8) & 0xFF, rgb32 & 0xFF);
97 bool writeLEDColor(
const uint8_t r,
const uint8_t g,
const uint8_t b);
124 return _button && (_button != _prev_button);
133 return !_button && (_button != _prev_button);
138 bool _button{}, _prev_button{};
142namespace miniscales {
146constexpr uint8_t BUTTON_REG {0x20};
147constexpr uint8_t RGB_LED_REG {0x30};
bool readButtonStatus(bool &press)
Read the button status.
Definition unit_MiniScales.cpp:85
bool readLEDColor(uint32_t &rgb32)
Read the LED color as RGB32 (00RRGGBB HEX)
Definition unit_MiniScales.cpp:34
bool isPressed() const
Is button pressed?
Definition unit_MiniScales.hpp:113
void config(const config_t &cfg)
Set the configration.
Definition unit_MiniScales.hpp:52
config_t config()
Gets the configration.
Definition unit_MiniScales.hpp:47
bool wasPressed() const
Was button pressed?
Definition unit_MiniScales.hpp:122
bool writeLEDColor(const uint32_t rgb32)
Write the LED color as RGB32 (00RRGGBB HEX)
Definition unit_MiniScales.hpp:80
bool wasReleased()
Is button released?
Definition unit_MiniScales.hpp:131
WeightI2C unit.
Definition unit_WeightI2C.hpp:56
config_t config()
Gets the configration.
Definition unit_WeightI2C.hpp:96
Top level namespace of M5stack.
Settings for begin.
Definition unit_MiniScales.hpp:30
bool manage_button_status
Manage button status with update?
Definition unit_MiniScales.hpp:32
Settings for begin.
Definition unit_WeightI2C.hpp:64
WeightI2C Unit for M5UnitUnified.