ESPHome
2026.11.0b6
Loading...
Searching...
No Matches
esphome
components
pcf85063
pcf85063.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/components/i2c/i2c.h
"
5
#include "
esphome/components/time/real_time_clock.h
"
6
7
namespace
esphome::pcf85063
{
8
11
inline
uint8_t
decode_hour
(uint8_t units, uint8_t tens,
bool
twelve_hour) {
12
if
(!twelve_hour)
13
return
units + 10u * tens;
14
const
uint8_t
hour
= units + 10u * (tens & 0x01);
15
if
(
hour
== 0 ||
hour
> 12)
16
return
UINT8_MAX;
17
return
hour
% 12 + ((tens & 0x02) ? 12 : 0);
18
}
19
20
class
PCF85063Component
final :
public
time::RealTimeClock
,
public
i2c::I2CDevice
{
21
public
:
22
void
setup
()
override
;
23
void
update
()
override
;
24
void
dump_config
()
override
;
25
void
read_time
();
26
void
write_time
();
27
28
protected
:
29
bool
read_rtc_
();
30
bool
write_rtc_
();
31
union
PCF85063Reg
{
32
struct
{
33
// Control_1 register
34
bool
cap_12pf
: 1;
35
bool
am_pm
: 1;
36
bool
correction_int_enable
: 1;
37
bool : 1;
38
bool
soft_reset
: 1;
39
bool
stop
: 1;
40
bool : 1;
41
bool
ext_test
: 1;
42
43
// Control_2 register
44
uint8_t
clkout_control
: 3;
45
bool
timer_flag
: 1;
46
bool
halfminute_int
: 1;
47
bool
minute_int
: 1;
48
bool
alarm_flag
: 1;
49
bool
alarm_int
: 1;
50
51
// Offset register
52
uint8_t
offset
: 7;
53
bool
coarse_mode
: 1;
54
55
// nvRAM register
56
uint8_t
nvram
: 8;
57
58
// Seconds register
59
uint8_t
second
: 4;
60
uint8_t
second_10
: 3;
61
bool
osc_stop
: 1;
62
63
// Minutes register
64
uint8_t
minute
: 4;
65
uint8_t
minute_10
: 3;
66
uint8_t : 1;
67
68
// Hours register
69
uint8_t
hour
: 4;
70
uint8_t
hour_10
: 2;
71
uint8_t : 2;
72
73
// Days register
74
uint8_t
day
: 4;
75
uint8_t
day_10
: 2;
76
uint8_t : 2;
77
78
// Weekdays register
79
uint8_t
weekday
: 3;
80
uint8_t
unused_3
: 5;
81
82
// Months register
83
uint8_t
month
: 4;
84
uint8_t
month_10
: 1;
85
uint8_t : 3;
86
87
// Years register
88
uint8_t
year
: 4;
89
uint8_t
year_10
: 4;
90
}
reg
;
91
mutable
uint8_t
raw
[
sizeof
(
reg
)];
92
}
pcf85063_
;
93
};
94
95
}
// namespace esphome::pcf85063
esphome::i2c::I2CDevice
This Class provides the methods to read/write bytes from/to an i2c device.
Definition
i2c.h:144
esphome::pcf85063::PCF85063Component
Definition
pcf85063.h:20
esphome::pcf85063::PCF85063Component::read_time
void read_time()
Definition
pcf85063.cpp:25
esphome::pcf85063::PCF85063Component::setup
void setup() override
Definition
pcf85063.cpp:11
esphome::pcf85063::PCF85063Component::update
void update() override
Definition
pcf85063.cpp:17
esphome::pcf85063::PCF85063Component::read_rtc_
bool read_rtc_()
Definition
pcf85063.cpp:79
esphome::pcf85063::PCF85063Component::write_time
void write_time()
Definition
pcf85063.cpp:54
esphome::pcf85063::PCF85063Component::write_rtc_
bool write_rtc_()
Definition
pcf85063.cpp:92
esphome::pcf85063::PCF85063Component::pcf85063_
union esphome::pcf85063::PCF85063Component::PCF85063Reg pcf85063_
esphome::pcf85063::PCF85063Component::dump_config
void dump_config() override
Definition
pcf85063.cpp:19
esphome::time::RealTimeClock
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
Definition
real_time_clock.h:21
component.h
hour
uint8_t hour
Definition
datetime_entity.h:3
i2c.h
esphome::pcf85063
Definition
pcf85063.cpp:7
esphome::pcf85063::decode_hour
uint8_t decode_hour(uint8_t units, uint8_t tens, bool twelve_hour)
Hour 0-23 from the hours register digits.
Definition
pcf85063.h:11
real_time_clock.h
esphome::pcf85063::PCF85063Component::PCF85063Reg
Definition
pcf85063.h:31
esphome::pcf85063::PCF85063Component::PCF85063Reg::am_pm
bool am_pm
Definition
pcf85063.h:35
esphome::pcf85063::PCF85063Component::PCF85063Reg::nvram
uint8_t nvram
Definition
pcf85063.h:56
esphome::pcf85063::PCF85063Component::PCF85063Reg::hour
uint8_t hour
Definition
pcf85063.h:69
esphome::pcf85063::PCF85063Component::PCF85063Reg::day_10
uint8_t day_10
Definition
pcf85063.h:75
esphome::pcf85063::PCF85063Component::PCF85063Reg::cap_12pf
bool cap_12pf
Definition
pcf85063.h:34
esphome::pcf85063::PCF85063Component::PCF85063Reg::year_10
uint8_t year_10
Definition
pcf85063.h:89
esphome::pcf85063::PCF85063Component::PCF85063Reg::minute
uint8_t minute
Definition
pcf85063.h:64
esphome::pcf85063::PCF85063Component::PCF85063Reg::year
uint8_t year
Definition
pcf85063.h:88
esphome::pcf85063::PCF85063Component::PCF85063Reg::alarm_int
bool alarm_int
Definition
pcf85063.h:49
esphome::pcf85063::PCF85063Component::PCF85063Reg::month
uint8_t month
Definition
pcf85063.h:83
esphome::pcf85063::PCF85063Component::PCF85063Reg::clkout_control
uint8_t clkout_control
Definition
pcf85063.h:44
esphome::pcf85063::PCF85063Component::PCF85063Reg::month_10
uint8_t month_10
Definition
pcf85063.h:84
esphome::pcf85063::PCF85063Component::PCF85063Reg::reg
struct esphome::pcf85063::PCF85063Component::PCF85063Reg::@157 reg
esphome::pcf85063::PCF85063Component::PCF85063Reg::alarm_flag
bool alarm_flag
Definition
pcf85063.h:48
esphome::pcf85063::PCF85063Component::PCF85063Reg::minute_int
bool minute_int
Definition
pcf85063.h:47
esphome::pcf85063::PCF85063Component::PCF85063Reg::weekday
uint8_t weekday
Definition
pcf85063.h:79
esphome::pcf85063::PCF85063Component::PCF85063Reg::second
uint8_t second
Definition
pcf85063.h:59
esphome::pcf85063::PCF85063Component::PCF85063Reg::halfminute_int
bool halfminute_int
Definition
pcf85063.h:46
esphome::pcf85063::PCF85063Component::PCF85063Reg::ext_test
bool ext_test
Definition
pcf85063.h:41
esphome::pcf85063::PCF85063Component::PCF85063Reg::timer_flag
bool timer_flag
Definition
pcf85063.h:45
esphome::pcf85063::PCF85063Component::PCF85063Reg::stop
bool stop
Definition
pcf85063.h:39
esphome::pcf85063::PCF85063Component::PCF85063Reg::correction_int_enable
bool correction_int_enable
Definition
pcf85063.h:36
esphome::pcf85063::PCF85063Component::PCF85063Reg::soft_reset
bool soft_reset
Definition
pcf85063.h:38
esphome::pcf85063::PCF85063Component::PCF85063Reg::unused_3
uint8_t unused_3
Definition
pcf85063.h:80
esphome::pcf85063::PCF85063Component::PCF85063Reg::raw
uint8_t raw[sizeof(reg)]
Definition
pcf85063.h:91
esphome::pcf85063::PCF85063Component::PCF85063Reg::osc_stop
bool osc_stop
Definition
pcf85063.h:61
esphome::pcf85063::PCF85063Component::PCF85063Reg::day
uint8_t day
Definition
pcf85063.h:74
esphome::pcf85063::PCF85063Component::PCF85063Reg::hour_10
uint8_t hour_10
Definition
pcf85063.h:70
esphome::pcf85063::PCF85063Component::PCF85063Reg::coarse_mode
bool coarse_mode
Definition
pcf85063.h:53
esphome::pcf85063::PCF85063Component::PCF85063Reg::minute_10
uint8_t minute_10
Definition
pcf85063.h:65
esphome::pcf85063::PCF85063Component::PCF85063Reg::offset
uint8_t offset
Definition
pcf85063.h:52
esphome::pcf85063::PCF85063Component::PCF85063Reg::second_10
uint8_t second_10
Definition
pcf85063.h:60
Generated by
1.12.0