Go to the documentation of this file.
33 #ifndef __ADE9153A_H__
34 #define __ADE9153A_H__
60 #define ADE9153A_SPI_READ NO_OS_BIT(3)
63 #define ADE9153A_LOCK_KEY 0x3C64
66 #define ADE9153A_UNLOCK_KEY 0x4AD1
69 #define ADE9153A_COMPMODEVAL 0x0005
72 #define ADE9153A_RUN 0x0001
73 #define ADE9153A_STOP 0x0000
76 #define ADE9153A_VERSION 0x9153a
79 #define ADE9153A_RESET_DEL 0x1F4
82 #define ADE9153A_START_16ADDR 0x473
83 #define ADE9153A_END_16ADDR 0x600
86 #define ADE9153A_CRC16_POLY 0x1021
87 #define ADE9153A_CRC16_INIT_VAL 0xFFFF
89 #define ADE9153A_NO_BYTES_W_16 0x0004
90 #define ADE9153A_NO_BYTES_W_32 0x0006
91 #define ADE9153A_NO_BYTES_R_16 0x0006
92 #define ADE9153A_NO_BYTES_R_32 0x0008
100 #define ADE9153A_REG_AIGAIN 0x000
101 #define ADE9153A_REG_APHASECAL 0x001
102 #define ADE9153A_REG_AVGAIN 0x002
103 #define ADE9153A_REG_AIRMS_OS 0x003
104 #define ADE9153A_REG_AVRMS_OS 0x004
105 #define ADE9153A_REG_APGAIN 0x005
106 #define ADE9153A_REG_AWATT_OS 0x006
107 #define ADE9153A_REG_AFVAR_OS 0x007
108 #define ADE9153A_REG_AVRMS_OC_OS 0x008
109 #define ADE9153A_REG_AIRMS_OC_OS 0x009
110 #define ADE9153A_REG_BIGAIN 0x010
111 #define ADE9153A_REG_BPHASECAL 0x011
112 #define ADE9153A_REG_BIRMS_OS 0x013
113 #define ADE9153A_REG_BIRMS_OC_OS 0x019
114 #define ADE9153A_REG_CONFIG0 0x020
115 #define ADE9153A_REG_VNOM 0x021
116 #define ADE9153A_REG_DICOEFF 0x022
117 #define ADE9153A_REG_BI_PGAGAIN 0x023
118 #define ADE9153A_REG_MS_ACAL_CFG 0x030
119 #define ADE9153A_REG_MS_AICC_USER 0x045
120 #define ADE9153A_REG_MS_BICC_USER 0x046
121 #define ADE9153A_REG_MS_AVCC_USER 0x047
122 #define ADE9153A_REG_CT_PHASE_DELAY 0x049
123 #define ADE9153A_REG_CT_CORNER 0x04A
124 #define ADE9153A_REG_VDIV_RSMALL 0x04C
125 #define ADE9153A_REG_AI_WAV 0x200
126 #define ADE9153A_REG_AV_WAV 0x201
127 #define ADE9153A_REG_AIRMS 0x202
128 #define ADE9153A_REG_AVRMS 0x203
129 #define ADE9153A_REG_AWATT 0x204
130 #define ADE9153A_REG_AVA 0x206
131 #define ADE9153A_REG_AFVAR 0x207
132 #define ADE9153A_REG_APF 0x208
133 #define ADE9153A_REG_AIRMS_OC 0x209
134 #define ADE9153A_REG_AVRMS_OC 0x20A
135 #define ADE9153A_REG_BI_WAV 0x210
136 #define ADE9153A_REG_BIRMS 0x212
137 #define ADE9153A_REG_BIRMS_OC 0x219
138 #define ADE9153A_REG_MS_ACAL_AICC 0x220
139 #define ADE9153A_REG_MS_ACAL_AICERT 0x221
140 #define ADE9153A_REG_MS_ACAL_BICC 0x222
141 #define ADE9153A_REG_MS_ACAL_BICERT 0x223
142 #define ADE9153A_REG_MS_ACAL_AVCC 0x224
143 #define ADE9153A_REG_MS_ACAL_AVCERT 0x225
144 #define ADE9153A_REG_MS_STATUS_CURRENT 0x240
145 #define ADE9153A_REG_VERSION_DSP 0x241
146 #define ADE9153A_REG_VERSION_PRODUCT 0x242
147 #define ADE9153A_REG_AWATT_ACC 0x39D
148 #define ADE9153A_REG_AWATTHR_LO 0x39E
149 #define ADE9153A_REG_AWATTHR_HI 0x39F
150 #define ADE9153A_REG_AVA_ACC 0x3B1
151 #define ADE9153A_REG_AVAHR_LO 0x3B2
152 #define ADE9153A_REG_AVAHR_HI 0x3B3
153 #define ADE9153A_REG_AFVAR_ACC 0x3BB
154 #define ADE9153A_REG_AFVARHR_LO 0x3BC
155 #define ADE9153A_REG_AFVARHR_HI 0x3BD
156 #define ADE9153A_REG_PWATT_ACC 0x3EB
157 #define ADE9153A_REG_NWATT_ACC 0x3EF
158 #define ADE9153A_REG_PFVAR_ACC 0x3F3
159 #define ADE9153A_REG_NFVAR_ACC 0x3F7
160 #define ADE9153A_REG_IPEAK 0x400
161 #define ADE9153A_REG_VPEAK 0x401
162 #define ADE9153A_REG_STATUS 0x402
163 #define ADE9153A_REG_MASK 0x405
164 #define ADE9153A_REG_OI_LVL 0x409
165 #define ADE9153A_REG_OIA 0x40A
166 #define ADE9153A_REG_OIB 0x40B
167 #define ADE9153A_REG_USER_PERIOD 0x40E
168 #define ADE9153A_REG_VLEVEL 0x40F
169 #define ADE9153A_REG_DIP_LVL 0x410
170 #define ADE9153A_REG_DIPA 0x411
171 #define ADE9153A_REG_SWELL_LVL 0x414
172 #define ADE9153A_REG_SWELLA 0x415
173 #define ADE9153A_REG_APERIOD 0x418
174 #define ADE9153A_REG_ACT_NL_LVL 0x41C
175 #define ADE9153A_REG_REACT_NL_LVL 0x41D
176 #define ADE9153A_REG_APP_NL_LVL 0x41E
177 #define ADE9153A_REG_PHNOLOAD 0x41F
178 #define ADE9153A_REG_WTHR 0x420
179 #define ADE9153A_REG_VARTHR 0x421
180 #define ADE9153A_REG_VATHR 0x422
181 #define ADE9153A_REG_LAST_DATA_32 0x423
182 #define ADE9153A_REG_CT_PHASE_MEAS 0x424
183 #define ADE9153A_REG_CF_LCFG 0x425
184 #define ADE9153A_REG_TEMP_TRIM 0x471
185 #define ADE9153A_REG_CHIP_ID_HI 0x472
186 #define ADE9153A_REG_CHIP_ID_LO 0x473
187 #define ADE9153A_REG_RUN 0x480
188 #define ADE9153A_REG_CONFIG1 0x481
189 #define ADE9153A_REG_ANGL_AV_AI 0x485
190 #define ADE9153A_REG_ANGL_AI_BI 0x488
191 #define ADE9153A_REG_DIP_CYC 0x48B
192 #define ADE9153A_REG_SWELL_CYC 0x48C
193 #define ADE9153A_REG_CFMODE 0x490
194 #define ADE9153A_REG_COMPMODE 0x491
195 #define ADE9153A_REG_ACCMODE 0x492
196 #define ADE9153A_REG_CONFIG3 0x493
197 #define ADE9153A_REG_CF1DEN 0x494
198 #define ADE9153A_REG_CF2DEN 0x495
199 #define ADE9153A_REG_ZXTOUT 0x498
200 #define ADE9153A_REG_ZXTHRSH 0x499
201 #define ADE9153A_REG_ZX_CFG 0x49A
202 #define ADE9153A_REG_PHSIGN 0x49D
203 #define ADE9153A_REG_CRC_RSLT 0x4A8
204 #define ADE9153A_REG_CRC_SPI 0x4A9
205 #define ADE9153A_REG_LAST_DATA_16 0x4AC
206 #define ADE9153A_REG_LAST_CMD 0x4AE
207 #define ADE9153A_REG_CONFIG2 0x4AF
208 #define ADE9153A_REG_EP_CFG 0x4B0
209 #define ADE9153A_REG_PWR_TIME 0x4B1
210 #define ADE9153A_REG_EGY_TIME 0x4B2
211 #define ADE9153A_REG_CRC_FORCE 0x4B4
212 #define ADE9153A_REG_TEMP_CFG 0x4B6
213 #define ADE9153A_REG_TEMP_RSLT 0x4B7
214 #define ADE9153A_REG_AI_PGAGAIN 0x4B9
215 #define ADE9153A_REG_WR_LOCK 0x4BF
216 #define ADE9153A_REG_MS_STATUS_IRQ 0x4C0
217 #define ADE9153A_REG_EVENT_STATUS 0x4C1
218 #define ADE9153A_REG_CHIP_STATUS 0x4C2
219 #define ADE9153A_REG_UART_BAUD_SWITCH 0x4DC
220 #define ADE9153A_REG_VERSION 0x4FE
221 #define ADE9153A_REG_AI_WAV_1 0x600
222 #define ADE9153A_REG_AV_WAV_1 0x601
223 #define ADE9153A_REG_BI_WAV_1 0x602
224 #define ADE9153A_REG_AIRMS_1 0x604
225 #define ADE9153A_REG_BIRMS_1 0x605
226 #define ADE9153A_REG_AVRMS_1 0x606
227 #define ADE9153A_REG_AWATT_1 0x608
228 #define ADE9153A_REG_AFVAR_1 0x60A
229 #define ADE9153A_REG_AVA_1 0x60C
230 #define ADE9153A_REG_APF_1 0x60E
231 #define ADE9153A_REG_ AI_WAV_2 0x610
232 #define ADE9153A_REG_AV_WAV_2 0x611
233 #define ADE9153A_REG_AIRMS_2 0x612
234 #define ADE9153A_REG_AVRMS_2 0x613
235 #define ADE9153A_REG_AWATT_2 0x614
236 #define ADE9153A_REG_AVA_2 0x615
237 #define ADE9153A_REG_AFVAR_2 0x616
238 #define ADE9153A_REG_APF_2 0x617
239 #define ADE9153A_REG_BI_WAV_2 0x618
240 #define ADE9153A_REG_BIRMS_2 0x61A
243 #define ADE9153A_DISRPLPF_MSK NO_OS_BIT(8)
244 #define ADE9153A_DISAPLPF_MSK NO_OS_BIT(7)
245 #define ADE9153A_VNOMA_EN_MSK NO_OS_BIT(5)
246 #define ADE9153A_RMS_OC_SRC_MSK NO_OS_BIT(4)
247 #define ADE9153A_ZX_SRC_SEL_MSK NO_OS_BIT(3)
248 #define ADE9153A_INTEN_BI_MSK NO_OS_BIT(2)
249 #define ADE9153A_HPFDIS_MSK NO_OS_BIT(0)
252 #define ADE9153A_BI_PGAGAIN_MSK NO_OS_GENMASK(31, 0)
255 #define ADE9153A_AUTOCAL_AV_MSK NO_OS_BIT(6)
256 #define ADE9153A_AUTOCAL_BI_MSK NO_OS_BIT(5)
257 #define ADE9153A_AUTOCAL_AI_MSK NO_OS_BIT(4)
258 #define ADE9153A_ACALMODE_BI_MSK NO_OS_BIT(3)
259 #define ADE9153A_ACALMODE_AI_MSK NO_OS_BIT(2)
260 #define ADE9153A_ACAL_RUN_MSK NO_OS_BIT(1)
261 #define ADE9153A_ACAL_MODE_MSK NO_OS_BIT(0)
264 #define ADE9153A_MS_SYSRDYP_MSK NO_OS_BIT(0)
267 #define ADE9153A_IPPHASE_MSK NO_OS_GENMASK(26, 24)
268 #define ADE9153A_IPEAKVAL_MSK NO_OS_GENMASK(23, 0)
271 #define ADE9153A_VPEAKVAL_MSK NO_OS_GENMASK(23, 0)
274 #define ADE9153A_CHIP_STAT_MSK NO_OS_BIT(31)
275 #define ADE9153A_EVENT_STAT_MSK NO_OS_BIT(30)
276 #define ADE9153A_MS_STAT_MSK NO_OS_BIT(29)
277 #define ADE9153A_PF_RDY_MSK NO_OS_BIT(25)
278 #define ADE9153A_CRC_CHG_MSK NO_OS_BIT(24)
279 #define ADE9153A_CRC_DONE_MSK NO_OS_BIT(23)
280 #define ADE9153A_ZXTOAV_MSK NO_OS_BIT(21)
281 #define ADE9153A_ZXBI_MSK NO_OS_BIT(20)
282 #define ADE9153A_ZXAI_MSK NO_OS_BIT(19)
283 #define ADE9153A_ZXAV_MSK NO_OS_BIT(17)
284 #define ADE9153A_RSTDONE_MSK NO_OS_BIT(16)
285 #define ADE9153A_FVARNL_MSK NO_OS_BIT(15)
286 #define ADE9153A_VANL_MSK NO_OS_BIT(14)
287 #define ADE9153A_WATTNL_MSK NO_OS_BIT(13)
288 #define ADE9153A_TEMP_RDY_MSK NO_OS_BIT(12)
289 #define ADE9153A_RMS_OC_RDY_MSK NO_OS_BIT(11)
290 #define ADE9153A_PWRRDY_MSK NO_OS_BIT(10)
291 #define ADE9153A_DREADY_MSK NO_OS_BIT(9)
292 #define ADE9153A_EGYRDY_MSK NO_OS_BIT(8)
293 #define ADE9153A_CF2_MSK NO_OS_BIT(7)
294 #define ADE9153A_CF1_MSK NO_OS_BIT(6)
295 #define ADE9153A_REVPCF2_MSK NO_OS_BIT(5)
296 #define ADE9153A_REVPCF1_MSK NO_OS_BIT(4)
297 #define ADE9153A_REVRPA_MSK NO_OS_BIT(2)
298 #define ADE9153A_REVAPA_MSK NO_OS_BIT(0)
301 #define ADE9153A_OILVL_VAL_MSK NO_OS_GENMASK(23, 0)
304 #define ADE9153A_OIA_VAL_MSK NO_OS_GENMASK(23, 0)
307 #define ADE9153A_OIB_VAL_MSK NO_OS_GENMASK(23, 0)
310 #define ADE9153A_VLEVEL_VAL_MSK NO_OS_GENMASK(23, 0)
313 #define ADE9153A_DIPA_VAL_MSK NO_OS_GENMASK(23, 0)
316 #define ADE9153A_SWELLA_VAL_MSK NO_OS_GENMASK(23, 0)
319 #define ADE9153A_AFVARNL_MSK NO_OS_BIT(2)
320 #define ADE9153A_AVANL_MSK NO_OS_BIT(1)
321 #define ADE9153A_AWATTNL_MSK NO_OS_BIT(0)
324 #define ADE9153A_CF2_LT_MSK NO_OS_BIT(20)
325 #define ADE9153A_CF1_LT_MSK NO_OS_BIT(19)
326 #define ADE9153A_CF_LTMR_MSK NO_OS_GENMASK(18, 0)
329 #define ADE9153A_TEMP_OFFSET_MSK NO_OS_GENMASK(31, 16)
330 #define ADE9153A_TEMP_GAIN_MSK NO_OS_GENMASK(15, 0)
333 #define ADE9153A_EXT_REF_MSK NO_OS_BIT(15)
334 #define ADE9153A_DIP_SWELL_IRQ_MODE_MSK NO_OS_BIT(14)
335 #define ADE9153A_BURST_EN_MSK NO_OS_BIT(11)
336 #define ADE9153A_PWR_SETTLE_MSK NO_OS_GENMASK(9, 8)
337 #define ADE9153A_CF_ACC_CLR_MSK NO_OS_BIT(5)
338 #define ADE9153A_ZX_OUT_OE_MSK NO_OS_BIT(2)
339 #define ADE9153A_DREADY_OE_MSK NO_OS_BIT(1)
340 #define ADE9153A_SWRST_MSK NO_OS_BIT(0)
343 #define ADE9153A_CF2DIS_MSK NO_OS_BIT(7)
344 #define ADE9153A_CF1DIS_MSK NO_OS_BIT(6)
345 #define ADE9153A_CF2SEL_MSK NO_OS_GENMASK(5, 3)
346 #define ADE9153A_CF1SEL_MSK NO_OS_GENMASK(2, 0)
349 #define ADE9153A_SELFREQ_MSK NO_OS_BIT(4)
350 #define ADE9153A_VARACC_MSK NO_OS_GENMASK(3, 2)
351 #define ADE9153A_WATTACC_MSK NO_OS_GENMASK(1, 0)
354 #define ADE9153A_PEAK_SEL_MSK NO_OS_GENMASK(3, 2)
355 #define ADE9153A_OIB_EN_MSK NO_OS_BIT(1)
356 #define ADE9153A_OIA_EN_MSK NO_OS_BIT(0)
359 #define ADE9153A_DISZXLPF_MSK NO_OS_BIT(0)
362 #define ADE9153A_CF2SIGN_MSK NO_OS_BIT(7)
363 #define ADE9153A_CF1SIGN_MSK NO_OS_BIT(6)
364 #define ADE9153A_AVARSIGN_MSK NO_OS_BIT(1)
365 #define ADE9153A_AWSIGN_MSK NO_OS_BIT(0)
368 #define ADE9153A_UPERIOD_SEL_MSK NO_OS_BIT(12)
369 #define ADE9153A_HPF_CRN_MSK NO_OS_GENMASK(11, 9)
372 #define ADE9153A_NOLOAD_TMR_MSK NO_OS_GENMASK(7, 5)
373 #define ADE9153A_RD_RST_EN_MSK NO_OS_BIT(3)
374 #define ADE9153A_EGY_LD_ACCUM_MSK NO_OS_BIT(2)
375 #define ADE9153A_EGY_TMR_MODE_MSK NO_OS_BIT(1)
376 #define ADE9153A_EGY_PWR_EN_MSK NO_OS_BIT(0)
379 #define ADE9153A_FORCE_CRC_UPDATE_MSK NO_OS_BIT(0)
382 #define ADE9153A_TEMP_START_MSK NO_OS_BIT(3)
383 #define ADE9153A_TEMP_EN_MSK NO_OS_BIT(2)
384 #define ADE9153A_TEMP_TIME_MSK NO_OS_GENMASK(1, 0)
387 #define ADE9153A_TEMP_RESULT_MSK NO_OS_GENMASK(11, 0)
390 #define ADE9153A_AI_SWAP_MSK NO_OS_BIT(4)
391 #define ADE9153A_AI_GAIN_MSK NO_OS_GENMASK(2, 0)
394 #define ADE9153A_MS_SYSRDY_MSK NO_OS_BIT(14)
395 #define ADE9153A_MS_CONFERR_MSK NO_OS_BIT(13)
396 #define ADE9153A_MS_ABSENT_MSK NO_OS_BIT(12)
397 #define ADE9153A_MS_TIMEOUT_MSK NO_OS_BIT(3)
398 #define ADE9153A_MS_READY_MSK NO_OS_BIT(1)
399 #define ADE9153A_MS_SHIFT_MSK NO_OS_BIT(0)
402 #define ADE9153A_OIB_MSK NO_OS_BIT(5)
403 #define ADE9153A_OIA_MSK NO_OS_BIT(4)
404 #define ADE9153A_SWELLA_MSK NO_OS_BIT(2)
405 #define ADE9153A_DIPA_MSK NO_OS_BIT(0)
408 #define ADE9153A_UART_RESET_MSK NO_OS_BIT(7)
409 #define ADE9153A_UART_ERROR2_MSK NO_OS_BIT(6)
410 #define ADE9153A_UART_ERROR1_MSK NO_OS_BIT(5)
411 #define ADE9153A_UART_ERROR0_MSK NO_OS_BIT(4)
412 #define ADE9153A_ERROR3_MSK NO_OS_BIT(3)
413 #define ADE9153A_ERROR2_MSK NO_OS_BIT(2)
414 #define ADE9153A_ERROR1_MSK NO_OS_BIT(1)
415 #define ADE9153A_ERROR0_MSK NO_OS_BIT(0)
832 static void ade9153a_irq_handler(
void *dev);
850 static int ade9153a_update_bits(
struct ade9153a_dev *dev, uint16_t reg_addr,
851 uint32_t mask, uint32_t reg_data);
1083 uint32_t int_msk, uint8_t en);
1464 #endif // __ADE9153A_H__
#define ADE9153A_REVPCF2_MSK
Definition: ade9153a.h:295
int ade9153a_disable_crc_done_int(struct ade9153a_dev *dev)
Disable crc done interrupt.
Definition: ade9153a.c:2016
int ade9153a_enable_zxai_int(struct ade9153a_dev *dev)
Enable zero corssing detected on I ch A interrupt.
Definition: ade9153a.c:2086
int ade9153a_disable_cf1_int(struct ade9153a_dev *dev)
Disable CF1 interrupt.
Definition: ade9153a.c:2408
int ade9153a_get_temp_rdy(struct ade9153a_dev *dev, uint8_t *status)
Get new temperature reading ready indicator.
Definition: ade9153a.c:1259
#define ADE9153A_REVPCF1_MSK
Definition: ade9153a.h:296
#define ADE9153A_REG_AWATTHR_HI
Definition: ade9153a.h:149
@ ADE9153A_TEMP_TIME_SAMPLES_512
Definition: ade9153a.h:599
int ade9153a_temp_time(struct ade9153a_dev *dev, enum ade9153a_temp_time_e temp_no_samples)
Select the number of temperature readings to average.
Definition: ade9153a.c:3658
#define ADE9153A_EGY_PWR_EN_MSK
Definition: ade9153a.h:376
#define ADE9153A_ZX_SRC_SEL_MSK
Definition: ade9153a.h:247
int ade9153a_clear_cf1_chg(struct ade9153a_dev *dev)
Clear CF1 polarity change int mask.
Definition: ade9153a.c:1718
int ade9153a_temp_en(struct ade9153a_dev *dev)
Enable the temperature sensor.
Definition: ade9153a.c:3643
int ade9153a_cf2sel(struct ade9153a_dev *dev, enum ade9153a_cf2sel_e energy_type)
Set type of energy output on CF2 pin.
Definition: ade9153a.c:3056
int ade9153a_enable_temp_rdy_int(struct ade9153a_dev *dev)
Enable new temperature reading interrupt.
Definition: ade9153a.c:2226
void no_os_put_unaligned_be16(uint16_t val, uint8_t *buf)
int ade9153a_wr_lock(struct ade9153a_dev *dev)
Lock device.
Definition: ade9153a.c:608
#define ADE9153A_UART_ERROR0_MSK
Definition: ade9153a.h:411
int ade9153a_power_quality_vals(struct ade9153a_dev *dev, struct ade9153a_pq_values *data)
Read power quaility values.
Definition: ade9153a.c:4242
int32_t voltage_h_rms_reg_val
Definition: ade9153a.h:777
int ade9153a_temp_result(struct ade9153a_dev *dev, uint16_t *val)
Temperature result.
Definition: ade9153a.c:3694
int ade9153a_get_wattnl(struct ade9153a_dev *dev, uint8_t *status)
Get total active energy no load condition indicator.
Definition: ade9153a.c:1243
int ade9153a_zx_out_oe(struct ade9153a_dev *dev)
ZX driven to CF2 pin.
Definition: ade9153a.c:2999
#define ADE9153A_AUTOCAL_AV_MSK
Definition: ade9153a.h:255
#define ADE9153A_SWELLA_VAL_MSK
Definition: ade9153a.h:316
uint32_t timeout
Definition: ad413x.c:49
@ ADE9153A_AI_GAIN_24
Definition: ade9153a.h:613
ade9153a_get_zxav(struct ade9153a_dev *dev, uint8_t *status)
Get zero crossing detect on V ch indicator.
Definition: ade9153a.c:1179
int ade9153a_get_cf1_chg(struct ade9153a_dev *dev, uint8_t *status)
Get CF1 polarity change indicator.
Definition: ade9153a.c:1387
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
int ade9153a_lpf_ap_disable(struct ade9153a_dev *dev)
Disable the low-pass filter in the total active power datapath.
Definition: ade9153a.c:683
@ AUTOCAL_BI
Definition: ade9153a.h:443
#define ADE9153A_CF1SIGN_MSK
Definition: ade9153a.h:363
#define ADE9153A_START_16ADDR
Definition: ade9153a.h:82
#define ADE9153A_REG_CONFIG3
Definition: ade9153a.h:196
#define ADE9153A_MS_SHIFT_MSK
Definition: ade9153a.h:399
int32_t apparent_energy_reg_val
Definition: ade9153a.h:741
#define ADE9153A_CF2SEL_MSK
Definition: ade9153a.h:345
ade9153a_peak_sel_e
ADE9153A Peak sel.
Definition: ade9153a.h:525
int ade9153a_get_rms_oc_rdy(struct ade9153a_dev *dev, uint8_t *status)
Get RMS_OC values update indicator.
Definition: ade9153a.c:1275
#define ADE9153A_REG_EP_CFG
Definition: ade9153a.h:208
int ade9153a_clear_zxbi(struct ade9153a_dev *dev)
Clear zero crossing detect on I ch B int mask.
Definition: ade9153a.c:1494
int ade9153a_auto_calibration_cfg(struct ade9153a_dev *dev, enum ade9153a_acal_ch_e ch, enum ade9153a_acalmode_e mode)
Auto calibration config.
Definition: ade9153a.c:852
#define ADE9153A_VARACC_MSK
Definition: ade9153a.h:350
int ade9153a_temp_start(struct ade9153a_dev *dev)
Manually request a new temperature sensor reading.
Definition: ade9153a.c:3629
int ade9153a_sw_reset(struct ade9153a_dev *dev)
Reset the device using SW reset.
Definition: ade9153a.c:555
int ade9153a_enable_crc_chg_int(struct ade9153a_dev *dev)
Enable crc change interrupt.
Definition: ade9153a.c:1974
#define ADE9153A_REG_TEMP_CFG
Definition: ade9153a.h:212
uint32_t aicert_reg_val
Definition: ade9153a.h:814
int ade9153a_ms_ready(struct ade9153a_dev *dev, uint8_t *status)
mSure ready
Definition: ade9153a.c:3922
int ade9153a_power_quality_vals(struct ade9153a_dev *dev, struct ade9153a_pq_values *data)
Read power quaility values.
Definition: ade9153a.c:4242
@ ADE9153A_HPF_CORNER_9_895_HZ
Definition: ade9153a.h:550
int32_t fundamental_reactive_energy_reg_val
Definition: ade9153a.h:739
#define ADE9153A_CF1_MSK
Definition: ade9153a.h:294
int ade9153a_wattacc(struct ade9153a_dev *dev, enum ade9153a_accmode_e wattacc_type)
Select Total active power accumulation mode.
Definition: ade9153a.c:3211
int ade9153a_disable_egyrdy_int(struct ade9153a_dev *dev)
Disable EGYRDY interrupt.
Definition: ade9153a.c:2352
int ade9153a_hpf_crn(struct ade9153a_dev *dev, enum ade9153a_hpf_crn_e hpf_corner_freq)
Hpf corner freq.
Definition: ade9153a.c:3451
#define ADE9153A_REG_MS_STATUS_IRQ
Definition: ade9153a.h:216
int ade9153a_disable_wattnl_int(struct ade9153a_dev *dev)
Disable total active energy no load condition interrupt.
Definition: ade9153a.c:2212
int ade9153a_enable_egyrdy_int(struct ade9153a_dev *dev)
Enable EGYRDY interrupt.
Definition: ade9153a.c:2338
int ade9153a_zx_src_before_hpf_enable(struct ade9153a_dev *dev)
ZX data source before hpf and phase compensation.
Definition: ade9153a.c:771
int ade9153a_get_phnoload_status(struct ade9153a_dev *dev, uint8_t *status)
Get phnoload status.
Definition: ade9153a.c:2685
int ade9153a_get_rstdone(struct ade9153a_dev *dev, uint8_t *status)
Get reset done indicator.
Definition: ade9153a.c:1195
int ade9153a_rms_oc_src_x_wav_enable(struct ade9153a_dev *dev)
Use x_WAV waveforms after the high-pass filter and phase compensation for the RMS_OC calculation.
Definition: ade9153a.c:719
int ade9153a_clear_egyrdy(struct ade9153a_dev *dev)
Clear power values egy ready int mask.
Definition: ade9153a.c:1659
int ade9153a_awsign_status(struct ade9153a_dev *dev, uint8_t *status)
Sign of active power.
Definition: ade9153a.c:3409
@ ADE9153A_POSITIVE_ACC_MODE
Definition: ade9153a.h:516
#define ADE9153A_IPPHASE_MSK
Definition: ade9153a.h:267
int ade9153a_get_pf_rdy(struct ade9153a_dev *dev, uint8_t *status)
Get PF ready indicator.
Definition: ade9153a.c:1083
int ade9153a_disable_cf2_int(struct ade9153a_dev *dev)
Disable CF2 interrupt.
Definition: ade9153a.c:2380
int ade9153a_enable_zxbi_int(struct ade9153a_dev *dev)
Enable zero corssing detected on I ch B interrupt.
Definition: ade9153a.c:2058
int ade9153a_temp_en(struct ade9153a_dev *dev)
Enable the temperature sensor.
Definition: ade9153a.c:3643
#define ADE9153A_REVAPA_MSK
Definition: ade9153a.h:298
int ade9153a_enable_crc_done_int(struct ade9153a_dev *dev)
Enable crc done interrupt.
Definition: ade9153a.c:2002
int ade9153a_clear_rpa_chg_sgn(struct ade9153a_dev *dev)
Clear RPA (reactive power) sign change int mask.
Definition: ade9153a.c:1732
uint32_t vlevel
Definition: ade9153a.h:696
int ade9153a_ext_ref(struct ade9153a_dev *dev, uint8_t en)
External voltage reference enable/disable.
Definition: ade9153a.c:2864
#define ADE9153A_UART_ERROR2_MSK
Definition: ade9153a.h:409
int ade9153a_get_egyrdy(struct ade9153a_dev *dev, uint8_t *status)
Get power values egy ready indicator.
Definition: ade9153a.c:1323
int ade9153a_cf_acc_clr(struct ade9153a_dev *dev)
Clear accumulation in the digital freq conv.
Definition: ade9153a.c:2985
#define NO_OS_GENMASK(h, l)
Definition: no_os_util.h:82
@ ADE9153A_SETTLE_0_MS
Definition: ade9153a.h:485
@ ADE9153A_UART_ERROR1
Definition: ade9153a.h:636
@ ADE9153A_PGA_CHB_GAIN_4
Definition: ade9153a.h:432
int ade9153a_clear_rms_oc_rdy(struct ade9153a_dev *dev)
Clear RMS_OC values update int mask.
Definition: ade9153a.c:1614
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
int ade9153a_auto_calibration_stop(struct ade9153a_dev *dev)
Auto calibration stop.
Definition: ade9153a.c:926
#define ADE9153A_VERSION
Definition: ade9153a.h:76
int ade9153a_enable_zxav_int(struct ade9153a_dev *dev)
Enable zero corssing detected on V ch interrupt.
Definition: ade9153a.c:2114
#define ADE9153A_END_16ADDR
Definition: ade9153a.h:83
@ ADE9153A_PEAK_DETECTION_ENABLE_V_I_PHA
Definition: ade9153a.h:531
#define ADE9153A_REG_APF
Definition: ade9153a.h:132
int ade9153a_clear_crc_chg(struct ade9153a_dev *dev)
Clear CRC change int mask.
Definition: ade9153a.c:1449
int ade9153a_disable_zxbi_int(struct ade9153a_dev *dev)
Disable zero corssing detected on I ch B interrupt.
Definition: ade9153a.c:2072
int ade9153a_temp_start(struct ade9153a_dev *dev)
Manually request a new temperature sensor reading.
Definition: ade9153a.c:3629
#define ADE9153A_REG_AVA
Definition: ade9153a.h:130
Structure describing a callback to be registered.
Definition: no_os_irq.h:142
@ ADE9153A_HPF_CORNER_2_49_HZ
Definition: ade9153a.h:554
int ade9153a_msure_status(struct ade9153a_dev *dev, uint8_t *status)
mSure status
Definition: ade9153a.c:945
int32_t angle_ai_av_reg_val
Definition: ade9153a.h:790
int ade9153a_lpf_rp_disable(struct ade9153a_dev *dev)
Disable the low pass filter in the fundamental reactive power datapath.
Definition: ade9153a.c:666
#define ADE9153A_REG_CONFIG0
Definition: ade9153a.h:114
int ade9153a_get_crc_chg(struct ade9153a_dev *dev, uint8_t *status)
Get CRC change indicator.
Definition: ade9153a.c:1099
int ade9153a_get_cf2_chg(struct ade9153a_dev *dev, uint8_t *status)
Get CF2 polarity change indicator.
Definition: ade9153a.c:1371
int ade9153a_zx_src_after_hpf_enable(struct ade9153a_dev *dev)
ZX data source after hpf and phase compensation.
Definition: ade9153a.c:754
int ade9153a_get_zxtoav(struct ade9153a_dev *dev, uint8_t *status)
Get zero crossing timout on V ch indicator.
Definition: ade9153a.c:1131
int ade9153a_read(struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t *reg_data)
Read device register.
Definition: ade9153a.c:365
#define ADE9153A_TEMP_RESULT_MSK
Definition: ade9153a.h:387
int ade9153a_disable_revrpa_int(struct ade9153a_dev *dev)
Disable Phase A fundamental reactive power changed sign interrupt.
Definition: ade9153a.c:2492
#define ADE9153A_REG_AVRMS_OC
Definition: ade9153a.h:134
#define ADE9153A_ZXTOAV_MSK
Definition: ade9153a.h:280
int ade9153a_disable_rms_oc_rdy_int(struct ade9153a_dev *dev)
Disable RMS_OC values update interrupt.
Definition: ade9153a.c:2268
int ade9153a_get_zxbi(struct ade9153a_dev *dev, uint8_t *status)
Get zero crossing detect on I ch B indicator.
Definition: ade9153a.c:1147
#define ADE9153A_CF_LTMR_MSK
Definition: ade9153a.h:326
#define ADE9153A_REG_SWELLA
Definition: ade9153a.h:172
int ade9153a_disable_zxtoav_int(struct ade9153a_dev *dev)
Disable zero corssing timeout on voltage ch interrupt.
Definition: ade9153a.c:2044
Header file of SPI Interface.
int ade9153a_cf_ltmr_val(struct ade9153a_dev *dev, uint32_t *val)
cf_ltmr read value.
Definition: ade9153a.c:2788
int ade9153a_hpf_disable(struct ade9153a_dev *dev)
Disable hpf for all channels.
Definition: ade9153a.c:805
uint32_t avcert_reg_val
Definition: ade9153a.h:818
int ade9153a_bi_pgagain_set(struct ade9153a_dev *dev, enum ade9153a_bi_gain_e gain)
Set PGA gain for current channel B.
Definition: ade9153a.c:823
#define ADE9153A_OIA_VAL_MSK
Definition: ade9153a.h:304
int ade9153a_ms_sysrdy(struct ade9153a_dev *dev, uint8_t *status)
New run of mSure ready.
Definition: ade9153a.c:3814
Header file of IRQ interface.
@ AUTOCAL_AI
Definition: ade9153a.h:445
int32_t no_os_irq_register_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Register a callback to handle the irq events.
Definition: no_os_irq.c:92
#define ADE9153A_WATTACC_MSK
Definition: ade9153a.h:351
int ade9153a_start_autocal_ai(struct ade9153a_dev *dev, enum ade9153a_acalmode_e mode)
Start autocalibration AI channel.
Definition: ade9153a.c:4281
#define ADE9153A_STOP
Definition: ade9153a.h:73
#define ADE9153A_REG_OIB
Definition: ade9153a.h:166
uint8_t ai_swap
Definition: ade9153a.h:688
int ade9153a_egy_pwr_en(struct ade9153a_dev *dev)
Enable the energy and power accumulator when the run bit is also set.
Definition: ade9153a.c:3600
int ade9153a_start_autocal_bi(struct ade9153a_dev *dev, enum ade9153a_acalmode_e mode)
Start autocalibration BI channel.
Definition: ade9153a.c:4313
int ade9153a_disable_pwrrdy_int(struct ade9153a_dev *dev)
Disable PWRRDY interrupt.
Definition: ade9153a.c:2296
int ade9153a_enable_pf_rdy_int(struct ade9153a_dev *dev)
Enable pf ready interrupt.
Definition: ade9153a.c:1946
int ade9153a_clear_zxav(struct ade9153a_dev *dev)
Clear zero crossing detect on V ch int mask.
Definition: ade9153a.c:1524
int ade9153a_run(struct ade9153a_dev *dev)
Start measurements.
Definition: ade9153a.c:3733
int ade9153a_enable_vanl_int(struct ade9153a_dev *dev)
Enable total apparent energy no load condition interrupt.
Definition: ade9153a.c:2170
enum ade9153a_selfreq_e freq
Definition: ade9153a.h:694
int ade9153a_start_autocal_av(struct ade9153a_dev *dev, enum ade9153a_acalmode_e mode)
Start autocalibration AV channel.
Definition: ade9153a.c:4345
int ade9153a_enable_pf_rdy_int(struct ade9153a_dev *dev)
Enable pf ready interrupt.
Definition: ade9153a.c:1946
#define ADE9153A_NOLOAD_TMR_MSK
Definition: ade9153a.h:372
int ade9153a_disable_revapa_int(struct ade9153a_dev *dev)
Disable Phase A total active power changed sign interrupt.
Definition: ade9153a.c:2520
ADE9153A power registers values.
Definition: ade9153a.h:748
int ade9153a_peak_sel(struct ade9153a_dev *dev, enum ade9153a_peak_sel_e peak_sel)
Select peak detection channels.
Definition: ade9153a.c:3247
#define ADE9153A_UPERIOD_SEL_MSK
Definition: ade9153a.h:368
#define ADE9153A_CRC_CHG_MSK
Definition: ade9153a.h:278
int ade9153a_clear_rstdone(struct ade9153a_dev *dev)
Clear reset done int mask.
Definition: ade9153a.c:1539
#define ADE9153A_REG_CRC_FORCE
Definition: ade9153a.h:211
#define ADE9153A_REG_VDIV_RSMALL
Definition: ade9153a.h:124
int ade9153a_cf2dis(struct ade9153a_dev *dev)
CF2 output disable.
Definition: ade9153a.c:3027
int ade9153a_set_interface_spi(struct ade9153a_dev *dev)
Select comms interface SPI.
Definition: ade9153a.c:65
#define ADE9153A_REG_ACCMODE
Definition: ade9153a.h:195
int ade9153a_half_rms_vals(struct ade9153a_dev *dev, struct ade9153a_half_rms_values *data)
Read half rms values.
Definition: ade9153a.c:4209
enum ade9153a_ai_gain_e ai_pga_gain
Definition: ade9153a.h:690
int ade9153a_stop(struct ade9153a_dev *dev)
Stop measurements.
Definition: ade9153a.c:3748
#define ADE9153A_AUTOCAL_AI_MSK
Definition: ade9153a.h:257
#define ADE9153A_OIA_EN_MSK
Definition: ade9153a.h:356
int ade9153a_ai_swap(struct ade9153a_dev *dev, uint8_t set)
Set the signal side of the PGA.
Definition: ade9153a.c:3764
#define ADE9153A_CF_ACC_CLR_MSK
Definition: ade9153a.h:337
Header file of Delay functions.
int ade9153a_get_cf1_chg(struct ade9153a_dev *dev, uint8_t *status)
Get CF1 polarity change indicator.
Definition: ade9153a.c:1387
int ade9153a_disable_zxav_int(struct ade9153a_dev *dev)
Disable zero corssing detected on V ch interrupt.
Definition: ade9153a.c:2128
int ade9153a_disable_zxai_int(struct ade9153a_dev *dev)
Disable zero corssing detected on I ch A interrupt.
Definition: ade9153a.c:2100
ADE9153a Device initialization parameters.
Definition: ade9153a.h:672
int ade9153a_oib_en(struct ade9153a_dev *dev)
Ch B overcurretn detection enable.
Definition: ade9153a.c:3285
#define ADE9153A_MS_ABSENT_MSK
Definition: ade9153a.h:396
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:115
#define ADE9153A_DISRPLPF_MSK
Definition: ade9153a.h:243
int ade9153a_get_cf2(struct ade9153a_dev *dev, uint8_t *status)
Get CF2 pulse issued indicator.
Definition: ade9153a.c:1339
int ade9153a_cf1_lt_status(struct ade9153a_dev *dev, uint8_t *status)
CF1_LT status.
Definition: ade9153a.c:2746
#define ADE9153A_REVRPA_MSK
Definition: ade9153a.h:297
int ade9153a_auto_calibration_stop(struct ade9153a_dev *dev)
Auto calibration stop.
Definition: ade9153a.c:926
int ade9153a_disable_egyrdy_int(struct ade9153a_dev *dev)
Disable EGYRDY interrupt.
Definition: ade9153a.c:2352
#define ADE9153A_RMS_OC_SRC_MSK
Definition: ade9153a.h:246
#define ADE9153A_ZXAV_MSK
Definition: ade9153a.h:283
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: ade9153a.h:726
int ade9153a_disable_revapa_int(struct ade9153a_dev *dev)
Disable Phase A total active power changed sign interrupt.
Definition: ade9153a.c:2520
@ ADE9153A_NOLOAD_TMR_SAMPLES_128
Definition: ade9153a.h:573
#define ADE9153A_OILVL_VAL_MSK
Definition: ade9153a.h:301
int ade9153a_clear_crc_chg(struct ade9153a_dev *dev)
Clear CRC change int mask.
Definition: ade9153a.c:1449
void(* drdy_callback)(void *context)
Definition: ade9153a.h:705
@ ADE9153A_TEMP_TIME_SAMPLES_1024
Definition: ade9153a.h:601
int ade9153a_clear_vanl(struct ade9153a_dev *dev)
Clear total apparent energy no load condition int mask.
Definition: ade9153a.c:1569
@ ADE9153A_TOTAL_FUNDAMENTAL_REACTIVE_POWER
Definition: ade9153a.h:501
int ade9153a_get_rpa_chg_sgn(struct ade9153a_dev *dev, uint8_t *status)
Get RPA (reactive power) sign change indicator.
Definition: ade9153a.c:1403
#define ENABLE
Definition: ad77681.h:339
int ade9153a_get_zxav(struct ade9153a_dev *dev, uint8_t *status)
Get zero crossing detect on V ch indicator.
Definition: ade9153a.c:1179
int ade9153a_clear_rpa_chg_sgn(struct ade9153a_dev *dev)
Clear RPA (reactive power) sign change int mask.
Definition: ade9153a.c:1732
int ade9153a_temp_val(struct ade9153a_dev *dev, struct ade9153a_temperature_value *data)
Temperature value in deg C.
Definition: ade9153a.c:4025
#define ADE9153A_OIB_EN_MSK
Definition: ade9153a.h:355
@ ADE9153A_NOLOAD_TMR_SAMPLES_4096
Definition: ade9153a.h:583
Definition: ad9361_util.h:69
struct no_os_gpio_desc * gpio_reset
Definition: ade9153a.h:720
int ade9153a_clear_dready(struct ade9153a_dev *dev)
Clear new waveform samples ready int mask.
Definition: ade9153a.c:1644
struct no_os_gpio_init_param * gpio_rdy
Definition: ade9153a.h:676
#define ADE9153A_REG_VERSION_PRODUCT
Definition: ade9153a.h:146
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
int ade9153a_read_autocal_vals(struct ade9153a_dev *dev, struct ade9153a_autocal_vals *data)
Read autocalibration values.
Definition: ade9153a.c:4377
int ade9153a_disable_zxai_int(struct ade9153a_dev *dev)
Disable zero corssing detected on I ch A interrupt.
Definition: ade9153a.c:2100
int ade9153a_disable_dready_int(struct ade9153a_dev *dev)
Disable data ready interrupt.
Definition: ade9153a.c:2324
int ade9153a_noload_tmr(struct ade9153a_dev *dev, enum ade9153a_noload_tmr_e noload_samples)
Set no. of samples for no load condition.
Definition: ade9153a.c:3503
int ade9153a_egy_pwr_en(struct ade9153a_dev *dev)
Enable the energy and power accumulator when the run bit is also set.
Definition: ade9153a.c:3600
int ade9153a_get_zxtoav(struct ade9153a_dev *dev, uint8_t *status)
Get zero crossing timout on V ch indicator.
Definition: ade9153a.c:1131
NO_OS_DECLARE_CRC16_TABLE(ade9153a_crc16)
int ade9153a_enable_revpcf2_int(struct ade9153a_dev *dev)
Enable CF2 polarity change sign interrupt.
Definition: ade9153a.c:2422
int ade9153a_disable_fvarnl_int(struct ade9153a_dev *dev)
Disable fundamental reactive energy no load condition interrupt.
Definition: ade9153a.c:2156
int ade9153a_clear_crc_done(struct ade9153a_dev *dev)
Clear CRC done int mask.
Definition: ade9153a.c:1464
#define ADE9153A_HPF_CRN_MSK
Definition: ade9153a.h:369
#define ADE9153A_REG_CF_LCFG
Definition: ade9153a.h:183
int ade9153a_clear_ms_stat(struct ade9153a_dev *dev, uint32_t *reg_val)
Clear MS status int.
Definition: ade9153a.c:1831
#define ADE9153A_REG_OI_LVL
Definition: ade9153a.h:164
#define ADE9153A_CRC_DONE_MSK
Definition: ade9153a.h:279
int ade9153a_temp_offset_val(struct ade9153a_dev *dev, uint32_t *val)
temperature sensor offset.
Definition: ade9153a.c:2813
#define ADE9153A_SELFREQ_MSK
Definition: ade9153a.h:349
int ade9153a_write(struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t reg_data)
Write device register.
Definition: ade9153a.c:445
#define ADE9153A_REG_AI_PGAGAIN
Definition: ade9153a.h:214
#define ADE9153A_FVARNL_MSK
Definition: ade9153a.h:285
int ade9153a_clear_zxai(struct ade9153a_dev *dev)
Clear zero crossing detect on I ch A int mask.
Definition: ade9153a.c:1509
#define ADE9153A_EGY_LD_ACCUM_MSK
Definition: ade9153a.h:374
int ade9153a_version_product(struct ade9153a_dev *dev, uint32_t *data_read)
Version product.
Definition: ade9153a.c:641
int ade9153a_power_vals(struct ade9153a_dev *dev, struct ade9153a_power_values *data)
Read power values.
Definition: ade9153a.c:4137
int ade9153a_wattacc(struct ade9153a_dev *dev, enum ade9153a_accmode_e wattacc_type)
Select Total active power accumulation mode.
Definition: ade9153a.c:3211
int ade9153a_enable_vanl_int(struct ade9153a_dev *dev)
Enable total apparent energy no load condition interrupt.
Definition: ade9153a.c:2170
int ade9153a_hpf_crn(struct ade9153a_dev *dev, enum ade9153a_hpf_crn_e hpf_corner_freq)
Hpf corner freq.
Definition: ade9153a.c:3451
#define ADE9153A_REG_VPEAK
Definition: ade9153a.h:161
int ade9153a_enable_chip_stat_int(struct ade9153a_dev *dev)
Enable an interrupt when any bit in CHIP_STATUS reg is set.
Definition: ade9153a.c:1862
int ade9153a_selfreq(struct ade9153a_dev *dev, enum ade9153a_selfreq_e freq)
Frequency select.
Definition: ade9153a.c:3122
#define ADE9153A_AI_GAIN_MSK
Definition: ade9153a.h:391
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
int ade9153a_clear_fvarnl(struct ade9153a_dev *dev)
Clear fundamental reactive energy no load condition int mask.
Definition: ade9153a.c:1554
int ade9153a_chip_status(struct ade9153a_dev *dev, uint8_t *status)
Chip status.
Definition: ade9153a.c:3976
int ade9153a_rms_oc_src_adc_samples_enable(struct ade9153a_dev *dev)
Use ADC samples, before the high-pass filter for the RMS_OC calculation.
Definition: ade9153a.c:737
#define ADE9153A_REG_IPEAK
Definition: ade9153a.h:160
ade9153a_bi_gain_e
ADE9153A Bi Gain.
Definition: ade9153a.h:425
#define ADE9153A_SWRST_MSK
Definition: ade9153a.h:340
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:124
int ade9153a_dipa_val(struct ade9153a_dev *dev, uint32_t *val)
Voltage value during dip condition.
Definition: ade9153a.c:2635
@ NO_OS_IRQ_EDGE_FALLING
Definition: no_os_irq.h:79
#define ADE9153A_MS_SYSRDY_MSK
Definition: ade9153a.h:394
int ade9153a_ipk_val(struct ade9153a_dev *dev, uint32_t *val)
Ipeak val.
Definition: ade9153a.c:1005
#define ADE9153A_REG_EGY_TIME
Definition: ade9153a.h:210
int ade9153a_disable_cf2_int(struct ade9153a_dev *dev)
Disable CF2 interrupt.
Definition: ade9153a.c:2380
int ade9153a_clear_rms_oc_rdy(struct ade9153a_dev *dev)
Clear RMS_OC values update int mask.
Definition: ade9153a.c:1614
int ade9153a_cf_acc_clr(struct ade9153a_dev *dev)
Clear accumulation in the digital freq conv.
Definition: ade9153a.c:2985
int ade9153a_get_vanl(struct ade9153a_dev *dev, uint8_t *status)
Get total apparent energy no load condition indicator.
Definition: ade9153a.c:1227
int ade9153a_get_apa_chg_sgn(struct ade9153a_dev *dev, uint8_t *status)
Get APA (active power) sign change indicator.
Definition: ade9153a.c:1419
#define ADE9153A_CF2_MSK
Definition: ade9153a.h:293
int ade9153a_get_pwrrdy(struct ade9153a_dev *dev, uint8_t *status)
Get power values registers update indicator.
Definition: ade9153a.c:1291
int ade9153a_auto_calibration_run(struct ade9153a_dev *dev)
Auto calibration run.
Definition: ade9153a.c:901
#define ADE9153A_DREADY_MSK
Definition: ade9153a.h:291
int ade9153a_get_dready(struct ade9153a_dev *dev, uint8_t *status)
Get new waveform samples ready indicator.
Definition: ade9153a.c:1307
int32_t fundamental_reactive_power_reg_val
Definition: ade9153a.h:752
int ade9153a_ext_ref_status(struct ade9153a_dev *dev, uint8_t *status)
External_reference status.
Definition: ade9153a.c:2876
ADE9153A power quality registers values.
Definition: ade9153a.h:784
int ade9153a_hw_reset(struct ade9153a_dev *dev)
Reset the device using HW reset.
Definition: ade9153a.c:578
int32_t apparent_power_reg_val
Definition: ade9153a.h:754
int ade9153a_zx_out_oe(struct ade9153a_dev *dev)
ZX driven to CF2 pin.
Definition: ade9153a.c:2999
#define ADE9153A_TEMP_OFFSET_MSK
Definition: ade9153a.h:329
@ ADE9153A_ABSOLUTE_VAL_ACC_MODE
Definition: ade9153a.h:514
int ade9153a_enable_chip_stat_int(struct ade9153a_dev *dev)
Enable an interrupt when any bit in CHIP_STATUS reg is set.
Definition: ade9153a.c:1862
int ade9153a_ip_phase(struct ade9153a_dev *dev, uint8_t *ch)
Ipeak channel phase.
Definition: ade9153a.c:972
#define ADE9153A_TEMP_TIME_MSK
Definition: ade9153a.h:384
int ade9153a_egy_tmr_mode(struct ade9153a_dev *dev, uint8_t en)
Energy accumulated based on the number of 4 kSPS samples or zero-crossing events.
Definition: ade9153a.c:3586
#define ADE9153A_ERROR1_MSK
Definition: ade9153a.h:414
#define ADE9153A_REG_AIRMS_OC
Definition: ade9153a.h:133
#define ADE9153A_CRC16_POLY
Definition: ade9153a.h:86
#define ADE9153A_REG_TEMP_RSLT
Definition: ade9153a.h:213
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
int ade9153a_cf2_lt_status(struct ade9153a_dev *dev, uint8_t *status)
CF2_LT status.
Definition: ade9153a.c:2719
int ade9153a_avarsign_status(struct ade9153a_dev *dev, uint8_t *status)
Sign of reactive power.
Definition: ade9153a.c:3382
int ade9153a_clear_event_stat(struct ade9153a_dev *dev, uint32_t *reg_val)
Clear event status int.
Definition: ade9153a.c:1803
#define ADE9153A_AFVARNL_MSK
Definition: ade9153a.h:319
int ade9153a_enable_rms_oc_rdy_int(struct ade9153a_dev *dev)
Enable RMS_OC values update interrupt.
Definition: ade9153a.c:2254
int ade9153a_get_zxai(struct ade9153a_dev *dev, uint8_t *status)
Get zero crossing detect on I ch A indicator.
Definition: ade9153a.c:1163
int ade9153a_get_dready(struct ade9153a_dev *dev, uint8_t *status)
Get new waveform samples ready indicator.
Definition: ade9153a.c:1307
#define ADE9153A_REG_APERIOD
Definition: ade9153a.h:173
int ade9153a_enable_zxai_int(struct ade9153a_dev *dev)
Enable zero corssing detected on I ch A interrupt.
Definition: ade9153a.c:2086
int ade9153a_disable_event_stat_int(struct ade9153a_dev *dev)
Disable EVENT_STAT interrupt.
Definition: ade9153a.c:1904
int ade9153a_get_temp_rdy(struct ade9153a_dev *dev, uint8_t *status)
Get new temperature reading ready indicator.
Definition: ade9153a.c:1259
int ade9153a_oib_en(struct ade9153a_dev *dev)
Ch B overcurretn detection enable.
Definition: ade9153a.c:3285
#define ADE9153A_REG_AFVAR
Definition: ade9153a.h:131
int ade9153a_set_interface_serial(struct ade9153a_dev *dev)
Select comms interface Serial.
Definition: ade9153a.c:97
int ade9153a_init(struct ade9153a_dev **device, struct ade9153a_init_param init_param)
Initialize the device.
Definition: ade9153a.c:157
int ade9153a_force_crc_update(struct ade9153a_dev *dev)
Force CRC calculation to start (update).
Definition: ade9153a.c:3614
@ TURBO
Definition: ade9153a.h:456
#define ADE9153A_CF2_LT_MSK
Definition: ade9153a.h:324
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
int ade9153a_disable_revpcf1_int(struct ade9153a_dev *dev)
Disable CF1 polarity change sign interrupt.
Definition: ade9153a.c:2464
int ade9153a_ms_timeout(struct ade9153a_dev *dev, uint8_t *status)
mSure timed out (600s)
Definition: ade9153a.c:3895
int ade9153a_get_ms_stat(struct ade9153a_dev *dev, uint8_t *status)
Get MS status indicator.
Definition: ade9153a.c:1817
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
int ade9153a_get_cf2(struct ade9153a_dev *dev, uint8_t *status)
Get CF2 pulse issued indicator.
Definition: ade9153a.c:1339
int ade9153a_auto_calibration_cfg(struct ade9153a_dev *dev, enum ade9153a_acal_ch_e ch, enum ade9153a_acalmode_e mode)
Auto calibration config.
Definition: ade9153a.c:852
@ ADE9153A_TEMP_TIME_SAMPLES_1
Definition: ade9153a.h:595
#define ADE9153A_NO_BYTES_W_32
Definition: ade9153a.h:90
int ade9153a_cf1sel(struct ade9153a_dev *dev, enum ade9153a_cf2sel_e energy_type)
Set type of energy output on CF1 pin.
Definition: ade9153a.c:3089
int32_t no_os_irq_set_priority(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, uint32_t priority_level)
Set the priority for an interrupt.
Definition: no_os_irq.c:216
int ade9153a_disable_revpcf2_int(struct ade9153a_dev *dev)
Disable CF2 polarity change sign interrupt.
Definition: ade9153a.c:2436
int ade9153a_start_autocal_ai(struct ade9153a_dev *dev, enum ade9153a_acalmode_e mode)
Start autocalibration AI channel.
Definition: ade9153a.c:4281
int ade9153a_enable_revapa_int(struct ade9153a_dev *dev)
Enable Phase A total active power changed sign interrupt.
Definition: ade9153a.c:2506
int ade9153a_compmode(struct ade9153a_dev *dev)
COMPMODE.
Definition: ade9153a.c:3718
int ade9153a_rd_rst_en(struct ade9153a_dev *dev)
Energy register read with value reset.
Definition: ade9153a.c:3554
int ade9153a_wr_unlock(struct ade9153a_dev *dev)
Unlock device.
Definition: ade9153a.c:624
int ade9153a_lpf_ap_disable(struct ade9153a_dev *dev)
Disable the low-pass filter in the total active power datapath.
Definition: ade9153a.c:683
#define ADE9153A_UART_RESET_MSK
Definition: ade9153a.h:408
ADE9153A energy registers values.
Definition: ade9153a.h:735
int ade9153a_read_autocal_vals(struct ade9153a_dev *dev, struct ade9153a_autocal_vals *data)
Read autocalibration values.
Definition: ade9153a.c:4377
int ade9153a_freq_s_status(struct ade9153a_dev *dev, uint8_t *status)
Frequency setting.
Definition: ade9153a.c:3148
@ ADE9153A_AI_GAIN_16
Definition: ade9153a.h:611
int ade9153a_cf1dis(struct ade9153a_dev *dev)
CF1 output disable.
Definition: ade9153a.c:3041
#define ADE9153A_ACALMODE_AI_MSK
Definition: ade9153a.h:259
int ade9153a_enable_revpcf2_int(struct ade9153a_dev *dev)
Enable CF2 polarity change sign interrupt.
Definition: ade9153a.c:2422
#define ADE9153A_NO_BYTES_R_32
Definition: ade9153a.h:92
#define ADE9153A_MS_READY_MSK
Definition: ade9153a.h:398
int ade9153a_cf2sign_status(struct ade9153a_dev *dev, uint8_t *status)
Sign of CF2 power.
Definition: ade9153a.c:3328
#define ADE9153A_AWATTNL_MSK
Definition: ade9153a.h:321
int ade9153a_disable_vanl_int(struct ade9153a_dev *dev)
Disable total apparent energy no load condition interrupt.
Definition: ade9153a.c:2184
#define ADE9153A_DREADY_OE_MSK
Definition: ade9153a.h:339
int ade9153a_enable_crc_chg_int(struct ade9153a_dev *dev)
Enable crc change interrupt.
Definition: ade9153a.c:1974
int ade9153a_enable_crc_done_int(struct ade9153a_dev *dev)
Enable crc done interrupt.
Definition: ade9153a.c:2002
int ade9153a_energy_vals(struct ade9153a_dev *dev, struct ade9153a_energy_values *data)
Read energy values.
Definition: ade9153a.c:4098
int ade9153a_enable_cf1_int(struct ade9153a_dev *dev)
Enable CF1 interrupt.
Definition: ade9153a.c:2394
#define ADE9153A_CF1_LT_MSK
Definition: ade9153a.h:325
int ade9153a_disable_zxav_int(struct ade9153a_dev *dev)
Disable zero corssing detected on V ch interrupt.
Definition: ade9153a.c:2128
int ade9153a_clear_cf2_chg(struct ade9153a_dev *dev)
Clear CF2 polarity change int mask.
Definition: ade9153a.c:1704
int ade9153a_enable_pwrrdy_int(struct ade9153a_dev *dev)
Enable PWRRDY interrupt.
Definition: ade9153a.c:2282
uint32_t aicc_reg_val
Definition: ade9153a.h:812
int ade9153a_disable_wattnl_int(struct ade9153a_dev *dev)
Disable total active energy no load condition interrupt.
Definition: ade9153a.c:2212
int ade9153a_clear_apa_chg_sgn(struct ade9153a_dev *dev)
Clear APA (active power) sign change int mask.
Definition: ade9153a.c:1746
#define ADE9153A_ZXBI_MSK
Definition: ade9153a.h:281
@ ADE9153A_UART_ERROR2
Definition: ade9153a.h:638
int ade9153a_ms_conferr(struct ade9153a_dev *dev, uint8_t *status)
Invalid config of mSure status.
Definition: ade9153a.c:3841
int ade9153a_rd_rst_en(struct ade9153a_dev *dev)
Energy register read with value reset.
Definition: ade9153a.c:3554
int ade9153a_peak_sel(struct ade9153a_dev *dev, enum ade9153a_peak_sel_e peak_sel)
Select peak detection channels.
Definition: ade9153a.c:3247
@ AWATTNL
Definition: ade9153a.h:654
ade9153a_hpf_crn_e
ADE9153A Hpf crn high pass filter corner freq.
Definition: ade9153a.h:543
#define ADE9153A_UART_ERROR1_MSK
Definition: ade9153a.h:410
int ade9153a_i_ch_b_int_enable(struct ade9153a_dev *dev)
Current channel B integrator enable.
Definition: ade9153a.c:788
@ F_50_HZ
Definition: ade9153a.h:465
int ade9153a_disable_pf_rdy_int(struct ade9153a_dev *dev)
Disable pf ready interrupt.
Definition: ade9153a.c:1960
#define ADE9153A_REG_PHNOLOAD
Definition: ade9153a.h:177
int ade9153a_disable_temp_rdy_int(struct ade9153a_dev *dev)
Disable new temperature reading interrupt.
Definition: ade9153a.c:2240
int ade9153a_dready_oe(struct ade9153a_dev *dev)
DREADY driven to CF2 pin.
Definition: ade9153a.c:3013
int ade9153a_ms_shift(struct ade9153a_dev *dev, uint8_t *status)
mSure shift detected in CC val
Definition: ade9153a.c:3949
int ade9153a_vpk_val(struct ade9153a_dev *dev, uint32_t *val)
Vpeak val.
Definition: ade9153a.c:1030
int ade9153a_set_interface_spi(struct ade9153a_dev *dev)
Select comms interface SPI.
Definition: ade9153a.c:65
int ade9153a_clear_fvarnl(struct ade9153a_dev *dev)
Clear fundamental reactive energy no load condition int mask.
Definition: ade9153a.c:1554
int ade9153a_get_event_stat(struct ade9153a_dev *dev, uint8_t *status)
Get event status indicator.
Definition: ade9153a.c:1789
int ade9153a_disable_crc_chg_int(struct ade9153a_dev *dev)
Disable crc change interrupt.
Definition: ade9153a.c:1988
int ade9153a_cf1sign_status(struct ade9153a_dev *dev, uint8_t *status)
Sign of CF1 power.
Definition: ade9153a.c:3355
int ade9153a_enable_event_stat_int(struct ade9153a_dev *dev)
Enable an interrupt when any bit in EVENT_STATUS reg is set.
Definition: ade9153a.c:1890
int ade9153a_get_rms_oc_rdy(struct ade9153a_dev *dev, uint8_t *status)
Get RMS_OC values update indicator.
Definition: ade9153a.c:1275
int ade9153a_clear_cf2(struct ade9153a_dev *dev)
Clear CF2 pulse issued int mask.
Definition: ade9153a.c:1674
int ade9153a_vlevel_val(struct ade9153a_dev *dev, uint32_t *val)
Vlevel val.
Definition: ade9153a.c:2610
@ ADE9153A_SETTLE_256_MS
Definition: ade9153a.h:483
int ade9153a_egy_tmr_mode(struct ade9153a_dev *dev, uint8_t en)
Energy accumulated based on the number of 4 kSPS samples or zero-crossing events.
Definition: ade9153a.c:3586
int ade9153a_enable_revapa_int(struct ade9153a_dev *dev)
Enable Phase A total active power changed sign interrupt.
Definition: ade9153a.c:2506
#define ADE9153A_ERROR3_MSK
Definition: ade9153a.h:412
ADE9153A temperature value.
Definition: ade9153a.h:810
@ ADE9153A_UART_RESET
Definition: ade9153a.h:640
int ade9153a_swella_val(struct ade9153a_dev *dev, uint32_t *val)
Voltage value during swell condition.
Definition: ade9153a.c:2660
@ ADE9153A_NOLOAD_TMR_SAMPLES_64
Definition: ade9153a.h:571
int ade9153a_freq_s_status(struct ade9153a_dev *dev, uint8_t *status)
Frequency setting.
Definition: ade9153a.c:3148
struct no_os_callback_desc irq_cb
Definition: ade9153a.h:728
void no_os_put_unaligned_be32(uint32_t val, uint8_t *buf)
int ade9153a_enable_zxtoav_int(struct ade9153a_dev *dev)
Enable zero corssing timeout on voltage ch interrupt.
Definition: ade9153a.c:2030
int ade9153a_msure_status(struct ade9153a_dev *dev, uint8_t *status)
mSure status
Definition: ade9153a.c:945
int ade9153a_ms_ready(struct ade9153a_dev *dev, uint8_t *status)
mSure ready
Definition: ade9153a.c:3922
int ade9153a_enable_ms_stat_int(struct ade9153a_dev *dev)
Enable an interrupt when any bit in MS_STATUS_IRQ reg is set.
Definition: ade9153a.c:1918
@ ADE9153A_HPF_CORNER_4_9675_HZ
Definition: ade9153a.h:552
int ade9153a_get_cf1(struct ade9153a_dev *dev, uint8_t *status)
Get CF1 pulse issued indicator.
Definition: ade9153a.c:1355
enum ade9153a_hpf_crn_e hpf_crn
Definition: ade9153a.h:692
Header file of CRC-16 computation.
ade9153a_phnoload_e
Type of energy that is in no load condition.
Definition: ade9153a.h:647
int ade9153a_get_crc_chg(struct ade9153a_dev *dev, uint8_t *status)
Get CRC change indicator.
Definition: ade9153a.c:1099
int ade9153a_bi_pgagain_set(struct ade9153a_dev *dev, enum ade9153a_bi_gain_e gain)
Set PGA gain for current channel B.
Definition: ade9153a.c:823
#define ADE9153A_RSTDONE_MSK
Definition: ade9153a.h:284
int ade9153a_energy_vals(struct ade9153a_dev *dev, struct ade9153a_energy_values *data)
Read energy values.
Definition: ade9153a.c:4098
dip_swell_irq_mode_en
Dip swell irq mode.
Definition: ade9153a.h:661
int ade9153a_force_crc_update(struct ade9153a_dev *dev)
Force CRC calculation to start (update).
Definition: ade9153a.c:3614
int ade9153a_enable_revrpa_int(struct ade9153a_dev *dev)
Enable Phase A fundamental reactive power changed sign interrupt.
Definition: ade9153a.c:2478
int ade9153a_cf1sign_status(struct ade9153a_dev *dev, uint8_t *status)
Sign of CF1 power.
Definition: ade9153a.c:3355
struct no_os_gpio_desc * gpio_ss
Definition: ade9153a.h:722
@ ADE9153A_HPF_CORNER_1_2475_HZ
Definition: ade9153a.h:556
int32_t power_factor_reg_val
Definition: ade9153a.h:786
ade9153a_temp_time_e
ADE9153A Temperature readings.
Definition: ade9153a.h:592
#define ADE9153A_REG_AFVARHR_HI
Definition: ade9153a.h:155
int ade9153a_temp_val(struct ade9153a_dev *dev, struct ade9153a_temperature_value *data)
Temperature value in deg C.
Definition: ade9153a.c:4025
int ade9153a_i_ch_b_int_enable(struct ade9153a_dev *dev)
Current channel B integrator enable.
Definition: ade9153a.c:788
struct no_os_spi_init_param * spi_init
Definition: ade9153a.h:674
int ade9153a_avarsign_status(struct ade9153a_dev *dev, uint8_t *status)
Sign of reactive power.
Definition: ade9153a.c:3382
#define DISABLE
Definition: ad77681.h:340
int32_t no_os_irq_unregister_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Unregisters a generic IRQ handling function.
Definition: no_os_irq.c:112
int ade9153a_get_ms_stat(struct ade9153a_dev *dev, uint8_t *status)
Get MS status indicator.
Definition: ade9153a.c:1817
int ade9153a_cf_ltmr_write(struct ade9153a_dev *dev, uint32_t reg_data)
cf_ltmr write value.
Definition: ade9153a.c:2773
ADE9153A rms registers values.
Definition: ade9153a.h:761
uint32_t no_os_get_unaligned_be24(uint8_t *buf)
int ade9153a_get_crc_done(struct ade9153a_dev *dev, uint8_t *status)
Get CRC done indicator.
Definition: ade9153a.c:1115
int ade9153a_oia_en(struct ade9153a_dev *dev)
Ch A overcurretn detection enable.
Definition: ade9153a.c:3299
int ade9153a_get_event_stat(struct ade9153a_dev *dev, uint8_t *status)
Get event status indicator.
Definition: ade9153a.c:1789
int ade9153a_ai_gain(struct ade9153a_dev *dev, enum ade9153a_ai_gain_e gain)
Set the PGA gain for I chA.
Definition: ade9153a.c:3779
int ade9153a_remove(struct ade9153a_dev *dev)
Remove the device and release resources.
Definition: ade9153a.c:513
int ade9153a_setup(void *dev, struct ade9153a_init_param init_param)
ADE9153A setup.
Definition: ade9153a.c:295
int ade9153a_dipa_val(struct ade9153a_dev *dev, uint32_t *val)
Voltage value during dip condition.
Definition: ade9153a.c:2635
int ade9153a_selfreq(struct ade9153a_dev *dev, enum ade9153a_selfreq_e freq)
Frequency select.
Definition: ade9153a.c:3122
int ade9153a_clear_cf2(struct ade9153a_dev *dev)
Clear CF2 pulse issued int mask.
Definition: ade9153a.c:1674
#define ADE9153A_EXT_REF_MSK
Definition: ade9153a.h:333
#define ADE9153A_EGYRDY_MSK
Definition: ade9153a.h:292
int ade9153a_dip_swell_irq_mode(struct ade9153a_dev *dev, enum dip_swell_irq_mode_en mode)
Dip swell interrupt mode.
Definition: ade9153a.c:2903
#define ADE9153A_PWRRDY_MSK
Definition: ade9153a.h:290
#define ADE9153A_HPFDIS_MSK
Definition: ade9153a.h:249
#define ADE9153A_REG_AVRMS
Definition: ade9153a.h:128
struct no_os_gpio_desc * gpio_sck
Definition: ade9153a.h:724
#define ADE9153A_ZX_OUT_OE_MSK
Definition: ade9153a.h:338
int ade9153a_rms_oc_src_x_wav_enable(struct ade9153a_dev *dev)
Use x_WAV waveforms after the high-pass filter and phase compensation for the RMS_OC calculation.
Definition: ade9153a.c:719
@ ADE9153A_PEAK_DETECTION_DISABLE_PHA_PHB
Definition: ade9153a.h:528
int ade9153a_enable_revpcf1_int(struct ade9153a_dev *dev)
Enable CF1 polarity change sign interrupt.
Definition: ade9153a.c:2450
struct no_os_spi_desc * spi_desc
Definition: ade9153a.h:714
#define ADE9153A_REG_PHSIGN
Definition: ade9153a.h:202
int ade9153a_temp_gain_val(struct ade9153a_dev *dev, uint32_t *val)
temperature sensor gain.
Definition: ade9153a.c:2839
#define ADE9153A_ZXAI_MSK
Definition: ade9153a.h:282
struct no_os_gpio_desc * gpio_rdy
Definition: ade9153a.h:718
#define ADE9153A_VLEVEL_VAL_MSK
Definition: ade9153a.h:310
#define ADE9153A_REG_BI_PGAGAIN
Definition: ade9153a.h:117
int ade9153a_disable_ms_stat_int(struct ade9153a_dev *dev)
Disable MS_STAT interrupt.
Definition: ade9153a.c:1932
#define ADE9153A_VANL_MSK
Definition: ade9153a.h:286
int ade9153a_disable_crc_done_int(struct ade9153a_dev *dev)
Disable crc done interrupt.
Definition: ade9153a.c:2016
int ade9153a_get_cf1(struct ade9153a_dev *dev, uint8_t *status)
Get CF1 pulse issued indicator.
Definition: ade9153a.c:1355
int ade9153a_stop(struct ade9153a_dev *dev)
Stop measurements.
Definition: ade9153a.c:3748
int ade9153a_clear_cf1_chg(struct ade9153a_dev *dev)
Clear CF1 polarity change int mask.
Definition: ade9153a.c:1718
#define ADE9153A_UNLOCK_KEY
Definition: ade9153a.h:66
@ ADE9153A_ERROR1
Definition: ade9153a.h:628
@ ADE9153A_UART_ERROR0
Definition: ade9153a.h:634
int ade9153a_enable_revrpa_int(struct ade9153a_dev *dev)
Enable Phase A fundamental reactive power changed sign interrupt.
Definition: ade9153a.c:2478
#define ADE9153A_REG_ANGL_AV_AI
Definition: ade9153a.h:189
int ade9153a_dip_swell_irq_mode(struct ade9153a_dev *dev, enum dip_swell_irq_mode_en mode)
Dip swell interrupt mode.
Definition: ade9153a.c:2903
struct no_os_spi_init_param * gpio_ss
Definition: ade9153a.h:680
@ AFVARNL
Definition: ade9153a.h:650
#define ADE9153A_COMPMODEVAL
Definition: ade9153a.h:69
uint32_t avcc_reg_val
Definition: ade9153a.h:816
#define ADE9153A_REG_MS_STATUS_CURRENT
Definition: ade9153a.h:144
int ade9153a_uperiod_sel(struct ade9153a_dev *dev, uint8_t en)
User period select.
Definition: ade9153a.c:3436
#define ADE9153A_EVENT_STAT_MSK
Definition: ade9153a.h:275
int ade9153a_disable_chip_stat_int(struct ade9153a_dev *dev)
Disable CHIP_STAT interrupt.
Definition: ade9153a.c:1876
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
#define ADE9153A_DISAPLPF_MSK
Definition: ade9153a.h:244
int ade9153a_disable_event_stat_int(struct ade9153a_dev *dev)
Disable EVENT_STAT interrupt.
Definition: ade9153a.c:1904
uint8_t spi_en
Definition: ade9153a.h:684
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
#define ADE9153A_REG_RUN
Definition: ade9153a.h:187
int ade9153a_clear_apa_chg_sgn(struct ade9153a_dev *dev)
Clear APA (active power) sign change int mask.
Definition: ade9153a.c:1746
#define ADE9153A_CHIP_STAT_MSK
Definition: ade9153a.h:274
@ ADE9153A_PGA_CHB_GAIN_1
Definition: ade9153a.h:428
int ade9153a_cf1_lt_status(struct ade9153a_dev *dev, uint8_t *status)
CF1_LT status.
Definition: ade9153a.c:2746
int ade9153a_hw_reset(struct ade9153a_dev *dev)
Reset the device using HW reset.
Definition: ade9153a.c:578
int ade9153a_clear_ms_stat(struct ade9153a_dev *dev, uint32_t *reg_val)
Clear MS status int.
Definition: ade9153a.c:1831
@ ONE_INT
Definition: ade9153a.h:665
int ade9153a_disable_ms_stat_int(struct ade9153a_dev *dev)
Disable MS_STAT interrupt.
Definition: ade9153a.c:1932
int ade9153a_awsign_status(struct ade9153a_dev *dev, uint8_t *status)
Sign of active power.
Definition: ade9153a.c:3409
#define ADE9153A_WATTNL_MSK
Definition: ade9153a.h:287
int ade9153a_get_fvarnl(struct ade9153a_dev *dev, uint8_t *status)
Get fundamental reactive energy no load condition indicator.
Definition: ade9153a.c:1211
@ ADE9153A_HPF_CORNER_0_625_HZ
Definition: ade9153a.h:558
int ade9153a_get_int_status(struct ade9153a_dev *dev, uint32_t msk, uint8_t *status)
Get interrupt indicator from STATUS register.
Definition: ade9153a.c:1056
int ade9153a_enable_egyrdy_int(struct ade9153a_dev *dev)
Enable EGYRDY interrupt.
Definition: ade9153a.c:2338
int ade9153a_start_autocal_bi(struct ade9153a_dev *dev, enum ade9153a_acalmode_e mode)
Start autocalibration BI channel.
Definition: ade9153a.c:4313
int ade9153a_burst_en(struct ade9153a_dev *dev)
Burst read enable/disable.
Definition: ade9153a.c:2932
#define ADE9153A_LOCK_KEY
Definition: ade9153a.h:63
ade9153a_noload_tmr_e
ADE9153A Hpf no load tmr.
Definition: ade9153a.h:567
int ade9153a_diszxlpf(struct ade9153a_dev *dev)
Zero crossing lpf disable.
Definition: ade9153a.c:3313
void(* callback)(void *context)
Definition: no_os_irq.h:144
@ ADE9153A_NOLOAD_TMR_SAMPLES_256
Definition: ade9153a.h:575
int ade9153a_compmode(struct ade9153a_dev *dev)
COMPMODE.
Definition: ade9153a.c:3718
int ade9153a_temp_time(struct ade9153a_dev *dev, enum ade9153a_temp_time_e temp_no_samples)
Select the number of temperature readings to average.
Definition: ade9153a.c:3658
#define ADE9153A_REG_ZX_CFG
Definition: ade9153a.h:201
#define ADE9153A_REG_CONFIG1
Definition: ade9153a.h:188
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: ade9153a.h:686
int ade9153a_start_autocal_av(struct ade9153a_dev *dev, enum ade9153a_acalmode_e mode)
Start autocalibration AV channel.
Definition: ade9153a.c:4345
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
int ade9153a_cf1dis(struct ade9153a_dev *dev)
CF1 output disable.
Definition: ade9153a.c:3041
int ade9153a_get_crc_done(struct ade9153a_dev *dev, uint8_t *status)
Get CRC done indicator.
Definition: ade9153a.c:1115
#define ADE9153A_TEMP_EN_MSK
Definition: ade9153a.h:383
int ade9153a_ai_swap(struct ade9153a_dev *dev, uint8_t set)
Set the signal side of the PGA.
Definition: ade9153a.c:3764
int ade9153a_rms_vals(struct ade9153a_dev *dev, struct ade9153a_rms_values *data)
Read rms values.
Definition: ade9153a.c:4176
#define ADE9153A_RUN
Definition: ade9153a.h:72
int ade9153a_pwr_settle_set(struct ade9153a_dev *dev, enum ade9153a_pwr_settle_e time)
Set PWR_SETTLE.
Definition: ade9153a.c:2950
int ade9153a_clear_pwrrdy(struct ade9153a_dev *dev)
Clear power values registers update int mask.
Definition: ade9153a.c:1629
@ AVANL
Definition: ade9153a.h:652
int ade9153a_get_pwrrdy(struct ade9153a_dev *dev, uint8_t *status)
Get power values registers update indicator.
Definition: ade9153a.c:1291
int ade9153a_oi_lvl_val(struct ade9153a_dev *dev, uint32_t *val)
Overcurrent detection threshold level val.
Definition: ade9153a.c:2535
ade9153a_cf2sel_e
ADE9153A CF2SEL type of energy output at CF2 Pin.
Definition: ade9153a.h:492
int ade9153a_zx_src_after_hpf_enable(struct ade9153a_dev *dev)
ZX data source after hpf and phase compensation.
Definition: ade9153a.c:754
int ade9153a_hpf_disable(struct ade9153a_dev *dev)
Disable hpf for all channels.
Definition: ade9153a.c:805
int ade9153a_cf_ltmr_write(struct ade9153a_dev *dev, uint32_t reg_data)
cf_ltmr write value.
Definition: ade9153a.c:2773
int ade9153a_cf2sign_status(struct ade9153a_dev *dev, uint8_t *status)
Sign of CF2 power.
Definition: ade9153a.c:3328
@ ADE9153A_ERROR2
Definition: ade9153a.h:630
#define ADE9153A_EGY_TMR_MODE_MSK
Definition: ade9153a.h:375
ADE9153A temperature value.
Definition: ade9153a.h:797
int ade9153a_enable_cf2_int(struct ade9153a_dev *dev)
Enable CF2 interrupt.
Definition: ade9153a.c:2366
int ade9153a_enable_temp_rdy_int(struct ade9153a_dev *dev)
Enable new temperature reading interrupt.
Definition: ade9153a.c:2226
uint32_t ai_gain
Definition: ade9153a.h:702
@ NORMAL
Definition: ade9153a.h:454
int ade9153a_diszxlpf(struct ade9153a_dev *dev)
Zero crossing lpf disable.
Definition: ade9153a.c:3313
@ ADE9153A_HPF_CORNER_0_3125_HZ
Definition: ade9153a.h:560
int ade9153a_clear_zxav(struct ade9153a_dev *dev)
Clear zero crossing detect on V ch int mask.
Definition: ade9153a.c:1524
int ade9153a_disable_dready_int(struct ade9153a_dev *dev)
Disable data ready interrupt.
Definition: ade9153a.c:2324
int ade9153a_disable_vanl_int(struct ade9153a_dev *dev)
Disable total apparent energy no load condition interrupt.
Definition: ade9153a.c:2184
int ade9153a_enable_event_stat_int(struct ade9153a_dev *dev)
Enable an interrupt when any bit in EVENT_STATUS reg is set.
Definition: ade9153a.c:1890
int ade9153a_enable_fvarnl_int(struct ade9153a_dev *dev)
Enable fundamental reactive energy no load condition interrupt.
Definition: ade9153a.c:2142
#define ADE9153A_NO_BYTES_R_16
Definition: ade9153a.h:91
int ade9153a_clear_wattnl(struct ade9153a_dev *dev)
Clear total active energy no load condition int mask.
Definition: ade9153a.c:1584
#define ADE9153A_RMS_OC_RDY_MSK
Definition: ade9153a.h:289
#define ADE9153A_BURST_EN_MSK
Definition: ade9153a.h:335
int ade9153a_oia_en(struct ade9153a_dev *dev)
Ch A overcurretn detection enable.
Definition: ade9153a.c:3299
int ade9153a_get_chip_stat(struct ade9153a_dev *dev, uint8_t *status)
Get chip status indicator.
Definition: ade9153a.c:1761
#define ADE9153A_CF1SEL_MSK
Definition: ade9153a.h:346
#define ADE9153A_REG_VLEVEL
Definition: ade9153a.h:168
#define ADE9153A_REG_AIRMS
Definition: ade9153a.h:127
@ ADE9153A_NOLOAD_TMR_SAMPLES_512
Definition: ade9153a.h:577
int ade9153a_oib_val(struct ade9153a_dev *dev, uint32_t *val)
Ch B overcurrent val.
Definition: ade9153a.c:2585
@ CONTINUOUSE
Definition: ade9153a.h:663
ade9153a_acal_ch_e
select channels for autocalibration
Definition: ade9153a.h:439
@ ADE9153A_NOLOAD_TMR_SAMPLES_2048
Definition: ade9153a.h:581
int ade9153a_vlevel_val(struct ade9153a_dev *dev, uint32_t *val)
Vlevel val.
Definition: ade9153a.c:2610
#define ADE9153A_REG_MS_ACAL_AVCERT
Definition: ade9153a.h:143
#define ADE9153A_MS_SYSRDYP_MSK
Definition: ade9153a.h:264
#define ADE9153A_REG_AVAHR_HI
Definition: ade9153a.h:152
@ ADE9153A_HPF_CORNER_19_6375_HZ
Definition: ade9153a.h:548
@ ADE9153A_HPF_CORNER_38_695_HZ
Definition: ade9153a.h:546
#define ADE9153A_RD_RST_EN_MSK
Definition: ade9153a.h:373
int32_t active_power_reg_val
Definition: ade9153a.h:750
@ ADE9153A_AI_GAIN_32
Definition: ade9153a.h:615
int ade9153a_clear_event_stat(struct ade9153a_dev *dev, uint32_t *reg_val)
Clear event status int.
Definition: ade9153a.c:1803
int ade9153a_power_vals(struct ade9153a_dev *dev, struct ade9153a_power_values *data)
Read power values.
Definition: ade9153a.c:4137
int ade9153a_enable_zxtoav_int(struct ade9153a_dev *dev)
Enable zero corssing timeout on voltage ch interrupt.
Definition: ade9153a.c:2030
int ade9153a_cf2sel(struct ade9153a_dev *dev, enum ade9153a_cf2sel_e energy_type)
Set type of energy output on CF2 pin.
Definition: ade9153a.c:3056
int ade9153a_enable_wattnl_int(struct ade9153a_dev *dev)
Enable total active energy no load condition interrupt.
Definition: ade9153a.c:2198
int ade9153a_zx_src_before_hpf_enable(struct ade9153a_dev *dev)
ZX data source before hpf and phase compensation.
Definition: ade9153a.c:771
int ade9153a_enable_ms_stat_int(struct ade9153a_dev *dev)
Enable an interrupt when any bit in MS_STATUS_IRQ reg is set.
Definition: ade9153a.c:1918
int ade9153a_clear_rstdone(struct ade9153a_dev *dev)
Clear reset done int mask.
Definition: ade9153a.c:1539
#define ADE9153A_DISZXLPF_MSK
Definition: ade9153a.h:359
@ ADE9153A_PEAK_DETECTION_ENABLE_V_I_PHA_PHB
Definition: ade9153a.h:536
int ade9153a_get_pf_rdy(struct ade9153a_dev *dev, uint8_t *status)
Get PF ready indicator.
Definition: ade9153a.c:1083
ade9153a_chip_stat_err_e
ADE9153A chip status errors.
Definition: ade9153a.h:624
@ ADE9153A_AI_GAIN_38_4
Definition: ade9153a.h:617
int ade9153a_set_interface_serial(struct ade9153a_dev *dev)
Select comms interface Serial.
Definition: ade9153a.c:97
int ade9153a_oia_val(struct ade9153a_dev *dev, uint32_t *val)
Ch A overcurrent val.
Definition: ade9153a.c:2560
#define ADE9153A_TEMP_RDY_MSK
Definition: ade9153a.h:288
uint16_t no_os_crc16(const uint16_t *table, const uint8_t *pdata, size_t nbytes, uint16_t crc)
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
#define ADE9153A_MS_STAT_MSK
Definition: ade9153a.h:276
#define ADE9153A_REG_DIPA
Definition: ade9153a.h:170
#define ADE9153A_INTEN_BI_MSK
Definition: ade9153a.h:248
#define ADE9153A_REG_STATUS
Definition: ade9153a.h:162
#define ADE9153A_RESET_DEL
Definition: ade9153a.h:79
int ade9153a_ms_timeout(struct ade9153a_dev *dev, uint8_t *status)
mSure timed out (600s)
Definition: ade9153a.c:3895
#define ADE9153A_REG_CONFIG2
Definition: ade9153a.h:207
int ade9153a_cf_ltmr_val(struct ade9153a_dev *dev, uint32_t *val)
cf_ltmr read value.
Definition: ade9153a.c:2788
int ade9153a_disable_revpcf2_int(struct ade9153a_dev *dev)
Disable CF2 polarity change sign interrupt.
Definition: ade9153a.c:2436
@ ADE9153A_SETTLE_128_MS
Definition: ade9153a.h:481
int ade9153a_ext_ref_status(struct ade9153a_dev *dev, uint8_t *status)
External_reference status.
Definition: ade9153a.c:2876
int ade9153a_ipk_val(struct ade9153a_dev *dev, uint32_t *val)
Ipeak val.
Definition: ade9153a.c:1005
#define ADE9153A_REG_MS_ACAL_AVCC
Definition: ade9153a.h:142
#define ADE9153A_REG_MS_ACAL_AICC
Definition: ade9153a.h:138
int ade9153a_dready_oe(struct ade9153a_dev *dev)
DREADY driven to CF2 pin.
Definition: ade9153a.c:3013
int ade9153a_temp_gain_val(struct ade9153a_dev *dev, uint32_t *val)
temperature sensor gain.
Definition: ade9153a.c:2839
int ade9153a_clear_zxtoav(struct ade9153a_dev *dev)
Clear zero crossing timout on V ch int mask.
Definition: ade9153a.c:1479
#define ADE9153A_MS_TIMEOUT_MSK
Definition: ade9153a.h:397
int ade9153a_setup(void *dev, struct ade9153a_init_param init_param)
ADE9153A setup.
Definition: ade9153a.c:295
int ade9153a_disable_temp_rdy_int(struct ade9153a_dev *dev)
Disable new temperature reading interrupt.
Definition: ade9153a.c:2240
struct no_os_spi_init_param * gpio_sck
Definition: ade9153a.h:682
int ade9153a_disable_rms_oc_rdy_int(struct ade9153a_dev *dev)
Disable RMS_OC values update interrupt.
Definition: ade9153a.c:2268
int ade9153a_swella_val(struct ade9153a_dev *dev, uint32_t *val)
Voltage value during swell condition.
Definition: ade9153a.c:2660
#define ADE9153A_REG_MS_ACAL_CFG
Definition: ade9153a.h:118
int32_t current_h_rms_reg_val
Definition: ade9153a.h:775
@ ADE9153A_TOTAL_APPARENT_POWER
Definition: ade9153a.h:499
#define ADE9153A_AUTOCAL_BI_MSK
Definition: ade9153a.h:256
int ade9153a_clear_temp_rdy(struct ade9153a_dev *dev)
Clear new temperature reading ready int mask.
Definition: ade9153a.c:1599
#define ADE9153A_NO_BYTES_W_16
Definition: ade9153a.h:89
@ ADE9153A_NOLOAD_TMR_DISABLE
Definition: ade9153a.h:585
#define ADE9153A_REG_AIGAIN
Definition: ade9153a.h:100
int ade9153a_noload_tmr(struct ade9153a_dev *dev, enum ade9153a_noload_tmr_e noload_samples)
Set no. of samples for no load condition.
Definition: ade9153a.c:3503
int ade9153a_disable_pf_rdy_int(struct ade9153a_dev *dev)
Disable pf ready interrupt.
Definition: ade9153a.c:1960
#define ADE9153A_REG_TEMP_TRIM
Definition: ade9153a.h:184
#define ADE9153A_REG_AWATT
Definition: ade9153a.h:129
#define ADE9153A_TEMP_START_MSK
Definition: ade9153a.h:382
int ade9153a_enable_zxav_int(struct ade9153a_dev *dev)
Enable zero corssing detected on V ch interrupt.
Definition: ade9153a.c:2114
@ ADE9153A_NEGATIVE_ACC_MODE
Definition: ade9153a.h:518
ade9153a_ai_gain_e
ADE9153A PGA gain for current CH A.
Definition: ade9153a.h:608
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
uint32_t no_os_get_unaligned_be32(uint8_t *buf)
#define ADE9153A_PWR_SETTLE_MSK
Definition: ade9153a.h:336
@ F_60_HZ
Definition: ade9153a.h:467
#define ADE9153A_REG_MS_ACAL_AICERT
Definition: ade9153a.h:139
int ade9153a_clear_crc_done(struct ade9153a_dev *dev)
Clear CRC done int mask.
Definition: ade9153a.c:1464
Header file of ADE9153A Driver.
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
int ade9153a_clear_wattnl(struct ade9153a_dev *dev)
Clear total active energy no load condition int mask.
Definition: ade9153a.c:1584
#define ADE9153A_ACALMODE_BI_MSK
Definition: ade9153a.h:258
#define ADE9153A_REG_COMPMODE
Definition: ade9153a.h:194
@ NO_OS_EVT_GPIO
Definition: no_os_irq.h:62
int ade9153a_enable_cf2_int(struct ade9153a_dev *dev)
Enable CF2 interrupt.
Definition: ade9153a.c:2366
int ade9153a_egy_ld_accum(struct ade9153a_dev *dev, uint8_t en)
Internal energy register accum.
Definition: ade9153a.c:3570
int ade9153a_chip_status(struct ade9153a_dev *dev, uint8_t *status)
Chip status.
Definition: ade9153a.c:3976
int ade9153a_get_int_status(struct ade9153a_dev *dev, uint32_t msk, uint8_t *status)
Get interrupt indicator from STATUS register.
Definition: ade9153a.c:1056
int ade9153a_get_wattnl(struct ade9153a_dev *dev, uint8_t *status)
Get total active energy no load condition indicator.
Definition: ade9153a.c:1243
int ade9153a_wr_unlock(struct ade9153a_dev *dev)
Unlock device.
Definition: ade9153a.c:624
ade9153a_acalmode_e
select power mode for ch B, ch A
Definition: ade9153a.h:452
@ ADE9153A_NOLOAD_TMR_SAMPLES_1024
Definition: ade9153a.h:579
int ade9153a_clear_temp_rdy(struct ade9153a_dev *dev)
Clear new temperature reading ready int mask.
Definition: ade9153a.c:1599
@ ADE9153A_TEMP_TIME_SAMPLES_256
Definition: ade9153a.h:597
#define ADE9153A_FORCE_CRC_UPDATE_MSK
Definition: ade9153a.h:379
int ade9153a_temp_offset_val(struct ade9153a_dev *dev, uint32_t *val)
temperature sensor offset.
Definition: ade9153a.c:2813
ade9153a_selfreq_e
select frequency
Definition: ade9153a.h:463
int ade9153a_clear_cf1(struct ade9153a_dev *dev)
Clear CF1 pulse issued int mask.
Definition: ade9153a.c:1689
int32_t current_rms_reg_val
Definition: ade9153a.h:763
int ade9153a_varacc(struct ade9153a_dev *dev, enum ade9153a_accmode_e varacc_type)
Select fundamental reactive power accumulation mode.
Definition: ade9153a.c:3175
uint16_t gain_reg_val
Definition: ade9153a.h:803
int ade9153a_get_chip_stat(struct ade9153a_dev *dev, uint8_t *status)
Get chip status indicator.
Definition: ade9153a.c:1761
#define ADE9153A_AI_SWAP_MSK
Definition: ade9153a.h:390
int ade9153a_auto_calibration_run(struct ade9153a_dev *dev)
Auto calibration run.
Definition: ade9153a.c:901
int ade9153a_enable_fvarnl_int(struct ade9153a_dev *dev)
Enable fundamental reactive energy no load condition interrupt.
Definition: ade9153a.c:2142
int ade9153a_clear_pf_rdy(struct ade9153a_dev *dev)
Clear PF ready int mask.
Definition: ade9153a.c:1434
int ade9153a_pwr_settle_set(struct ade9153a_dev *dev, enum ade9153a_pwr_settle_e time)
Set PWR_SETTLE.
Definition: ade9153a.c:2950
ADE9153A half rms registers values.
Definition: ade9153a.h:773
#define ADE9153A_OIB_VAL_MSK
Definition: ade9153a.h:307
int ade9153a_egy_ld_accum(struct ade9153a_dev *dev, uint8_t en)
Internal energy register accum.
Definition: ade9153a.c:3570
int ade9153a_get_zxbi(struct ade9153a_dev *dev, uint8_t *status)
Get zero crossing detect on I ch B indicator.
Definition: ade9153a.c:1147
int ade9153a_disable_pwrrdy_int(struct ade9153a_dev *dev)
Disable PWRRDY interrupt.
Definition: ade9153a.c:2296
int ade9153a_enable_wattnl_int(struct ade9153a_dev *dev)
Enable total active energy no load condition interrupt.
Definition: ade9153a.c:2198
int ade9153a_rms_vals(struct ade9153a_dev *dev, struct ade9153a_rms_values *data)
Read rms values.
Definition: ade9153a.c:4176
int ade9153a_ms_conferr(struct ade9153a_dev *dev, uint8_t *status)
Invalid config of mSure status.
Definition: ade9153a.c:3841
int ade9153a_varacc(struct ade9153a_dev *dev, enum ade9153a_accmode_e varacc_type)
Select fundamental reactive power accumulation mode.
Definition: ade9153a.c:3175
int ade9153a_vnoma_enable(struct ade9153a_dev *dev)
Use the nominal phase voltage rms, VNOM, in the computation of the Phase A total apparent power.
Definition: ade9153a.c:701
int ade9153a_clear_vanl(struct ade9153a_dev *dev)
Clear total apparent energy no load condition int mask.
Definition: ade9153a.c:1569
@ ADE9153A_PEAK_DETECTION_ENABLE_I_PHB
Definition: ade9153a.h:534
int ade9153a_disable_zxtoav_int(struct ade9153a_dev *dev)
Disable zero corssing timeout on voltage ch interrupt.
Definition: ade9153a.c:2044
#define ADE9153A_CF2SIGN_MSK
Definition: ade9153a.h:362
int ade9153a_remove(struct ade9153a_dev *dev)
Remove the device and release resources.
Definition: ade9153a.c:513
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
uint32_t rsmall
Definition: ade9153a.h:698
int32_t voltage_rms_reg_val
Definition: ade9153a.h:765
int32_t no_os_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable specific interrupt.
Definition: no_os_irq.c:181
#define ADE9153A_SPI_READ
Definition: ade9153a.h:60
#define ADE9153A_REG_OIA
Definition: ade9153a.h:165
int ade9153a_enable_cf1_int(struct ade9153a_dev *dev)
Enable CF1 interrupt.
Definition: ade9153a.c:2394
Header file of GPIO Interface.
int32_t active_energy_reg_val
Definition: ade9153a.h:737
#define ADE9153A_ACAL_MODE_MSK
Definition: ade9153a.h:261
int ade9153a_enable_rms_oc_rdy_int(struct ade9153a_dev *dev)
Enable RMS_OC values update interrupt.
Definition: ade9153a.c:2254
int ade9153a_cf1sel(struct ade9153a_dev *dev, enum ade9153a_cf2sel_e energy_type)
Set type of energy output on CF1 pin.
Definition: ade9153a.c:3089
int ade9153a_version_product(struct ade9153a_dev *dev, uint32_t *data_read)
Version product.
Definition: ade9153a.c:641
int ade9153a_disable_crc_chg_int(struct ade9153a_dev *dev)
Disable crc change interrupt.
Definition: ade9153a.c:1988
#define ADE9153A_TEMP_GAIN_MSK
Definition: ade9153a.h:330
@ NO_OS_GPIO_IRQ
Definition: no_os_irq.h:85
int ade9153a_clear_zxtoav(struct ade9153a_dev *dev)
Clear zero crossing timout on V ch int mask.
Definition: ade9153a.c:1479
int ade9153a_cf2_lt_status(struct ade9153a_dev *dev, uint8_t *status)
CF2_LT status.
Definition: ade9153a.c:2719
struct no_os_gpio_init_param * gpio_reset
Definition: ade9153a.h:678
int ade9153a_enable_zxbi_int(struct ade9153a_dev *dev)
Enable zero corssing detected on I ch B interrupt.
Definition: ade9153a.c:2058
int ade9153a_get_egyrdy(struct ade9153a_dev *dev, uint8_t *status)
Get power values egy ready indicator.
Definition: ade9153a.c:1323
int ade9153a_clear_chip_stat(struct ade9153a_dev *dev, uint32_t *reg_val)
Clear chip status int.
Definition: ade9153a.c:1775
int ade9153a_control_interrupt(struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t int_msk, uint8_t en)
Enable/disable interrupt.
Definition: ade9153a.c:1847
int ade9153a_rms_oc_src_adc_samples_enable(struct ade9153a_dev *dev)
Use ADC samples, before the high-pass filter for the RMS_OC calculation.
Definition: ade9153a.c:737
int ade9153a_clear_pf_rdy(struct ade9153a_dev *dev)
Clear PF ready int mask.
Definition: ade9153a.c:1434
ade9153a_pwr_settle_e
ADE9153A Power settle.
Definition: ade9153a.h:474
@ ADE9153A_SETTLE_64_MS
Definition: ade9153a.h:479
int ade9153a_vpk_val(struct ade9153a_dev *dev, uint32_t *val)
Vpeak val.
Definition: ade9153a.c:1030
#define ADE9153A_MS_CONFERR_MSK
Definition: ade9153a.h:395
int ade9153a_disable_zxbi_int(struct ade9153a_dev *dev)
Disable zero corssing detected on I ch B interrupt.
Definition: ade9153a.c:2072
int ade9153a_init(struct ade9153a_dev **device, struct ade9153a_init_param init_param)
Initialize the device.
Definition: ade9153a.c:157
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
int ade9153a_get_rstdone(struct ade9153a_dev *dev, uint8_t *status)
Get reset done indicator.
Definition: ade9153a.c:1195
uint16_t no_os_get_unaligned_be16(uint8_t *buf)
void no_os_crc16_populate_msb(uint16_t *table, const uint16_t polynomial)
int ade9153a_half_rms_vals(struct ade9153a_dev *dev, struct ade9153a_half_rms_values *data)
Read half rms values.
Definition: ade9153a.c:4209
int ade9153a_control_interrupt(struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t int_msk, uint8_t en)
Enable/disable interrupt.
Definition: ade9153a.c:1847
int ade9153a_wr_lock(struct ade9153a_dev *dev)
Lock device.
Definition: ade9153a.c:608
int ade9153a_clear_zxai(struct ade9153a_dev *dev)
Clear zero crossing detect on I ch A int mask.
Definition: ade9153a.c:1509
int ade9153a_ai_gain(struct ade9153a_dev *dev, enum ade9153a_ai_gain_e gain)
Set the PGA gain for I chA.
Definition: ade9153a.c:3779
int ade9153a_ms_sysrdy(struct ade9153a_dev *dev, uint8_t *status)
New run of mSure ready.
Definition: ade9153a.c:3814
int ade9153a_get_fvarnl(struct ade9153a_dev *dev, uint8_t *status)
Get fundamental reactive energy no load condition indicator.
Definition: ade9153a.c:1211
int ade9153a_ms_absent(struct ade9153a_dev *dev, uint8_t *status)
mSure not detected on the last enabled ch
Definition: ade9153a.c:3868
#define ADE9153A_AVANL_MSK
Definition: ade9153a.h:320
#define ADE9153A_AWSIGN_MSK
Definition: ade9153a.h:365
#define ADE9153A_PEAK_SEL_MSK
Definition: ade9153a.h:354
int ade9153a_disable_revpcf1_int(struct ade9153a_dev *dev)
Disable CF1 polarity change sign interrupt.
Definition: ade9153a.c:2464
ADE9153A Device structure.
Definition: ade9153a.h:712
Header file of utility functions.
int ade9153a_lpf_rp_disable(struct ade9153a_dev *dev)
Disable the low pass filter in the fundamental reactive power datapath.
Definition: ade9153a.c:666
int ade9153a_burst_en(struct ade9153a_dev *dev)
Burst read enable/disable.
Definition: ade9153a.c:2932
uint32_t no_os_find_first_set_bit(uint32_t word)
#define ADE9153A_VNOMA_EN_MSK
Definition: ade9153a.h:245
#define ADE9153A_DIP_SWELL_IRQ_MODE_MSK
Definition: ade9153a.h:334
@ ADE9153A_SIGNED_ACC_MODE
Definition: ade9153a.h:512
#define ADE9153A_CRC16_INIT_VAL
Definition: ade9153a.h:87
int ade9153a_clear_dready(struct ade9153a_dev *dev)
Clear new waveform samples ready int mask.
Definition: ade9153a.c:1644
int ade9153a_ms_shift(struct ade9153a_dev *dev, uint8_t *status)
mSure shift detected in CC val
Definition: ade9153a.c:3949
@ AUTOCAL_AV
Definition: ade9153a.h:441
int ade9153a_get_rpa_chg_sgn(struct ade9153a_dev *dev, uint8_t *status)
Get RPA (reactive power) sign change indicator.
Definition: ade9153a.c:1403
@ ADE9153A_PGA_CHB_GAIN_2
Definition: ade9153a.h:430
#define ADE9153A_CF1DIS_MSK
Definition: ade9153a.h:344
int ade9153a_clear_pwrrdy(struct ade9153a_dev *dev)
Clear power values registers update int mask.
Definition: ade9153a.c:1629
int ade9153a_enable_revpcf1_int(struct ade9153a_dev *dev)
Enable CF1 polarity change sign interrupt.
Definition: ade9153a.c:2450
int ade9153a_clear_cf2_chg(struct ade9153a_dev *dev)
Clear CF2 polarity change int mask.
Definition: ade9153a.c:1704
int32_t no_os_irq_trigger_level_set(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level trig)
Set interrupt trigger level.
Definition: no_os_irq.c:162
#define ADE9153A_REG_CFMODE
Definition: ade9153a.h:193
int ade9153a_ms_absent(struct ade9153a_dev *dev, uint8_t *status)
mSure not detected on the last enabled ch
Definition: ade9153a.c:3868
int ade9153a_oib_val(struct ade9153a_dev *dev, uint32_t *val)
Ch B overcurrent val.
Definition: ade9153a.c:2585
int32_t no_os_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable specific interrupt.
Definition: no_os_irq.c:198
int ade9153a_clear_chip_stat(struct ade9153a_dev *dev, uint32_t *reg_val)
Clear chip status int.
Definition: ade9153a.c:1775
int ade9153a_get_apa_chg_sgn(struct ade9153a_dev *dev, uint8_t *status)
Get APA (active power) sign change indicator.
Definition: ade9153a.c:1419
int ade9153a_disable_fvarnl_int(struct ade9153a_dev *dev)
Disable fundamental reactive energy no load condition interrupt.
Definition: ade9153a.c:2156
int ade9153a_enable_dready_int(struct ade9153a_dev *dev)
Enable data ready interrupt.
Definition: ade9153a.c:2310
#define ADE9153A_ERROR2_MSK
Definition: ade9153a.h:413
int32_t period_reg_val
Definition: ade9153a.h:788
#define ADE9153A_REG_MASK
Definition: ade9153a.h:163
int ade9153a_ip_phase(struct ade9153a_dev *dev, uint8_t *ch)
Ipeak channel phase.
Definition: ade9153a.c:972
#define ADE9153A_ACAL_RUN_MSK
Definition: ade9153a.h:260
ade9153a_clear_cf1(struct ade9153a_dev *dev)
Clear CF1 pulse issued int mask.
Definition: ade9153a.c:1689
int ade9153a_get_phnoload_status(struct ade9153a_dev *dev, uint8_t *status)
Get phnoload status.
Definition: ade9153a.c:2685
int ade9153a_clear_zxbi(struct ade9153a_dev *dev)
Clear zero crossing detect on I ch B int mask.
Definition: ade9153a.c:1494
int ade9153a_oi_lvl_val(struct ade9153a_dev *dev, uint32_t *val)
Overcurrent detection threshold level val.
Definition: ade9153a.c:2535
Definition: no_os_irq.h:123
@ ADE9153A_TOTAL_ACTIVE_POWER
Definition: ade9153a.h:497
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
#define ADE9153A_PF_RDY_MSK
Definition: ade9153a.h:277
int ade9153a_cf2dis(struct ade9153a_dev *dev)
CF2 output disable.
Definition: ade9153a.c:3027
int ade9153a_enable_pwrrdy_int(struct ade9153a_dev *dev)
Enable PWRRDY interrupt.
Definition: ade9153a.c:2282
uint16_t offset_reg_val
Definition: ade9153a.h:801
#define ADE9153A_CF2DIS_MSK
Definition: ade9153a.h:343
ade9153a_accmode_e
ADE9153A varacc/watacc acc mode.
Definition: ade9153a.h:508
int ade9153a_ext_ref(struct ade9153a_dev *dev, uint8_t en)
External voltage reference enable/disable.
Definition: ade9153a.c:2864
int ade9153a_write(struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t reg_data)
Write device register.
Definition: ade9153a.c:445
int ade9153a_vnoma_enable(struct ade9153a_dev *dev)
Use the nominal phase voltage rms, VNOM, in the computation of the Phase A total apparent power.
Definition: ade9153a.c:701
int ade9153a_clear_egyrdy(struct ade9153a_dev *dev)
Clear power values egy ready int mask.
Definition: ade9153a.c:1659
int ade9153a_get_zxai(struct ade9153a_dev *dev, uint8_t *status)
Get zero crossing detect on I ch A indicator.
Definition: ade9153a.c:1163
int32_t number
Definition: no_os_gpio.h:100
int no_os_test_bit(int pos, const volatile void *addr)
Definition: no_os_util.h:132
int ade9153a_run(struct ade9153a_dev *dev)
Start measurements.
Definition: ade9153a.c:3733
uint8_t burst_en
Definition: ade9153a.h:716
int ade9153a_disable_chip_stat_int(struct ade9153a_dev *dev)
Disable CHIP_STAT interrupt.
Definition: ade9153a.c:1876
int ade9153a_enable_dready_int(struct ade9153a_dev *dev)
Enable data ready interrupt.
Definition: ade9153a.c:2310
int ade9153a_uperiod_sel(struct ade9153a_dev *dev, uint8_t en)
User period select.
Definition: ade9153a.c:3436
#define ADE9153A_AVARSIGN_MSK
Definition: ade9153a.h:364
Error macro definition for ARM Compiler.
int ade9153a_disable_cf1_int(struct ade9153a_dev *dev)
Disable CF1 interrupt.
Definition: ade9153a.c:2408
int ade9153a_get_cf2_chg(struct ade9153a_dev *dev, uint8_t *status)
Get CF2 polarity change indicator.
Definition: ade9153a.c:1371
@ ADE9153A_ERROR3
Definition: ade9153a.h:632
int ade9153a_disable_revrpa_int(struct ade9153a_dev *dev)
Disable Phase A fundamental reactive power changed sign interrupt.
Definition: ade9153a.c:2492
int ade9153a_temp_result(struct ade9153a_dev *dev, uint16_t *val)
Temperature result.
Definition: ade9153a.c:3694
#define ADE9153A_REG_WR_LOCK
Definition: ade9153a.h:215
uint32_t no_samples
Definition: ade9153a.h:700
#define ADE9153A_ERROR0_MSK
Definition: ade9153a.h:415
int ade9153a_read(struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t *reg_data)
Read device register.
Definition: ade9153a.c:365
int16_t temperature_reg_val
Definition: ade9153a.h:799
#define ADE9153A_DIPA_VAL_MSK
Definition: ade9153a.h:313
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
int ade9153a_sw_reset(struct ade9153a_dev *dev)
Reset the device using SW reset.
Definition: ade9153a.c:555
int ade9153a_get_vanl(struct ade9153a_dev *dev, uint8_t *status)
Get total apparent energy no load condition indicator.
Definition: ade9153a.c:1227
@ ADE9153A_ERROR0
Definition: ade9153a.h:626
int ade9153a_oia_val(struct ade9153a_dev *dev, uint32_t *val)
Ch A overcurrent val.
Definition: ade9153a.c:2560
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75