42#include "../../PmicTimerBase.hpp"
43#include "../../../platform/SensorCommWrapper.hpp"
45template<
typename Regs>
63 if (minutes > 127)
return false;
65 uint8_t val = minutes | 0x80;
66 return _core.
writeReg(Regs::timer::TIMER_CTL, val) >= 0;
75 int val = _core.
readReg(Regs::timer::TIMER_CTL);
76 if (val < 0)
return 0;
77 return static_cast<uint8_t
>(val & 0x7F);
87 return _core.
getRegBit(Regs::timer::TIMER_CTL, 7);
97 return _core.
setRegBit(Regs::timer::TIMER_CTL, 7);
bool isTimedOut() const override
Check whether the timer has expired (bit 7 of REG8AH).
bool clearTimeout() override
Clear the timeout status flag (write 1 to bit 7 of REG8AH).
bool setTimer(uint8_t minutes) override
Start the timer with the given duration, or stop it.
AXP1xxTimer(SensorCommWrapper &core)
uint8_t getTimer() const override
Read the current timer value from REG8AH bits[6:0].
bool getRegBit(uint8_t reg, uint8_t bit)
int readReg(uint8_t reg) const
int writeReg(uint8_t reg, uint8_t val)
bool setRegBit(uint8_t reg, uint8_t bit)