SensorLib 0.5.0
Multi-platform sensor driver library for Arduino, PlatformIO, and ESP-IDF
Loading...
Searching...
No Matches
SY6970Led.cpp
Go to the documentation of this file.
1
30#include "../../../SensorBuildOpt.h"
31#if !SENSORLIB_EXCLUDE_PMIC_SY6970
32
33#include "SY6970Led.hpp"
34#include "SY6970Regs.hpp"
35
36using namespace SY6970Regs;
37
38SY6970Led::SY6970Led(SY6970Core &core) : _core(core) {}
39
41{
42 (void)type;
43 return false;
44}
45
47{
48 if (mode == Mode::DISABLE) {
49 return _core.updateBits(REG_CHG_CTRL, MASK_STAT_DIS, MASK_STAT_DIS) >= 0;
50 } else if (mode == Mode::AUTO) {
51 return _core.updateBits(REG_CHG_CTRL, MASK_STAT_DIS, 0) >= 0;
52 }
53 return false;
54}
55
57{
58 int val = _core.readReg(REG_CHG_CTRL);
59 if (val < 0) return Mode::VENDOR;
60 return (val & MASK_STAT_DIS) ? Mode::DISABLE : Mode::AUTO;
61}
62
64{
65 (void)state;
66 return false;
67}
68
73
74#endif
@license MIT License
@license MIT License
ManualState
Manual LED state (portable subset).
Mode
High-level LED operating mode (portable subset).
@ VENDOR
Unknown/implementation-specific mode.
@ AUTO
PMIC controls LED automatically (e.g.
@ DISABLE
LED is disabled (if supported).
Mode getMode() override
Get LED operating mode.
Definition SY6970Led.cpp:56
bool setManualState(ManualState state) override
Set manual LED state.
Definition SY6970Led.cpp:63
bool setOutputType(OutputType type) override
Set LED output type.
Definition SY6970Led.cpp:40
ManualState getManualState() override
Get manual LED state.
Definition SY6970Led.cpp:69
bool setMode(Mode mode) override
Set LED operating mode.
Definition SY6970Led.cpp:46
SY6970Led(SY6970Core &core)
Construct LED interface.
Definition SY6970Led.cpp:38
int readReg(uint8_t reg) const
int updateBits(uint8_t reg, uint8_t mask, uint8_t value_shifted)