ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
ds1307.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::ds1307 {
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_();
20 union DS1307Reg {
21 struct {
22 uint8_t second : 4;
23 uint8_t second_10 : 3;
24 bool ch : 1;
25
26 uint8_t minute : 4;
27 uint8_t minute_10 : 3;
28 uint8_t unused_1 : 1;
29
30 uint8_t hour : 4;
31 uint8_t hour_10 : 2;
32 uint8_t unused_2 : 2;
33
34 uint8_t weekday : 3;
35 uint8_t unused_3 : 5;
36
37 uint8_t day : 4;
38 uint8_t day_10 : 2;
39 uint8_t unused_4 : 2;
40
41 uint8_t month : 4;
42 uint8_t month_10 : 1;
43 uint8_t unused_5 : 3;
44
45 uint8_t year : 4;
46 uint8_t year_10 : 4;
47
48 uint8_t rs : 2;
49 uint8_t unused_6 : 2;
50 bool sqwe : 1;
51 uint8_t unused_7 : 2;
52 bool out : 1;
53 } reg;
54 mutable uint8_t raw[sizeof(reg)];
56};
57
58} // namespace esphome::ds1307
union esphome::ds1307::DS1307Component::DS1307Reg ds1307_
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:144
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
struct esphome::ds1307::DS1307Component::DS1307Reg::@77 reg