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