ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
pcf85063.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::pcf85063 {
8
10 public:
11 void setup() override;
12 void update() override;
13 void dump_config() override;
14 void read_time();
15 void write_time();
16
17 protected:
18 bool read_rtc_();
19 bool write_rtc_();
21 struct {
22 // Control_1 register
23 bool cap_12pf : 1;
24 bool am_pm : 1;
26 bool : 1;
27 bool soft_reset : 1;
28 bool stop : 1;
29 bool : 1;
30 bool ext_test : 1;
31
32 // Control_2 register
33 uint8_t clkout_control : 3;
34 bool timer_flag : 1;
36 bool minute_int : 1;
37 bool alarm_flag : 1;
38 bool alarm_int : 1;
39
40 // Offset register
41 uint8_t offset : 7;
42 bool coarse_mode : 1;
43
44 // nvRAM register
45 uint8_t nvram : 8;
46
47 // Seconds register
48 uint8_t second : 4;
49 uint8_t second_10 : 3;
50 bool osc_stop : 1;
51
52 // Minutes register
53 uint8_t minute : 4;
54 uint8_t minute_10 : 3;
55 uint8_t : 1;
56
57 // Hours register
58 uint8_t hour : 4;
59 uint8_t hour_10 : 2;
60 uint8_t : 2;
61
62 // Days register
63 uint8_t day : 4;
64 uint8_t day_10 : 2;
65 uint8_t : 2;
66
67 // Weekdays register
68 uint8_t weekday : 3;
69 uint8_t unused_3 : 5;
70
71 // Months register
72 uint8_t month : 4;
73 uint8_t month_10 : 1;
74 uint8_t : 3;
75
76 // Years register
77 uint8_t year : 4;
78 uint8_t year_10 : 4;
79 } reg;
80 mutable uint8_t raw[sizeof(reg)];
82};
83
84template<typename... Ts> class WriteAction : public Action<Ts...>, public Parented<PCF85063Component> {
85 public:
86 void play(const Ts &...x) override { this->parent_->write_time(); }
87};
88
89template<typename... Ts> class ReadAction : public Action<Ts...>, public Parented<PCF85063Component> {
90 public:
91 void play(const Ts &...x) override { this->parent_->read_time(); }
92};
93} // namespace esphome::pcf85063
Helper class to easily give an object a parent of type T.
Definition helpers.h:1861
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
union esphome::pcf85063::PCF85063Component::PCF85063Reg pcf85063_
void play(const Ts &...x) override
Definition pcf85063.h:91
void play(const Ts &...x) override
Definition pcf85063.h:86
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
uint16_t x
Definition tt21100.cpp:5
struct esphome::pcf85063::PCF85063Component::PCF85063Reg::@145 reg