ESPHome  2024.11.0
ade7880_registers.h
Go to the documentation of this file.
1 #pragma once
2 
3 // This file is a modified version of the one created by MichaĆ«l Piron (@michaelpiron on GitHub)
4 
5 // Source: https://www.analog.com/media/en/technical-documentation/application-notes/AN-1127.pdf
6 
7 namespace esphome {
8 namespace ade7880 {
9 
10 // DSP Data Memory RAM registers
11 constexpr uint16_t AIGAIN = 0x4380;
12 constexpr uint16_t AVGAIN = 0x4381;
13 constexpr uint16_t BIGAIN = 0x4382;
14 constexpr uint16_t BVGAIN = 0x4383;
15 constexpr uint16_t CIGAIN = 0x4384;
16 constexpr uint16_t CVGAIN = 0x4385;
17 constexpr uint16_t NIGAIN = 0x4386;
18 
19 constexpr uint16_t DICOEFF = 0x4388;
20 
21 constexpr uint16_t APGAIN = 0x4389;
22 constexpr uint16_t AWATTOS = 0x438A;
23 constexpr uint16_t BPGAIN = 0x438B;
24 constexpr uint16_t BWATTOS = 0x438C;
25 constexpr uint16_t CPGAIN = 0x438D;
26 constexpr uint16_t CWATTOS = 0x438E;
27 constexpr uint16_t AIRMSOS = 0x438F;
28 constexpr uint16_t AVRMSOS = 0x4390;
29 constexpr uint16_t BIRMSOS = 0x4391;
30 constexpr uint16_t BVRMSOS = 0x4392;
31 constexpr uint16_t CIRMSOS = 0x4393;
32 constexpr uint16_t CVRMSOS = 0x4394;
33 constexpr uint16_t NIRMSOS = 0x4395;
34 constexpr uint16_t HPGAIN = 0x4398;
35 constexpr uint16_t ISUMLVL = 0x4399;
36 
37 constexpr uint16_t VLEVEL = 0x439F;
38 
39 constexpr uint16_t AFWATTOS = 0x43A2;
40 constexpr uint16_t BFWATTOS = 0x43A3;
41 constexpr uint16_t CFWATTOS = 0x43A4;
42 
43 constexpr uint16_t AFVAROS = 0x43A5;
44 constexpr uint16_t BFVAROS = 0x43A6;
45 constexpr uint16_t CFVAROS = 0x43A7;
46 
47 constexpr uint16_t AFIRMSOS = 0x43A8;
48 constexpr uint16_t BFIRMSOS = 0x43A9;
49 constexpr uint16_t CFIRMSOS = 0x43AA;
50 
51 constexpr uint16_t AFVRMSOS = 0x43AB;
52 constexpr uint16_t BFVRMSOS = 0x43AC;
53 constexpr uint16_t CFVRMSOS = 0x43AD;
54 
55 constexpr uint16_t HXWATTOS = 0x43AE;
56 constexpr uint16_t HYWATTOS = 0x43AF;
57 constexpr uint16_t HZWATTOS = 0x43B0;
58 constexpr uint16_t HXVAROS = 0x43B1;
59 constexpr uint16_t HYVAROS = 0x43B2;
60 constexpr uint16_t HZVAROS = 0x43B3;
61 
62 constexpr uint16_t HXIRMSOS = 0x43B4;
63 constexpr uint16_t HYIRMSOS = 0x43B5;
64 constexpr uint16_t HZIRMSOS = 0x43B6;
65 constexpr uint16_t HXVRMSOS = 0x43B7;
66 constexpr uint16_t HYVRMSOS = 0x43B8;
67 constexpr uint16_t HZVRMSOS = 0x43B9;
68 
69 constexpr uint16_t AIRMS = 0x43C0;
70 constexpr uint16_t AVRMS = 0x43C1;
71 constexpr uint16_t BIRMS = 0x43C2;
72 constexpr uint16_t BVRMS = 0x43C3;
73 constexpr uint16_t CIRMS = 0x43C4;
74 constexpr uint16_t CVRMS = 0x43C5;
75 constexpr uint16_t NIRMS = 0x43C6;
76 
77 constexpr uint16_t ISUM = 0x43C7;
78 
79 // Internal DSP Memory RAM registers
80 constexpr uint16_t RUN = 0xE228;
81 
82 constexpr uint16_t AWATTHR = 0xE400;
83 constexpr uint16_t BWATTHR = 0xE401;
84 constexpr uint16_t CWATTHR = 0xE402;
85 constexpr uint16_t AFWATTHR = 0xE403;
86 constexpr uint16_t BFWATTHR = 0xE404;
87 constexpr uint16_t CFWATTHR = 0xE405;
88 constexpr uint16_t AFVARHR = 0xE409;
89 constexpr uint16_t BFVARHR = 0xE40A;
90 constexpr uint16_t CFVARHR = 0xE40B;
91 
92 constexpr uint16_t AVAHR = 0xE40C;
93 constexpr uint16_t BVAHR = 0xE40D;
94 constexpr uint16_t CVAHR = 0xE40E;
95 
96 constexpr uint16_t IPEAK = 0xE500;
97 constexpr uint16_t VPEAK = 0xE501;
98 
99 constexpr uint16_t STATUS0 = 0xE502;
100 constexpr uint16_t STATUS1 = 0xE503;
101 
102 constexpr uint16_t AIMAV = 0xE504;
103 constexpr uint16_t BIMAV = 0xE505;
104 constexpr uint16_t CIMAV = 0xE506;
105 
106 constexpr uint16_t OILVL = 0xE507;
107 constexpr uint16_t OVLVL = 0xE508;
108 constexpr uint16_t SAGLVL = 0xE509;
109 constexpr uint16_t MASK0 = 0xE50A;
110 constexpr uint16_t MASK1 = 0xE50B;
111 
112 constexpr uint16_t IAWV = 0xE50C;
113 constexpr uint16_t IBWV = 0xE50D;
114 constexpr uint16_t ICWV = 0xE50E;
115 constexpr uint16_t INWV = 0xE50F;
116 constexpr uint16_t VAWV = 0xE510;
117 constexpr uint16_t VBWV = 0xE511;
118 constexpr uint16_t VCWV = 0xE512;
119 
120 constexpr uint16_t AWATT = 0xE513;
121 constexpr uint16_t BWATT = 0xE514;
122 constexpr uint16_t CWATT = 0xE515;
123 
124 constexpr uint16_t AFVAR = 0xE516;
125 constexpr uint16_t BFVAR = 0xE517;
126 constexpr uint16_t CFVAR = 0xE518;
127 
128 constexpr uint16_t AVA = 0xE519;
129 constexpr uint16_t BVA = 0xE51A;
130 constexpr uint16_t CVA = 0xE51B;
131 
132 constexpr uint16_t CHECKSUM = 0xE51F;
133 constexpr uint16_t VNOM = 0xE520;
134 constexpr uint16_t LAST_RWDATA_24BIT = 0xE5FF;
135 constexpr uint16_t PHSTATUS = 0xE600;
136 constexpr uint16_t ANGLE0 = 0xE601;
137 constexpr uint16_t ANGLE1 = 0xE602;
138 constexpr uint16_t ANGLE2 = 0xE603;
139 constexpr uint16_t PHNOLOAD = 0xE608;
140 constexpr uint16_t LINECYC = 0xE60C;
141 constexpr uint16_t ZXTOUT = 0xE60D;
142 constexpr uint16_t COMPMODE = 0xE60E;
143 constexpr uint16_t GAIN = 0xE60F;
144 constexpr uint16_t CFMODE = 0xE610;
145 constexpr uint16_t CF1DEN = 0xE611;
146 constexpr uint16_t CF2DEN = 0xE612;
147 constexpr uint16_t CF3DEN = 0xE613;
148 constexpr uint16_t APHCAL = 0xE614;
149 constexpr uint16_t BPHCAL = 0xE615;
150 constexpr uint16_t CPHCAL = 0xE616;
151 constexpr uint16_t PHSIGN = 0xE617;
152 constexpr uint16_t CONFIG = 0xE618;
153 constexpr uint16_t MMODE = 0xE700;
154 constexpr uint16_t ACCMODE = 0xE701;
155 constexpr uint16_t LCYCMODE = 0xE702;
156 constexpr uint16_t PEAKCYC = 0xE703;
157 constexpr uint16_t SAGCYC = 0xE704;
158 constexpr uint16_t CFCYC = 0xE705;
159 constexpr uint16_t HSDC_CFG = 0xE706;
160 constexpr uint16_t VERSION = 0xE707;
161 constexpr uint16_t DSPWP_SET = 0xE7E3;
162 constexpr uint16_t LAST_RWDATA_8BIT = 0xE7FD;
163 constexpr uint16_t DSPWP_SEL = 0xE7FE;
164 constexpr uint16_t FVRMS = 0xE880;
165 constexpr uint16_t FIRMS = 0xE881;
166 constexpr uint16_t FWATT = 0xE882;
167 constexpr uint16_t FVAR = 0xE883;
168 constexpr uint16_t FVA = 0xE884;
169 constexpr uint16_t FPF = 0xE885;
170 constexpr uint16_t VTHDN = 0xE886;
171 constexpr uint16_t ITHDN = 0xE887;
172 constexpr uint16_t HXVRMS = 0xE888;
173 constexpr uint16_t HXIRMS = 0xE889;
174 constexpr uint16_t HXWATT = 0xE88A;
175 constexpr uint16_t HXVAR = 0xE88B;
176 constexpr uint16_t HXVA = 0xE88C;
177 constexpr uint16_t HXPF = 0xE88D;
178 constexpr uint16_t HXVHD = 0xE88E;
179 constexpr uint16_t HXIHD = 0xE88F;
180 constexpr uint16_t HYVRMS = 0xE890;
181 constexpr uint16_t HYIRMS = 0xE891;
182 constexpr uint16_t HYWATT = 0xE892;
183 constexpr uint16_t HYVAR = 0xE893;
184 constexpr uint16_t HYVA = 0xE894;
185 constexpr uint16_t HYPF = 0xE895;
186 constexpr uint16_t HYVHD = 0xE896;
187 constexpr uint16_t HYIHD = 0xE897;
188 constexpr uint16_t HZVRMS = 0xE898;
189 constexpr uint16_t HZIRMS = 0xE899;
190 constexpr uint16_t HZWATT = 0xE89A;
191 constexpr uint16_t HZVAR = 0xE89B;
192 constexpr uint16_t HZVA = 0xE89C;
193 constexpr uint16_t HZPF = 0xE89D;
194 constexpr uint16_t HZVHD = 0xE89E;
195 constexpr uint16_t HZIHD = 0xE89F;
196 constexpr uint16_t HCONFIG = 0xE900;
197 constexpr uint16_t APF = 0xE902;
198 constexpr uint16_t BPF = 0xE903;
199 constexpr uint16_t CPF = 0xE904;
200 constexpr uint16_t APERIOD = 0xE905;
201 constexpr uint16_t BPERIOD = 0xE906;
202 constexpr uint16_t CPERIOD = 0xE907;
203 constexpr uint16_t APNOLOAD = 0xE908;
204 constexpr uint16_t VARNOLOAD = 0xE909;
205 constexpr uint16_t VANOLOAD = 0xE90A;
206 constexpr uint16_t LAST_ADD = 0xE9FE;
207 constexpr uint16_t LAST_RWDATA_16BIT = 0xE9FF;
208 constexpr uint16_t CONFIG3 = 0xEA00;
209 constexpr uint16_t LAST_OP = 0xEA01;
210 constexpr uint16_t WTHR = 0xEA02;
211 constexpr uint16_t VARTHR = 0xEA03;
212 constexpr uint16_t VATHR = 0xEA04;
213 
214 constexpr uint16_t HX_REG = 0xEA08;
215 constexpr uint16_t HY_REG = 0xEA09;
216 constexpr uint16_t HZ_REG = 0xEA0A;
217 constexpr uint16_t LPOILVL = 0xEC00;
218 constexpr uint16_t CONFIG2 = 0xEC01;
219 
220 // STATUS1 Register Bits
221 constexpr uint32_t STATUS1_RSTDONE = (1 << 15);
222 
223 // CONFIG Register Bits
224 constexpr uint16_t CONFIG_SWRST = (1 << 7);
225 
226 // CONFIG2 Register Bits
227 constexpr uint8_t CONFIG2_I2C_LOCK = (1 << 1);
228 
229 // COMPMODE Register Bits
230 constexpr uint16_t COMPMODE_DEFAULT = 0x01FF;
231 constexpr uint16_t COMPMODE_SELFREQ = (1 << 14);
232 
233 // RUN Register Bits
234 constexpr uint16_t RUN_ENABLE = (1 << 0);
235 
236 // DSPWP_SET Register Bits
237 constexpr uint8_t DSPWP_SET_RO = (1 << 7);
238 
239 // DSPWP_SEL Register Bits
240 constexpr uint8_t DSPWP_SEL_SET = 0xAD;
241 
242 } // namespace ade7880
243 } // namespace esphome
constexpr uint16_t IPEAK
constexpr uint16_t HYVHD
constexpr uint16_t BFVAROS
constexpr uint16_t HZ_REG
constexpr uint16_t CFVARHR
constexpr uint16_t CIRMSOS
constexpr uint16_t CFVRMSOS
constexpr uint16_t APERIOD
constexpr uint16_t HSDC_CFG
constexpr uint16_t DSPWP_SEL
constexpr uint16_t HXIRMS
constexpr uint16_t PHSIGN
constexpr uint16_t HPGAIN
constexpr uint16_t AVRMS
constexpr uint16_t BVGAIN
constexpr uint16_t HZPF
constexpr uint16_t HYIHD
constexpr uint16_t AWATTHR
constexpr uint16_t CIGAIN
constexpr uint16_t CONFIG2
constexpr uint16_t CFWATTOS
constexpr uint16_t CVRMSOS
constexpr uint16_t FWATT
constexpr uint16_t STATUS0
constexpr uint16_t HX_REG
constexpr uint16_t BIMAV
constexpr uint16_t HXWATTOS
constexpr uint16_t BFVARHR
constexpr uint16_t CPERIOD
constexpr uint16_t CFMODE
constexpr uint16_t CONFIG
constexpr uint16_t AVGAIN
constexpr uint16_t BIRMS
constexpr uint16_t HXVHD
constexpr uint16_t APNOLOAD
constexpr uint16_t ANGLE0
constexpr uint16_t VARTHR
constexpr uint16_t BVAHR
constexpr uint16_t CVGAIN
constexpr uint16_t CPHCAL
constexpr uint16_t HZWATT
constexpr uint16_t VANOLOAD
constexpr uint16_t HXVRMS
constexpr uint16_t VERSION
constexpr uint16_t BPF
constexpr uint16_t CONFIG_SWRST
constexpr uint16_t BVRMSOS
constexpr uint16_t VBWV
constexpr uint16_t LPOILVL
constexpr uint16_t AFVARHR
constexpr uint16_t COMPMODE
constexpr uint16_t ITHDN
constexpr uint16_t HZVRMSOS
constexpr uint16_t LAST_RWDATA_24BIT
constexpr uint16_t BVRMS
constexpr uint16_t CVAHR
constexpr uint16_t APGAIN
constexpr uint16_t MASK0
constexpr uint16_t LAST_ADD
constexpr uint16_t HXVRMSOS
constexpr uint16_t AFVRMSOS
constexpr uint16_t HZIRMS
constexpr uint16_t HZVAROS
constexpr uint16_t CFWATTHR
constexpr uint16_t STATUS1
constexpr uint16_t MASK1
constexpr uint16_t ZXTOUT
constexpr uint16_t CONFIG3
constexpr uint16_t AFVAR
constexpr uint16_t CFIRMSOS
constexpr uint16_t VCWV
constexpr uint16_t ANGLE1
constexpr uint16_t BIRMSOS
constexpr uint16_t HYVAR
constexpr uint16_t BIGAIN
constexpr uint16_t HXIRMSOS
constexpr uint16_t VAWV
constexpr uint16_t CPGAIN
constexpr uint16_t IAWV
constexpr uint16_t RUN
constexpr uint16_t AWATTOS
constexpr uint16_t FIRMS
constexpr uint16_t OILVL
constexpr uint16_t HXWATT
constexpr uint16_t AFWATTOS
constexpr uint16_t HXPF
constexpr uint16_t HY_REG
constexpr uint16_t HXVAROS
constexpr uint16_t BFWATTHR
constexpr uint16_t VPEAK
constexpr uint16_t DICOEFF
constexpr uint16_t COMPMODE_DEFAULT
constexpr uint16_t HZVHD
constexpr uint16_t ICWV
constexpr uint16_t DSPWP_SET
constexpr uint16_t CFVAROS
constexpr uint16_t VTHDN
constexpr uint16_t SAGLVL
constexpr uint16_t CVRMS
constexpr uint16_t CFVAR
constexpr uint16_t AFVAROS
constexpr uint16_t LAST_RWDATA_8BIT
constexpr uint16_t BFWATTOS
constexpr uint16_t CIRMS
constexpr uint16_t HXVAR
constexpr uint16_t MMODE
constexpr uint16_t CHECKSUM
constexpr uint16_t BWATTHR
constexpr uint16_t FVA
constexpr uint16_t APF
constexpr uint16_t SAGCYC
constexpr uint16_t BFVAR
constexpr uint16_t NIRMS
constexpr uint16_t HZIRMSOS
constexpr uint8_t CONFIG2_I2C_LOCK
constexpr uint16_t AWATT
constexpr uint16_t PHNOLOAD
constexpr uint16_t LINECYC
constexpr uint16_t HYWATTOS
constexpr uint16_t RUN_ENABLE
constexpr uint16_t LCYCMODE
constexpr uint16_t BPERIOD
constexpr uint16_t AVAHR
constexpr uint16_t HZIHD
constexpr uint16_t HYVRMS
constexpr uint16_t FVRMS
constexpr uint8_t DSPWP_SET_RO
constexpr uint16_t ACCMODE
constexpr uint16_t GAIN
constexpr uint16_t HCONFIG
constexpr uint8_t DSPWP_SEL_SET
constexpr uint16_t FPF
constexpr uint16_t LAST_RWDATA_16BIT
constexpr uint16_t HZVAR
constexpr uint16_t VNOM
constexpr uint16_t HYVRMSOS
constexpr uint16_t CIMAV
constexpr uint16_t BPHCAL
constexpr uint16_t PHSTATUS
constexpr uint16_t INWV
constexpr uint16_t HZWATTOS
constexpr uint16_t HXIHD
constexpr uint16_t HYIRMSOS
constexpr uint16_t NIGAIN
constexpr uint16_t BFVRMSOS
constexpr uint16_t AIGAIN
constexpr uint16_t HYVA
constexpr uint16_t CF1DEN
constexpr uint16_t AVA
constexpr uint16_t ANGLE2
constexpr uint16_t CWATTHR
constexpr uint16_t COMPMODE_SELFREQ
constexpr uint32_t STATUS1_RSTDONE
constexpr uint16_t BVA
constexpr uint16_t LAST_OP
constexpr uint16_t VARNOLOAD
constexpr uint16_t AIMAV
constexpr uint16_t AIRMS
constexpr uint16_t FVAR
constexpr uint16_t APHCAL
constexpr uint16_t VLEVEL
constexpr uint16_t PEAKCYC
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
constexpr uint16_t CWATTOS
constexpr uint16_t HXVA
constexpr uint16_t CWATT
constexpr uint16_t OVLVL
constexpr uint16_t CVA
constexpr uint16_t ISUMLVL
constexpr uint16_t CF2DEN
constexpr uint16_t VATHR
constexpr uint16_t HZVA
constexpr uint16_t BWATTOS
constexpr uint16_t CF3DEN
constexpr uint16_t WTHR
constexpr uint16_t NIRMSOS
constexpr uint16_t AFWATTHR
constexpr uint16_t AIRMSOS
constexpr uint16_t CFCYC
constexpr uint16_t AFIRMSOS
constexpr uint16_t HYVAROS
constexpr uint16_t HZVRMS
constexpr uint16_t IBWV
constexpr uint16_t BPGAIN
constexpr uint16_t BWATT
constexpr uint16_t HYPF
constexpr uint16_t HYIRMS
constexpr uint16_t CPF
constexpr uint16_t AVRMSOS
constexpr uint16_t HYWATT
constexpr uint16_t ISUM
constexpr uint16_t BFIRMSOS