From ec8acc051c0ad96a55d271c91a55e1e95e00215b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odd=20Str=C3=A5b=C3=B8?= Date: Tue, 12 Sep 2023 22:48:20 +0000 Subject: [PATCH] pcf85063: Add stop_timer method --- esphome/components/pcf85063/pcf85063.cpp | 7 +++++++ esphome/components/pcf85063/pcf85063.h | 1 + 2 files changed, 8 insertions(+) diff --git a/esphome/components/pcf85063/pcf85063.cpp b/esphome/components/pcf85063/pcf85063.cpp index 7abb243..102f329 100644 --- a/esphome/components/pcf85063/pcf85063.cpp +++ b/esphome/components/pcf85063/pcf85063.cpp @@ -135,6 +135,13 @@ bool PCF85063Component::clear_timer_flag() { return true; } +bool PCF85063Component::stop_timer() { + PCF85063_READ_REG(0x11, 1); + this->pcf85063_.reg.timer_enable = false; + PCF85063_WRITE_REG(0x11, 1); + return true; +} + bool PCF85063Component::clear_alarm_flag() { PCF85063_READ_REG(0x01, 1); this->pcf85063_.reg.alarm_flag = 0; diff --git a/esphome/components/pcf85063/pcf85063.h b/esphome/components/pcf85063/pcf85063.h index 3643764..c5e3272 100644 --- a/esphome/components/pcf85063/pcf85063.h +++ b/esphome/components/pcf85063/pcf85063.h @@ -34,6 +34,7 @@ class PCF85063Component : public time::RealTimeClock, public i2c::I2CDevice { bool write_timer_interval(uint16_t interval); bool clear_timer_flag(); bool clear_alarm_flag(); + bool stop_timer(); bool write_clockout_frequency(uint8_t freq); void set_timer_interrupt_enable_(bool state); void set_timer_interrupt_mode_(PCF85063ATimerInterruptMode_t mode);