no-OS
Loading...
Searching...
No Matches
ade9153a.h File Reference

Header file of ADE9153A Driver. More...

#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "no_os_util.h"
#include "no_os_spi.h"
#include "no_os_gpio.h"
#include "no_os_irq.h"
#include "no_os_delay.h"
#include "no_os_units.h"
#include "no_os_alloc.h"
#include "no_os_crc16.h"
#include "no_os_print_log.h"
#include <stdlib.h>
#include <errno.h>
#include <math.h>
Include dependency graph for ade9153a.h:

Classes

struct  ade9153a_init_param
 ADE9153a Device initialization parameters. More...
 
struct  ade9153a_dev
 ADE9153A Device structure. More...
 
struct  ade9153a_energy_values
 ADE9153A energy registers values. More...
 
struct  ade9153a_power_values
 ADE9153A power registers values. More...
 
struct  ade9153a_rms_values
 ADE9153A rms registers values. More...
 
struct  ade9153a_half_rms_values
 ADE9153A half rms registers values. More...
 
struct  ade9153a_pq_values
 ADE9153A power quality registers values. More...
 
struct  ade9153a_temperature_value
 ADE9153A temperature value. More...
 
struct  ade9153a_autocal_vals
 ADE9153A temperature value. More...
 

Macros

#define ADE9153A_SPI_READ   NO_OS_BIT(3)
 
#define ADE9153A_LOCK_KEY   0x3C64
 
#define ADE9153A_UNLOCK_KEY   0x4AD1
 
#define ADE9153A_COMPMODEVAL   0x0005
 
#define ADE9153A_RUN   0x0001
 
#define ADE9153A_STOP   0x0000
 
#define ADE9153A_VERSION   0x9153a
 
#define ADE9153A_RESET_DEL   0x1F4
 
#define ADE9153A_START_16ADDR   0x473
 
#define ADE9153A_END_16ADDR   0x600
 
#define ADE9153A_CRC16_POLY   0x1021
 
#define ADE9153A_CRC16_INIT_VAL   0xFFFF
 
#define ADE9153A_NO_BYTES_W_16   0x0004
 
#define ADE9153A_NO_BYTES_W_32   0x0006
 
#define ADE9153A_NO_BYTES_R_16   0x0006
 
#define ADE9153A_NO_BYTES_R_32   0x0008
 
#define ENABLE   1u
 
#define DISABLE   0u
 
#define ADE9153A_REG_AIGAIN   0x000
 
#define ADE9153A_REG_APHASECAL   0x001
 
#define ADE9153A_REG_AVGAIN   0x002
 
#define ADE9153A_REG_AIRMS_OS   0x003
 
#define ADE9153A_REG_AVRMS_OS   0x004
 
#define ADE9153A_REG_APGAIN   0x005
 
#define ADE9153A_REG_AWATT_OS   0x006
 
#define ADE9153A_REG_AFVAR_OS   0x007
 
#define ADE9153A_REG_AVRMS_OC_OS   0x008
 
#define ADE9153A_REG_AIRMS_OC_OS   0x009
 
#define ADE9153A_REG_BIGAIN   0x010
 
#define ADE9153A_REG_BPHASECAL   0x011
 
#define ADE9153A_REG_BIRMS_OS   0x013
 
#define ADE9153A_REG_BIRMS_OC_OS   0x019
 
#define ADE9153A_REG_CONFIG0   0x020
 
#define ADE9153A_REG_VNOM   0x021
 
#define ADE9153A_REG_DICOEFF   0x022
 
#define ADE9153A_REG_BI_PGAGAIN   0x023
 
#define ADE9153A_REG_MS_ACAL_CFG   0x030
 
#define ADE9153A_REG_MS_AICC_USER   0x045
 
#define ADE9153A_REG_MS_BICC_USER   0x046
 
#define ADE9153A_REG_MS_AVCC_USER   0x047
 
#define ADE9153A_REG_CT_PHASE_DELAY   0x049
 
#define ADE9153A_REG_CT_CORNER   0x04A
 
#define ADE9153A_REG_VDIV_RSMALL   0x04C
 
#define ADE9153A_REG_AI_WAV   0x200
 
#define ADE9153A_REG_AV_WAV   0x201
 
#define ADE9153A_REG_AIRMS   0x202
 
#define ADE9153A_REG_AVRMS   0x203
 
#define ADE9153A_REG_AWATT   0x204
 
#define ADE9153A_REG_AVA   0x206
 
#define ADE9153A_REG_AFVAR   0x207
 
#define ADE9153A_REG_APF   0x208
 
#define ADE9153A_REG_AIRMS_OC   0x209
 
#define ADE9153A_REG_AVRMS_OC   0x20A
 
#define ADE9153A_REG_BI_WAV   0x210
 
#define ADE9153A_REG_BIRMS   0x212
 
#define ADE9153A_REG_BIRMS_OC   0x219
 
#define ADE9153A_REG_MS_ACAL_AICC   0x220
 
#define ADE9153A_REG_MS_ACAL_AICERT   0x221
 
#define ADE9153A_REG_MS_ACAL_BICC   0x222
 
#define ADE9153A_REG_MS_ACAL_BICERT   0x223
 
#define ADE9153A_REG_MS_ACAL_AVCC   0x224
 
#define ADE9153A_REG_MS_ACAL_AVCERT   0x225
 
#define ADE9153A_REG_MS_STATUS_CURRENT   0x240
 
#define ADE9153A_REG_VERSION_DSP   0x241
 
#define ADE9153A_REG_VERSION_PRODUCT   0x242
 
#define ADE9153A_REG_AWATT_ACC   0x39D
 
#define ADE9153A_REG_AWATTHR_LO   0x39E
 
#define ADE9153A_REG_AWATTHR_HI   0x39F
 
#define ADE9153A_REG_AVA_ACC   0x3B1
 
#define ADE9153A_REG_AVAHR_LO   0x3B2
 
#define ADE9153A_REG_AVAHR_HI   0x3B3
 
#define ADE9153A_REG_AFVAR_ACC   0x3BB
 
#define ADE9153A_REG_AFVARHR_LO   0x3BC
 
#define ADE9153A_REG_AFVARHR_HI   0x3BD
 
#define ADE9153A_REG_PWATT_ACC   0x3EB
 
#define ADE9153A_REG_NWATT_ACC   0x3EF
 
#define ADE9153A_REG_PFVAR_ACC   0x3F3
 
#define ADE9153A_REG_NFVAR_ACC   0x3F7
 
#define ADE9153A_REG_IPEAK   0x400
 
#define ADE9153A_REG_VPEAK   0x401
 
#define ADE9153A_REG_STATUS   0x402
 
#define ADE9153A_REG_MASK   0x405
 
#define ADE9153A_REG_OI_LVL   0x409
 
#define ADE9153A_REG_OIA   0x40A
 
#define ADE9153A_REG_OIB   0x40B
 
#define ADE9153A_REG_USER_PERIOD   0x40E
 
#define ADE9153A_REG_VLEVEL   0x40F
 
#define ADE9153A_REG_DIP_LVL   0x410
 
#define ADE9153A_REG_DIPA   0x411
 
#define ADE9153A_REG_SWELL_LVL   0x414
 
#define ADE9153A_REG_SWELLA   0x415
 
#define ADE9153A_REG_APERIOD   0x418
 
#define ADE9153A_REG_ACT_NL_LVL   0x41C
 
#define ADE9153A_REG_REACT_NL_LVL   0x41D
 
#define ADE9153A_REG_APP_NL_LVL   0x41E
 
#define ADE9153A_REG_PHNOLOAD   0x41F
 
#define ADE9153A_REG_WTHR   0x420
 
#define ADE9153A_REG_VARTHR   0x421
 
#define ADE9153A_REG_VATHR   0x422
 
#define ADE9153A_REG_LAST_DATA_32   0x423
 
#define ADE9153A_REG_CT_PHASE_MEAS   0x424
 
#define ADE9153A_REG_CF_LCFG   0x425
 
#define ADE9153A_REG_TEMP_TRIM   0x471
 
#define ADE9153A_REG_CHIP_ID_HI   0x472
 
#define ADE9153A_REG_CHIP_ID_LO   0x473
 
#define ADE9153A_REG_RUN   0x480
 
#define ADE9153A_REG_CONFIG1   0x481
 
#define ADE9153A_REG_ANGL_AV_AI   0x485
 
#define ADE9153A_REG_ANGL_AI_BI   0x488
 
#define ADE9153A_REG_DIP_CYC   0x48B
 
#define ADE9153A_REG_SWELL_CYC   0x48C
 
#define ADE9153A_REG_CFMODE   0x490
 
#define ADE9153A_REG_COMPMODE   0x491
 
#define ADE9153A_REG_ACCMODE   0x492
 
#define ADE9153A_REG_CONFIG3   0x493
 
#define ADE9153A_REG_CF1DEN   0x494
 
#define ADE9153A_REG_CF2DEN   0x495
 
#define ADE9153A_REG_ZXTOUT   0x498
 
#define ADE9153A_REG_ZXTHRSH   0x499
 
#define ADE9153A_REG_ZX_CFG   0x49A
 
#define ADE9153A_REG_PHSIGN   0x49D
 
#define ADE9153A_REG_CRC_RSLT   0x4A8
 
#define ADE9153A_REG_CRC_SPI   0x4A9
 
#define ADE9153A_REG_LAST_DATA_16   0x4AC
 
#define ADE9153A_REG_LAST_CMD   0x4AE
 
#define ADE9153A_REG_CONFIG2   0x4AF
 
#define ADE9153A_REG_EP_CFG   0x4B0
 
#define ADE9153A_REG_PWR_TIME   0x4B1
 
#define ADE9153A_REG_EGY_TIME   0x4B2
 
#define ADE9153A_REG_CRC_FORCE   0x4B4
 
#define ADE9153A_REG_TEMP_CFG   0x4B6
 
#define ADE9153A_REG_TEMP_RSLT   0x4B7
 
#define ADE9153A_REG_AI_PGAGAIN   0x4B9
 
#define ADE9153A_REG_WR_LOCK   0x4BF
 
#define ADE9153A_REG_MS_STATUS_IRQ   0x4C0
 
#define ADE9153A_REG_EVENT_STATUS   0x4C1
 
#define ADE9153A_REG_CHIP_STATUS   0x4C2
 
#define ADE9153A_REG_UART_BAUD_SWITCH   0x4DC
 
#define ADE9153A_REG_VERSION   0x4FE
 
#define ADE9153A_REG_AI_WAV_1   0x600
 
#define ADE9153A_REG_AV_WAV_1   0x601
 
#define ADE9153A_REG_BI_WAV_1   0x602
 
#define ADE9153A_REG_AIRMS_1   0x604
 
#define ADE9153A_REG_BIRMS_1   0x605
 
#define ADE9153A_REG_AVRMS_1   0x606
 
#define ADE9153A_REG_AWATT_1   0x608
 
#define ADE9153A_REG_AFVAR_1   0x60A
 
#define ADE9153A_REG_AVA_1   0x60C
 
#define ADE9153A_REG_APF_1   0x60E
 
#define ADE9153A_REG_   AI_WAV_2 0x610
 
#define ADE9153A_REG_AV_WAV_2   0x611
 
#define ADE9153A_REG_AIRMS_2   0x612
 
#define ADE9153A_REG_AVRMS_2   0x613
 
#define ADE9153A_REG_AWATT_2   0x614
 
#define ADE9153A_REG_AVA_2   0x615
 
#define ADE9153A_REG_AFVAR_2   0x616
 
#define ADE9153A_REG_APF_2   0x617
 
#define ADE9153A_REG_BI_WAV_2   0x618
 
#define ADE9153A_REG_BIRMS_2   0x61A
 
#define ADE9153A_DISRPLPF_MSK   NO_OS_BIT(8)
 
#define ADE9153A_DISAPLPF_MSK   NO_OS_BIT(7)
 
#define ADE9153A_VNOMA_EN_MSK   NO_OS_BIT(5)
 
#define ADE9153A_RMS_OC_SRC_MSK   NO_OS_BIT(4)
 
#define ADE9153A_ZX_SRC_SEL_MSK   NO_OS_BIT(3)
 
#define ADE9153A_INTEN_BI_MSK   NO_OS_BIT(2)
 
#define ADE9153A_HPFDIS_MSK   NO_OS_BIT(0)
 
#define ADE9153A_BI_PGAGAIN_MSK   NO_OS_GENMASK(31, 0)
 
#define ADE9153A_AUTOCAL_AV_MSK   NO_OS_BIT(6)
 
#define ADE9153A_AUTOCAL_BI_MSK   NO_OS_BIT(5)
 
#define ADE9153A_AUTOCAL_AI_MSK   NO_OS_BIT(4)
 
#define ADE9153A_ACALMODE_BI_MSK   NO_OS_BIT(3)
 
#define ADE9153A_ACALMODE_AI_MSK   NO_OS_BIT(2)
 
#define ADE9153A_ACAL_RUN_MSK   NO_OS_BIT(1)
 
#define ADE9153A_ACAL_MODE_MSK   NO_OS_BIT(0)
 
#define ADE9153A_MS_SYSRDYP_MSK   NO_OS_BIT(0)
 
#define ADE9153A_IPPHASE_MSK   NO_OS_GENMASK(26, 24)
 
#define ADE9153A_IPEAKVAL_MSK   NO_OS_GENMASK(23, 0)
 
#define ADE9153A_VPEAKVAL_MSK   NO_OS_GENMASK(23, 0)
 
#define ADE9153A_CHIP_STAT_MSK   NO_OS_BIT(31)
 
#define ADE9153A_EVENT_STAT_MSK   NO_OS_BIT(30)
 
#define ADE9153A_MS_STAT_MSK   NO_OS_BIT(29)
 
#define ADE9153A_PF_RDY_MSK   NO_OS_BIT(25)
 
#define ADE9153A_CRC_CHG_MSK   NO_OS_BIT(24)
 
#define ADE9153A_CRC_DONE_MSK   NO_OS_BIT(23)
 
#define ADE9153A_ZXTOAV_MSK   NO_OS_BIT(21)
 
#define ADE9153A_ZXBI_MSK   NO_OS_BIT(20)
 
#define ADE9153A_ZXAI_MSK   NO_OS_BIT(19)
 
#define ADE9153A_ZXAV_MSK   NO_OS_BIT(17)
 
#define ADE9153A_RSTDONE_MSK   NO_OS_BIT(16)
 
#define ADE9153A_FVARNL_MSK   NO_OS_BIT(15)
 
#define ADE9153A_VANL_MSK   NO_OS_BIT(14)
 
#define ADE9153A_WATTNL_MSK   NO_OS_BIT(13)
 
#define ADE9153A_TEMP_RDY_MSK   NO_OS_BIT(12)
 
#define ADE9153A_RMS_OC_RDY_MSK   NO_OS_BIT(11)
 
#define ADE9153A_PWRRDY_MSK   NO_OS_BIT(10)
 
#define ADE9153A_DREADY_MSK   NO_OS_BIT(9)
 
#define ADE9153A_EGYRDY_MSK   NO_OS_BIT(8)
 
#define ADE9153A_CF2_MSK   NO_OS_BIT(7)
 
#define ADE9153A_CF1_MSK   NO_OS_BIT(6)
 
#define ADE9153A_REVPCF2_MSK   NO_OS_BIT(5)
 
#define ADE9153A_REVPCF1_MSK   NO_OS_BIT(4)
 
#define ADE9153A_REVRPA_MSK   NO_OS_BIT(2)
 
#define ADE9153A_REVAPA_MSK   NO_OS_BIT(0)
 
#define ADE9153A_OILVL_VAL_MSK   NO_OS_GENMASK(23, 0)
 
#define ADE9153A_OIA_VAL_MSK   NO_OS_GENMASK(23, 0)
 
#define ADE9153A_OIB_VAL_MSK   NO_OS_GENMASK(23, 0)
 
#define ADE9153A_VLEVEL_VAL_MSK   NO_OS_GENMASK(23, 0)
 
#define ADE9153A_DIPA_VAL_MSK   NO_OS_GENMASK(23, 0)
 
#define ADE9153A_SWELLA_VAL_MSK   NO_OS_GENMASK(23, 0)
 
#define ADE9153A_AFVARNL_MSK   NO_OS_BIT(2)
 
#define ADE9153A_AVANL_MSK   NO_OS_BIT(1)
 
#define ADE9153A_AWATTNL_MSK   NO_OS_BIT(0)
 
#define ADE9153A_CF2_LT_MSK   NO_OS_BIT(20)
 
#define ADE9153A_CF1_LT_MSK   NO_OS_BIT(19)
 
#define ADE9153A_CF_LTMR_MSK   NO_OS_GENMASK(18, 0)
 
#define ADE9153A_TEMP_OFFSET_MSK   NO_OS_GENMASK(31, 16)
 
#define ADE9153A_TEMP_GAIN_MSK   NO_OS_GENMASK(15, 0)
 
#define ADE9153A_EXT_REF_MSK   NO_OS_BIT(15)
 
#define ADE9153A_DIP_SWELL_IRQ_MODE_MSK   NO_OS_BIT(14)
 
#define ADE9153A_BURST_EN_MSK   NO_OS_BIT(11)
 
#define ADE9153A_PWR_SETTLE_MSK   NO_OS_GENMASK(9, 8)
 
#define ADE9153A_CF_ACC_CLR_MSK   NO_OS_BIT(5)
 
#define ADE9153A_ZX_OUT_OE_MSK   NO_OS_BIT(2)
 
#define ADE9153A_DREADY_OE_MSK   NO_OS_BIT(1)
 
#define ADE9153A_SWRST_MSK   NO_OS_BIT(0)
 
#define ADE9153A_CF2DIS_MSK   NO_OS_BIT(7)
 
#define ADE9153A_CF1DIS_MSK   NO_OS_BIT(6)
 
#define ADE9153A_CF2SEL_MSK   NO_OS_GENMASK(5, 3)
 
#define ADE9153A_CF1SEL_MSK   NO_OS_GENMASK(2, 0)
 
#define ADE9153A_SELFREQ_MSK   NO_OS_BIT(4)
 
#define ADE9153A_VARACC_MSK   NO_OS_GENMASK(3, 2)
 
#define ADE9153A_WATTACC_MSK   NO_OS_GENMASK(1, 0)
 
#define ADE9153A_PEAK_SEL_MSK   NO_OS_GENMASK(3, 2)
 
#define ADE9153A_OIB_EN_MSK   NO_OS_BIT(1)
 
#define ADE9153A_OIA_EN_MSK   NO_OS_BIT(0)
 
#define ADE9153A_DISZXLPF_MSK   NO_OS_BIT(0)
 
#define ADE9153A_CF2SIGN_MSK   NO_OS_BIT(7)
 
#define ADE9153A_CF1SIGN_MSK   NO_OS_BIT(6)
 
#define ADE9153A_AVARSIGN_MSK   NO_OS_BIT(1)
 
#define ADE9153A_AWSIGN_MSK   NO_OS_BIT(0)
 
#define ADE9153A_UPERIOD_SEL_MSK   NO_OS_BIT(12)
 
#define ADE9153A_HPF_CRN_MSK   NO_OS_GENMASK(11, 9)
 
#define ADE9153A_NOLOAD_TMR_MSK   NO_OS_GENMASK(7, 5)
 
#define ADE9153A_RD_RST_EN_MSK   NO_OS_BIT(3)
 
#define ADE9153A_EGY_LD_ACCUM_MSK   NO_OS_BIT(2)
 
#define ADE9153A_EGY_TMR_MODE_MSK   NO_OS_BIT(1)
 
#define ADE9153A_EGY_PWR_EN_MSK   NO_OS_BIT(0)
 
#define ADE9153A_FORCE_CRC_UPDATE_MSK   NO_OS_BIT(0)
 
#define ADE9153A_TEMP_START_MSK   NO_OS_BIT(3)
 
#define ADE9153A_TEMP_EN_MSK   NO_OS_BIT(2)
 
#define ADE9153A_TEMP_TIME_MSK   NO_OS_GENMASK(1, 0)
 
#define ADE9153A_TEMP_RESULT_MSK   NO_OS_GENMASK(11, 0)
 
#define ADE9153A_AI_SWAP_MSK   NO_OS_BIT(4)
 
#define ADE9153A_AI_GAIN_MSK   NO_OS_GENMASK(2, 0)
 
#define ADE9153A_MS_SYSRDY_MSK   NO_OS_BIT(14)
 
#define ADE9153A_MS_CONFERR_MSK   NO_OS_BIT(13)
 
#define ADE9153A_MS_ABSENT_MSK   NO_OS_BIT(12)
 
#define ADE9153A_MS_TIMEOUT_MSK   NO_OS_BIT(3)
 
#define ADE9153A_MS_READY_MSK   NO_OS_BIT(1)
 
#define ADE9153A_MS_SHIFT_MSK   NO_OS_BIT(0)
 
#define ADE9153A_OIB_MSK   NO_OS_BIT(5)
 
#define ADE9153A_OIA_MSK   NO_OS_BIT(4)
 
#define ADE9153A_SWELLA_MSK   NO_OS_BIT(2)
 
#define ADE9153A_DIPA_MSK   NO_OS_BIT(0)
 
#define ADE9153A_UART_RESET_MSK   NO_OS_BIT(7)
 
#define ADE9153A_UART_ERROR2_MSK   NO_OS_BIT(6)
 
#define ADE9153A_UART_ERROR1_MSK   NO_OS_BIT(5)
 
#define ADE9153A_UART_ERROR0_MSK   NO_OS_BIT(4)
 
#define ADE9153A_ERROR3_MSK   NO_OS_BIT(3)
 
#define ADE9153A_ERROR2_MSK   NO_OS_BIT(2)
 
#define ADE9153A_ERROR1_MSK   NO_OS_BIT(1)
 
#define ADE9153A_ERROR0_MSK   NO_OS_BIT(0)
 

Enumerations

enum  ade9153a_bi_gain_e {
  ADE9153A_PGA_CHB_GAIN_1 ,
  ADE9153A_PGA_CHB_GAIN_2 ,
  ADE9153A_PGA_CHB_GAIN_4
}
 ADE9153A Bi Gain. More...
 
enum  ade9153a_acal_ch_e {
  AUTOCAL_AV ,
  AUTOCAL_BI ,
  AUTOCAL_AI
}
 select channels for autocalibration More...
 
enum  ade9153a_acalmode_e {
  NORMAL ,
  TURBO
}
 select power mode for ch B, ch A More...
 
enum  ade9153a_selfreq_e {
  F_50_HZ ,
  F_60_HZ
}
 select frequency More...
 
enum  ade9153a_pwr_settle_e {
  ADE9153A_SETTLE_64_MS ,
  ADE9153A_SETTLE_128_MS ,
  ADE9153A_SETTLE_256_MS ,
  ADE9153A_SETTLE_0_MS
}
 ADE9153A Power settle. More...
 
enum  ade9153a_cf2sel_e {
  ADE9153A_TOTAL_ACTIVE_POWER ,
  ADE9153A_TOTAL_APPARENT_POWER ,
  ADE9153A_TOTAL_FUNDAMENTAL_REACTIVE_POWER
}
 ADE9153A CF2SEL type of energy output at CF2 Pin. More...
 
enum  ade9153a_accmode_e {
  ADE9153A_SIGNED_ACC_MODE ,
  ADE9153A_ABSOLUTE_VAL_ACC_MODE ,
  ADE9153A_POSITIVE_ACC_MODE ,
  ADE9153A_NEGATIVE_ACC_MODE
}
 ADE9153A varacc/watacc acc mode. More...
 
enum  ade9153a_peak_sel_e {
  ADE9153A_PEAK_DETECTION_DISABLE_PHA_PHB ,
  ADE9153A_PEAK_DETECTION_ENABLE_V_I_PHA ,
  ADE9153A_PEAK_DETECTION_ENABLE_I_PHB ,
  ADE9153A_PEAK_DETECTION_ENABLE_V_I_PHA_PHB
}
 ADE9153A Peak sel. More...
 
enum  ade9153a_hpf_crn_e {
  ADE9153A_HPF_CORNER_38_695_HZ ,
  ADE9153A_HPF_CORNER_19_6375_HZ ,
  ADE9153A_HPF_CORNER_9_895_HZ ,
  ADE9153A_HPF_CORNER_4_9675_HZ ,
  ADE9153A_HPF_CORNER_2_49_HZ ,
  ADE9153A_HPF_CORNER_1_2475_HZ ,
  ADE9153A_HPF_CORNER_0_625_HZ ,
  ADE9153A_HPF_CORNER_0_3125_HZ
}
 ADE9153A Hpf crn high pass filter corner freq. More...
 
enum  ade9153a_noload_tmr_e {
  ADE9153A_NOLOAD_TMR_SAMPLES_64 ,
  ADE9153A_NOLOAD_TMR_SAMPLES_128 ,
  ADE9153A_NOLOAD_TMR_SAMPLES_256 ,
  ADE9153A_NOLOAD_TMR_SAMPLES_512 ,
  ADE9153A_NOLOAD_TMR_SAMPLES_1024 ,
  ADE9153A_NOLOAD_TMR_SAMPLES_2048 ,
  ADE9153A_NOLOAD_TMR_SAMPLES_4096 ,
  ADE9153A_NOLOAD_TMR_DISABLE
}
 ADE9153A Hpf no load tmr. More...
 
enum  ade9153a_temp_time_e {
  ADE9153A_TEMP_TIME_SAMPLES_1 ,
  ADE9153A_TEMP_TIME_SAMPLES_256 ,
  ADE9153A_TEMP_TIME_SAMPLES_512 ,
  ADE9153A_TEMP_TIME_SAMPLES_1024
}
 ADE9153A Temperature readings. More...
 
enum  ade9153a_ai_gain_e {
  ADE9153A_AI_GAIN_16 = 2 ,
  ADE9153A_AI_GAIN_24 = 3 ,
  ADE9153A_AI_GAIN_32 = 4 ,
  ADE9153A_AI_GAIN_38_4 = 5
}
 ADE9153A PGA gain for current CH A. More...
 
enum  ade9153a_chip_stat_err_e {
  ADE9153A_ERROR0 ,
  ADE9153A_ERROR1 ,
  ADE9153A_ERROR2 ,
  ADE9153A_ERROR3 ,
  ADE9153A_UART_ERROR0 ,
  ADE9153A_UART_ERROR1 ,
  ADE9153A_UART_ERROR2 ,
  ADE9153A_UART_RESET
}
 ADE9153A chip status errors. More...
 
enum  ade9153a_phnoload_e {
  AFVARNL = 1 ,
  AVANL ,
  AWATTNL
}
 Type of energy that is in no load condition. More...
 
enum  dip_swell_irq_mode_en {
  CONTINUOUSE ,
  ONE_INT
}
 Dip swell irq mode. More...
 

Functions

int ade9153a_set_interface_spi (struct ade9153a_dev *dev)
 Select comms interface SPI.
 
int ade9153a_set_interface_serial (struct ade9153a_dev *dev)
 Select comms interface Serial.
 
int ade9153a_init (struct ade9153a_dev **device, struct ade9153a_init_param init_param)
 Initialize the device.
 
int ade9153a_setup (void *dev, struct ade9153a_init_param init_param)
 ADE9153A setup.
 
int ade9153a_read (struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t *reg_data)
 Read device register.
 
int ade9153a_write (struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t reg_data)
 Write device register.
 
int ade9153a_remove (struct ade9153a_dev *dev)
 Remove the device and release resources.
 
int ade9153a_sw_reset (struct ade9153a_dev *dev)
 Reset the device using SW reset.
 
int ade9153a_hw_reset (struct ade9153a_dev *dev)
 Reset the device using HW reset.
 
int ade9153a_wr_lock (struct ade9153a_dev *dev)
 Lock device.
 
int ade9153a_wr_unlock (struct ade9153a_dev *dev)
 Unlock device.
 
int ade9153a_version_product (struct ade9153a_dev *dev, uint32_t *data_read)
 Version product.
 
int ade9153a_lpf_rp_disable (struct ade9153a_dev *dev)
 Disable the low pass filter in the fundamental reactive power datapath.
 
int ade9153a_lpf_ap_disable (struct ade9153a_dev *dev)
 Disable the low-pass filter in the total active power datapath.
 
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.
 
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.
 
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.
 
int ade9153a_zx_src_after_hpf_enable (struct ade9153a_dev *dev)
 ZX data source after hpf and phase compensation.
 
int ade9153a_zx_src_before_hpf_enable (struct ade9153a_dev *dev)
 ZX data source before hpf and phase compensation.
 
int ade9153a_i_ch_b_int_enable (struct ade9153a_dev *dev)
 Current channel B integrator enable.
 
int ade9153a_hpf_disable (struct ade9153a_dev *dev)
 Disable hpf for all channels.
 
int ade9153a_bi_pgagain_set (struct ade9153a_dev *dev, enum ade9153a_bi_gain_e gain)
 Set PGA gain for current channel B.
 
int ade9153a_auto_calibration_cfg (struct ade9153a_dev *dev, enum ade9153a_acal_ch_e ch, enum ade9153a_acalmode_e mode)
 Auto calibration config.
 
int ade9153a_auto_calibration_run (struct ade9153a_dev *dev)
 Auto calibration run.
 
int ade9153a_auto_calibration_stop (struct ade9153a_dev *dev)
 Auto calibration stop.
 
int ade9153a_msure_status (struct ade9153a_dev *dev, uint8_t *status)
 mSure status
 
int ade9153a_ip_phase (struct ade9153a_dev *dev, uint8_t *ch)
 Ipeak channel phase.
 
int ade9153a_ipk_val (struct ade9153a_dev *dev, uint32_t *val)
 Ipeak val.
 
int ade9153a_vpk_val (struct ade9153a_dev *dev, uint32_t *val)
 Vpeak val.
 
int ade9153a_get_int_status (struct ade9153a_dev *dev, uint32_t msk, uint8_t *status)
 Get interrupt indicator from STATUS register.
 
int ade9153a_get_pf_rdy (struct ade9153a_dev *dev, uint8_t *status)
 Get PF ready indicator.
 
int ade9153a_get_crc_chg (struct ade9153a_dev *dev, uint8_t *status)
 Get CRC change indicator.
 
int ade9153a_get_crc_done (struct ade9153a_dev *dev, uint8_t *status)
 Get CRC done indicator.
 
int ade9153a_get_zxtoav (struct ade9153a_dev *dev, uint8_t *status)
 Get zero crossing timout on V ch indicator.
 
int ade9153a_get_zxbi (struct ade9153a_dev *dev, uint8_t *status)
 Get zero crossing detect on I ch B indicator.
 
int ade9153a_get_zxai (struct ade9153a_dev *dev, uint8_t *status)
 Get zero crossing detect on I ch A indicator.
 
int ade9153a_get_zxav (struct ade9153a_dev *dev, uint8_t *status)
 Get zero crossing detect on V ch indicator.
 
int ade9153a_get_rstdone (struct ade9153a_dev *dev, uint8_t *status)
 Get reset done indicator.
 
int ade9153a_get_fvarnl (struct ade9153a_dev *dev, uint8_t *status)
 Get fundamental reactive energy no load condition indicator.
 
int ade9153a_get_vanl (struct ade9153a_dev *dev, uint8_t *status)
 Get total apparent energy no load condition indicator.
 
int ade9153a_get_wattnl (struct ade9153a_dev *dev, uint8_t *status)
 Get total active energy no load condition indicator.
 
int ade9153a_get_temp_rdy (struct ade9153a_dev *dev, uint8_t *status)
 Get new temperature reading ready indicator.
 
int ade9153a_get_rms_oc_rdy (struct ade9153a_dev *dev, uint8_t *status)
 Get RMS_OC values update indicator.
 
int ade9153a_get_pwrrdy (struct ade9153a_dev *dev, uint8_t *status)
 Get power values registers update indicator.
 
int ade9153a_get_dready (struct ade9153a_dev *dev, uint8_t *status)
 Get new waveform samples ready indicator.
 
int ade9153a_get_egyrdy (struct ade9153a_dev *dev, uint8_t *status)
 Get power values egy ready indicator.
 
int ade9153a_get_cf2 (struct ade9153a_dev *dev, uint8_t *status)
 Get CF2 pulse issued indicator.
 
int ade9153a_get_cf1 (struct ade9153a_dev *dev, uint8_t *status)
 Get CF1 pulse issued indicator.
 
int ade9153a_get_cf2_chg (struct ade9153a_dev *dev, uint8_t *status)
 Get CF2 polarity change indicator.
 
int ade9153a_get_cf1_chg (struct ade9153a_dev *dev, uint8_t *status)
 Get CF1 polarity change indicator.
 
int ade9153a_get_rpa_chg_sgn (struct ade9153a_dev *dev, uint8_t *status)
 Get RPA (reactive power) sign change indicator.
 
int ade9153a_get_apa_chg_sgn (struct ade9153a_dev *dev, uint8_t *status)
 Get APA (active power) sign change indicator.
 
int ade9153a_clear_pf_rdy (struct ade9153a_dev *dev)
 Clear PF ready int mask.
 
int ade9153a_clear_crc_chg (struct ade9153a_dev *dev)
 Clear CRC change int mask.
 
int ade9153a_clear_crc_done (struct ade9153a_dev *dev)
 Clear CRC done int mask.
 
int ade9153a_clear_zxtoav (struct ade9153a_dev *dev)
 Clear zero crossing timout on V ch int mask.
 
int ade9153a_clear_zxbi (struct ade9153a_dev *dev)
 Clear zero crossing detect on I ch B int mask.
 
int ade9153a_clear_zxai (struct ade9153a_dev *dev)
 Clear zero crossing detect on I ch A int mask.
 
int ade9153a_clear_zxav (struct ade9153a_dev *dev)
 Clear zero crossing detect on V ch int mask.
 
int ade9153a_clear_rstdone (struct ade9153a_dev *dev)
 Clear reset done int mask.
 
int ade9153a_clear_fvarnl (struct ade9153a_dev *dev)
 Clear fundamental reactive energy no load condition int mask.
 
int ade9153a_clear_vanl (struct ade9153a_dev *dev)
 Clear total apparent energy no load condition int mask.
 
int ade9153a_clear_wattnl (struct ade9153a_dev *dev)
 Clear total active energy no load condition int mask.
 
int ade9153a_clear_temp_rdy (struct ade9153a_dev *dev)
 Clear new temperature reading ready int mask.
 
int ade9153a_clear_rms_oc_rdy (struct ade9153a_dev *dev)
 Clear RMS_OC values update int mask.
 
int ade9153a_clear_pwrrdy (struct ade9153a_dev *dev)
 Clear power values registers update int mask.
 
int ade9153a_clear_dready (struct ade9153a_dev *dev)
 Clear new waveform samples ready int mask.
 
int ade9153a_clear_egyrdy (struct ade9153a_dev *dev)
 Clear power values egy ready int mask.
 
int ade9153a_clear_cf2 (struct ade9153a_dev *dev)
 Clear CF2 pulse issued int mask.
 
int ade9153a_clear_cf1 (struct ade9153a_dev *dev)
 Clear CF1 pulse issued int mask.
 
int ade9153a_clear_cf2_chg (struct ade9153a_dev *dev)
 Clear CF2 polarity change int mask.
 
int ade9153a_clear_cf1_chg (struct ade9153a_dev *dev)
 Clear CF1 polarity change int mask.
 
int ade9153a_clear_rpa_chg_sgn (struct ade9153a_dev *dev)
 Clear RPA (reactive power) sign change int mask.
 
int ade9153a_clear_apa_chg_sgn (struct ade9153a_dev *dev)
 Clear APA (active power) sign change int mask.
 
int ade9153a_get_chip_stat (struct ade9153a_dev *dev, uint8_t *status)
 Get chip status indicator.
 
int ade9153a_clear_chip_stat (struct ade9153a_dev *dev, uint32_t *reg_val)
 Clear chip status int.
 
int ade9153a_get_event_stat (struct ade9153a_dev *dev, uint8_t *status)
 Get event status indicator.
 
int ade9153a_clear_event_stat (struct ade9153a_dev *dev, uint32_t *reg_val)
 Clear event status int.
 
int ade9153a_get_ms_stat (struct ade9153a_dev *dev, uint8_t *status)
 Get MS status indicator.
 
int ade9153a_clear_ms_stat (struct ade9153a_dev *dev, uint32_t *reg_val)
 Clear MS status int.
 
int ade9153a_control_interrupt (struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t int_msk, uint8_t en)
 Enable/disable interrupt.
 
int ade9153a_enable_chip_stat_int (struct ade9153a_dev *dev)
 Enable an interrupt when any bit in CHIP_STATUS reg is set.
 
int ade9153a_disable_chip_stat_int (struct ade9153a_dev *dev)
 Disable CHIP_STAT interrupt.
 
int ade9153a_enable_event_stat_int (struct ade9153a_dev *dev)
 Enable an interrupt when any bit in EVENT_STATUS reg is set.
 
int ade9153a_disable_event_stat_int (struct ade9153a_dev *dev)
 Disable EVENT_STAT interrupt.
 
int ade9153a_enable_ms_stat_int (struct ade9153a_dev *dev)
 Enable an interrupt when any bit in MS_STATUS_IRQ reg is set.
 
int ade9153a_disable_ms_stat_int (struct ade9153a_dev *dev)
 Disable MS_STAT interrupt.
 
int ade9153a_enable_pf_rdy_int (struct ade9153a_dev *dev)
 Enable pf ready interrupt.
 
int ade9153a_disable_pf_rdy_int (struct ade9153a_dev *dev)
 Disable pf ready interrupt.
 
int ade9153a_enable_crc_chg_int (struct ade9153a_dev *dev)
 Enable crc change interrupt.
 
int ade9153a_disable_crc_chg_int (struct ade9153a_dev *dev)
 Disable crc change interrupt.
 
int ade9153a_enable_crc_done_int (struct ade9153a_dev *dev)
 Enable crc done interrupt.
 
int ade9153a_disable_crc_done_int (struct ade9153a_dev *dev)
 Disable crc done interrupt.
 
int ade9153a_enable_zxtoav_int (struct ade9153a_dev *dev)
 Enable zero corssing timeout on voltage ch interrupt.
 
int ade9153a_disable_zxtoav_int (struct ade9153a_dev *dev)
 Disable zero corssing timeout on voltage ch interrupt.
 
int ade9153a_enable_zxbi_int (struct ade9153a_dev *dev)
 Enable zero corssing detected on I ch B interrupt.
 
int ade9153a_disable_zxbi_int (struct ade9153a_dev *dev)
 Disable zero corssing detected on I ch B interrupt.
 
int ade9153a_enable_zxai_int (struct ade9153a_dev *dev)
 Enable zero corssing detected on I ch A interrupt.
 
int ade9153a_disable_zxai_int (struct ade9153a_dev *dev)
 Disable zero corssing detected on I ch A interrupt.
 
int ade9153a_enable_zxav_int (struct ade9153a_dev *dev)
 Enable zero corssing detected on V ch interrupt.
 
int ade9153a_disable_zxav_int (struct ade9153a_dev *dev)
 Disable zero corssing detected on V ch interrupt.
 
int ade9153a_enable_fvarnl_int (struct ade9153a_dev *dev)
 Enable fundamental reactive energy no load condition interrupt.
 
int ade9153a_disable_fvarnl_int (struct ade9153a_dev *dev)
 Disable fundamental reactive energy no load condition interrupt.
 
int ade9153a_enable_vanl_int (struct ade9153a_dev *dev)
 Enable total apparent energy no load condition interrupt.
 
int ade9153a_disable_vanl_int (struct ade9153a_dev *dev)
 Disable total apparent energy no load condition interrupt.
 
int ade9153a_enable_wattnl_int (struct ade9153a_dev *dev)
 Enable total active energy no load condition interrupt.
 
int ade9153a_disable_wattnl_int (struct ade9153a_dev *dev)
 Disable total active energy no load condition interrupt.
 
int ade9153a_enable_temp_rdy_int (struct ade9153a_dev *dev)
 Enable new temperature reading interrupt.
 
int ade9153a_disable_temp_rdy_int (struct ade9153a_dev *dev)
 Disable new temperature reading interrupt.
 
int ade9153a_enable_rms_oc_rdy_int (struct ade9153a_dev *dev)
 Enable RMS_OC values update interrupt.
 
int ade9153a_disable_rms_oc_rdy_int (struct ade9153a_dev *dev)
 Disable RMS_OC values update interrupt.
 
int ade9153a_enable_pwrrdy_int (struct ade9153a_dev *dev)
 Enable PWRRDY interrupt.
 
int ade9153a_disable_pwrrdy_int (struct ade9153a_dev *dev)
 Disable PWRRDY interrupt.
 
int ade9153a_enable_dready_int (struct ade9153a_dev *dev)
 Enable data ready interrupt.
 
int ade9153a_disable_dready_int (struct ade9153a_dev *dev)
 Disable data ready interrupt.
 
int ade9153a_enable_egyrdy_int (struct ade9153a_dev *dev)
 Enable EGYRDY interrupt.
 
int ade9153a_disable_egyrdy_int (struct ade9153a_dev *dev)
 Disable EGYRDY interrupt.
 
int ade9153a_enable_cf2_int (struct ade9153a_dev *dev)
 Enable CF2 interrupt.
 
int ade9153a_disable_cf2_int (struct ade9153a_dev *dev)
 Disable CF2 interrupt.
 
int ade9153a_enable_cf1_int (struct ade9153a_dev *dev)
 Enable CF1 interrupt.
 
int ade9153a_disable_cf1_int (struct ade9153a_dev *dev)
 Disable CF1 interrupt.
 
int ade9153a_enable_revpcf2_int (struct ade9153a_dev *dev)
 Enable CF2 polarity change sign interrupt.
 
int ade9153a_disable_revpcf2_int (struct ade9153a_dev *dev)
 Disable CF2 polarity change sign interrupt.
 
int ade9153a_enable_revpcf1_int (struct ade9153a_dev *dev)
 Enable CF1 polarity change sign interrupt.
 
int ade9153a_disable_revpcf1_int (struct ade9153a_dev *dev)
 Disable CF1 polarity change sign interrupt.
 
int ade9153a_enable_revrpa_int (struct ade9153a_dev *dev)
 Enable Phase A fundamental reactive power changed sign interrupt.
 
int ade9153a_disable_revrpa_int (struct ade9153a_dev *dev)
 Disable Phase A fundamental reactive power changed sign interrupt.
 
int ade9153a_enable_revapa_int (struct ade9153a_dev *dev)
 Enable Phase A total active power changed sign interrupt.
 
int ade9153a_disable_revapa_int (struct ade9153a_dev *dev)
 Disable Phase A total active power changed sign interrupt.
 
int ade9153a_oi_lvl_val (struct ade9153a_dev *dev, uint32_t *val)
 Overcurrent detection threshold level val.
 
int ade9153a_oia_val (struct ade9153a_dev *dev, uint32_t *val)
 Ch A overcurrent val.
 
int ade9153a_oib_val (struct ade9153a_dev *dev, uint32_t *val)
 Ch B overcurrent val.
 
int ade9153a_vlevel_val (struct ade9153a_dev *dev, uint32_t *val)
 Vlevel val.
 
int ade9153a_dipa_val (struct ade9153a_dev *dev, uint32_t *val)
 Voltage value during dip condition.
 
int ade9153a_swella_val (struct ade9153a_dev *dev, uint32_t *val)
 Voltage value during swell condition.
 
int ade9153a_get_phnoload_status (struct ade9153a_dev *dev, uint8_t *status)
 Get phnoload status.
 
int ade9153a_cf2_lt_status (struct ade9153a_dev *dev, uint8_t *status)
 CF2_LT status.
 
int ade9153a_cf1_lt_status (struct ade9153a_dev *dev, uint8_t *status)
 CF1_LT status.
 
int ade9153a_cf_ltmr_write (struct ade9153a_dev *dev, uint32_t reg_data)
 cf_ltmr write value.
 
int ade9153a_cf_ltmr_val (struct ade9153a_dev *dev, uint32_t *val)
 cf_ltmr read value.
 
int ade9153a_temp_offset_val (struct ade9153a_dev *dev, uint32_t *val)
 temperature sensor offset.
 
int ade9153a_temp_gain_val (struct ade9153a_dev *dev, uint32_t *val)
 temperature sensor gain.
 
int ade9153a_ext_ref (struct ade9153a_dev *dev, uint8_t en)
 External voltage reference enable/disable.
 
int ade9153a_ext_ref_status (struct ade9153a_dev *dev, uint8_t *status)
 External_reference status.
 
int ade9153a_dip_swell_irq_mode (struct ade9153a_dev *dev, enum dip_swell_irq_mode_en mode)
 Dip swell interrupt mode.
 
int ade9153a_burst_en (struct ade9153a_dev *dev)
 Burst read enable/disable.
 
int ade9153a_pwr_settle_set (struct ade9153a_dev *dev, enum ade9153a_pwr_settle_e time)
 Set PWR_SETTLE.
 
int ade9153a_cf_acc_clr (struct ade9153a_dev *dev)
 Clear accumulation in the digital freq conv.
 
int ade9153a_zx_out_oe (struct ade9153a_dev *dev)
 ZX driven to CF2 pin.
 
int ade9153a_dready_oe (struct ade9153a_dev *dev)
 DREADY driven to CF2 pin.
 
int ade9153a_cf2dis (struct ade9153a_dev *dev)
 CF2 output disable.
 
int ade9153a_cf1dis (struct ade9153a_dev *dev)
 CF1 output disable.
 
int ade9153a_cf2sel (struct ade9153a_dev *dev, enum ade9153a_cf2sel_e energy_type)
 Set type of energy output on CF2 pin.
 
int ade9153a_cf1sel (struct ade9153a_dev *dev, enum ade9153a_cf2sel_e energy_type)
 Set type of energy output on CF1 pin.
 
int ade9153a_selfreq (struct ade9153a_dev *dev, enum ade9153a_selfreq_e freq)
 Frequency select.
 
int ade9153a_freq_s_status (struct ade9153a_dev *dev, uint8_t *status)
 Frequency setting.
 
int ade9153a_varacc (struct ade9153a_dev *dev, enum ade9153a_accmode_e varacc_type)
 Select fundamental reactive power accumulation mode.
 
int ade9153a_wattacc (struct ade9153a_dev *dev, enum ade9153a_accmode_e wattacc_type)
 Select Total active power accumulation mode.
 
int ade9153a_peak_sel (struct ade9153a_dev *dev, enum ade9153a_peak_sel_e peak_sel)
 Select peak detection channels.
 
int ade9153a_oib_en (struct ade9153a_dev *dev)
 Ch B overcurretn detection enable.
 
int ade9153a_oia_en (struct ade9153a_dev *dev)
 Ch A overcurretn detection enable.
 
int ade9153a_diszxlpf (struct ade9153a_dev *dev)
 Zero crossing lpf disable.
 
int ade9153a_cf2sign_status (struct ade9153a_dev *dev, uint8_t *status)
 Sign of CF2 power.
 
int ade9153a_cf1sign_status (struct ade9153a_dev *dev, uint8_t *status)
 Sign of CF1 power.
 
int ade9153a_avarsign_status (struct ade9153a_dev *dev, uint8_t *status)
 Sign of reactive power.
 
int ade9153a_awsign_status (struct ade9153a_dev *dev, uint8_t *status)
 Sign of active power.
 
int ade9153a_uperiod_sel (struct ade9153a_dev *dev, uint8_t en)
 User period select.
 
int ade9153a_hpf_crn (struct ade9153a_dev *dev, enum ade9153a_hpf_crn_e hpf_corner_freq)
 Hpf corner freq.
 
int ade9153a_noload_tmr (struct ade9153a_dev *dev, enum ade9153a_noload_tmr_e noload_samples)
 Set no. of samples for no load condition.
 
int ade9153a_rd_rst_en (struct ade9153a_dev *dev)
 Energy register read with value reset.
 
int ade9153a_egy_ld_accum (struct ade9153a_dev *dev, uint8_t en)
 Internal energy register accum.
 
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.
 
int ade9153a_egy_pwr_en (struct ade9153a_dev *dev)
 Enable the energy and power accumulator when the run bit is also set.
 
int ade9153a_force_crc_update (struct ade9153a_dev *dev)
 Force CRC calculation to start (update).
 
int ade9153a_temp_start (struct ade9153a_dev *dev)
 Manually request a new temperature sensor reading.
 
int ade9153a_temp_en (struct ade9153a_dev *dev)
 Enable the temperature sensor.
 
int ade9153a_temp_time (struct ade9153a_dev *dev, enum ade9153a_temp_time_e temp_no_samples)
 Select the number of temperature readings to average.
 
int ade9153a_temp_result (struct ade9153a_dev *dev, uint16_t *val)
 Temperature result.
 
int ade9153a_compmode (struct ade9153a_dev *dev)
 COMPMODE.
 
int ade9153a_run (struct ade9153a_dev *dev)
 Start measurements.
 
int ade9153a_stop (struct ade9153a_dev *dev)
 Stop measurements.
 
int ade9153a_ai_swap (struct ade9153a_dev *dev, uint8_t set)
 Set the signal side of the PGA.
 
int ade9153a_ai_gain (struct ade9153a_dev *dev, enum ade9153a_ai_gain_e gain)
 Set the PGA gain for I chA.
 
int ade9153a_ms_sysrdy (struct ade9153a_dev *dev, uint8_t *status)
 New run of mSure ready.
 
int ade9153a_ms_conferr (struct ade9153a_dev *dev, uint8_t *status)
 Invalid config of mSure status.
 
int ade9153a_ms_absent (struct ade9153a_dev *dev, uint8_t *status)
 mSure not detected on the last enabled ch
 
int ade9153a_ms_timeout (struct ade9153a_dev *dev, uint8_t *status)
 mSure timed out (600s)
 
int ade9153a_ms_ready (struct ade9153a_dev *dev, uint8_t *status)
 mSure ready
 
int ade9153a_ms_shift (struct ade9153a_dev *dev, uint8_t *status)
 mSure shift detected in CC val
 
int ade9153a_chip_status (struct ade9153a_dev *dev, uint8_t *status)
 Chip status.
 
int ade9153a_temp_val (struct ade9153a_dev *dev, struct ade9153a_temperature_value *data)
 Temperature value in deg C.
 
int ade9153a_energy_vals (struct ade9153a_dev *dev, struct ade9153a_energy_values *data)
 Read energy values.
 
int ade9153a_power_vals (struct ade9153a_dev *dev, struct ade9153a_power_values *data)
 Read power values.
 
int ade9153a_rms_vals (struct ade9153a_dev *dev, struct ade9153a_rms_values *data)
 Read rms values.
 
int ade9153a_half_rms_vals (struct ade9153a_dev *dev, struct ade9153a_half_rms_values *data)
 Read half rms values.
 
int ade9153a_power_quality_vals (struct ade9153a_dev *dev, struct ade9153a_pq_values *data)
 Read power quaility values.
 
int ade9153a_start_autocal_ai (struct ade9153a_dev *dev, enum ade9153a_acalmode_e mode)
 Start autocalibration AI channel.
 
int ade9153a_start_autocal_bi (struct ade9153a_dev *dev, enum ade9153a_acalmode_e mode)
 Start autocalibration BI channel.
 
int ade9153a_start_autocal_av (struct ade9153a_dev *dev, enum ade9153a_acalmode_e mode)
 Start autocalibration AV channel.
 
int ade9153a_read_autocal_vals (struct ade9153a_dev *dev, struct ade9153a_autocal_vals *data)
 Read autocalibration values.
 

Detailed Description

Header file of ADE9153A Driver.

Author
Radu Etz (radu..nosp@m.etz@.nosp@m.analo.nosp@m.g.co.nosp@m.m)

Copyright 2024(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ ADE9153A_ACAL_MODE_MSK

#define ADE9153A_ACAL_MODE_MSK   NO_OS_BIT(0)

◆ ADE9153A_ACAL_RUN_MSK

#define ADE9153A_ACAL_RUN_MSK   NO_OS_BIT(1)

◆ ADE9153A_ACALMODE_AI_MSK

#define ADE9153A_ACALMODE_AI_MSK   NO_OS_BIT(2)

◆ ADE9153A_ACALMODE_BI_MSK

#define ADE9153A_ACALMODE_BI_MSK   NO_OS_BIT(3)

◆ ADE9153A_AFVARNL_MSK

#define ADE9153A_AFVARNL_MSK   NO_OS_BIT(2)

◆ ADE9153A_AI_GAIN_MSK

#define ADE9153A_AI_GAIN_MSK   NO_OS_GENMASK(2, 0)

◆ ADE9153A_AI_SWAP_MSK

#define ADE9153A_AI_SWAP_MSK   NO_OS_BIT(4)

◆ ADE9153A_AUTOCAL_AI_MSK

#define ADE9153A_AUTOCAL_AI_MSK   NO_OS_BIT(4)

◆ ADE9153A_AUTOCAL_AV_MSK

#define ADE9153A_AUTOCAL_AV_MSK   NO_OS_BIT(6)

◆ ADE9153A_AUTOCAL_BI_MSK

#define ADE9153A_AUTOCAL_BI_MSK   NO_OS_BIT(5)

◆ ADE9153A_AVANL_MSK

#define ADE9153A_AVANL_MSK   NO_OS_BIT(1)

◆ ADE9153A_AVARSIGN_MSK

#define ADE9153A_AVARSIGN_MSK   NO_OS_BIT(1)

◆ ADE9153A_AWATTNL_MSK

#define ADE9153A_AWATTNL_MSK   NO_OS_BIT(0)

◆ ADE9153A_AWSIGN_MSK

#define ADE9153A_AWSIGN_MSK   NO_OS_BIT(0)

◆ ADE9153A_BI_PGAGAIN_MSK

#define ADE9153A_BI_PGAGAIN_MSK   NO_OS_GENMASK(31, 0)

◆ ADE9153A_BURST_EN_MSK

#define ADE9153A_BURST_EN_MSK   NO_OS_BIT(11)

◆ ADE9153A_CF1_LT_MSK

#define ADE9153A_CF1_LT_MSK   NO_OS_BIT(19)

◆ ADE9153A_CF1_MSK

#define ADE9153A_CF1_MSK   NO_OS_BIT(6)

◆ ADE9153A_CF1DIS_MSK

#define ADE9153A_CF1DIS_MSK   NO_OS_BIT(6)

◆ ADE9153A_CF1SEL_MSK

#define ADE9153A_CF1SEL_MSK   NO_OS_GENMASK(2, 0)

◆ ADE9153A_CF1SIGN_MSK

#define ADE9153A_CF1SIGN_MSK   NO_OS_BIT(6)

◆ ADE9153A_CF2_LT_MSK

#define ADE9153A_CF2_LT_MSK   NO_OS_BIT(20)

◆ ADE9153A_CF2_MSK

#define ADE9153A_CF2_MSK   NO_OS_BIT(7)

◆ ADE9153A_CF2DIS_MSK

#define ADE9153A_CF2DIS_MSK   NO_OS_BIT(7)

◆ ADE9153A_CF2SEL_MSK

#define ADE9153A_CF2SEL_MSK   NO_OS_GENMASK(5, 3)

◆ ADE9153A_CF2SIGN_MSK

#define ADE9153A_CF2SIGN_MSK   NO_OS_BIT(7)

◆ ADE9153A_CF_ACC_CLR_MSK

#define ADE9153A_CF_ACC_CLR_MSK   NO_OS_BIT(5)

◆ ADE9153A_CF_LTMR_MSK

#define ADE9153A_CF_LTMR_MSK   NO_OS_GENMASK(18, 0)

◆ ADE9153A_CHIP_STAT_MSK

#define ADE9153A_CHIP_STAT_MSK   NO_OS_BIT(31)

◆ ADE9153A_COMPMODEVAL

#define ADE9153A_COMPMODEVAL   0x0005

◆ ADE9153A_CRC16_INIT_VAL

#define ADE9153A_CRC16_INIT_VAL   0xFFFF

◆ ADE9153A_CRC16_POLY

#define ADE9153A_CRC16_POLY   0x1021

◆ ADE9153A_CRC_CHG_MSK

#define ADE9153A_CRC_CHG_MSK   NO_OS_BIT(24)

◆ ADE9153A_CRC_DONE_MSK

#define ADE9153A_CRC_DONE_MSK   NO_OS_BIT(23)

◆ ADE9153A_DIP_SWELL_IRQ_MODE_MSK

#define ADE9153A_DIP_SWELL_IRQ_MODE_MSK   NO_OS_BIT(14)

◆ ADE9153A_DIPA_MSK

#define ADE9153A_DIPA_MSK   NO_OS_BIT(0)

◆ ADE9153A_DIPA_VAL_MSK

#define ADE9153A_DIPA_VAL_MSK   NO_OS_GENMASK(23, 0)

◆ ADE9153A_DISAPLPF_MSK

#define ADE9153A_DISAPLPF_MSK   NO_OS_BIT(7)

◆ ADE9153A_DISRPLPF_MSK

#define ADE9153A_DISRPLPF_MSK   NO_OS_BIT(8)

◆ ADE9153A_DISZXLPF_MSK

#define ADE9153A_DISZXLPF_MSK   NO_OS_BIT(0)

◆ ADE9153A_DREADY_MSK

#define ADE9153A_DREADY_MSK   NO_OS_BIT(9)

◆ ADE9153A_DREADY_OE_MSK

#define ADE9153A_DREADY_OE_MSK   NO_OS_BIT(1)

◆ ADE9153A_EGY_LD_ACCUM_MSK

#define ADE9153A_EGY_LD_ACCUM_MSK   NO_OS_BIT(2)

◆ ADE9153A_EGY_PWR_EN_MSK

#define ADE9153A_EGY_PWR_EN_MSK   NO_OS_BIT(0)

◆ ADE9153A_EGY_TMR_MODE_MSK

#define ADE9153A_EGY_TMR_MODE_MSK   NO_OS_BIT(1)

◆ ADE9153A_EGYRDY_MSK

#define ADE9153A_EGYRDY_MSK   NO_OS_BIT(8)

◆ ADE9153A_END_16ADDR

#define ADE9153A_END_16ADDR   0x600

◆ ADE9153A_ERROR0_MSK

#define ADE9153A_ERROR0_MSK   NO_OS_BIT(0)

◆ ADE9153A_ERROR1_MSK

#define ADE9153A_ERROR1_MSK   NO_OS_BIT(1)

◆ ADE9153A_ERROR2_MSK

#define ADE9153A_ERROR2_MSK   NO_OS_BIT(2)

◆ ADE9153A_ERROR3_MSK

#define ADE9153A_ERROR3_MSK   NO_OS_BIT(3)

◆ ADE9153A_EVENT_STAT_MSK

#define ADE9153A_EVENT_STAT_MSK   NO_OS_BIT(30)

◆ ADE9153A_EXT_REF_MSK

#define ADE9153A_EXT_REF_MSK   NO_OS_BIT(15)

◆ ADE9153A_FORCE_CRC_UPDATE_MSK

#define ADE9153A_FORCE_CRC_UPDATE_MSK   NO_OS_BIT(0)

◆ ADE9153A_FVARNL_MSK

#define ADE9153A_FVARNL_MSK   NO_OS_BIT(15)

◆ ADE9153A_HPF_CRN_MSK

#define ADE9153A_HPF_CRN_MSK   NO_OS_GENMASK(11, 9)

◆ ADE9153A_HPFDIS_MSK

#define ADE9153A_HPFDIS_MSK   NO_OS_BIT(0)

◆ ADE9153A_INTEN_BI_MSK

#define ADE9153A_INTEN_BI_MSK   NO_OS_BIT(2)

◆ ADE9153A_IPEAKVAL_MSK

#define ADE9153A_IPEAKVAL_MSK   NO_OS_GENMASK(23, 0)

◆ ADE9153A_IPPHASE_MSK

#define ADE9153A_IPPHASE_MSK   NO_OS_GENMASK(26, 24)

◆ ADE9153A_LOCK_KEY

#define ADE9153A_LOCK_KEY   0x3C64

◆ ADE9153A_MS_ABSENT_MSK

#define ADE9153A_MS_ABSENT_MSK   NO_OS_BIT(12)

◆ ADE9153A_MS_CONFERR_MSK

#define ADE9153A_MS_CONFERR_MSK   NO_OS_BIT(13)

◆ ADE9153A_MS_READY_MSK

#define ADE9153A_MS_READY_MSK   NO_OS_BIT(1)

◆ ADE9153A_MS_SHIFT_MSK

#define ADE9153A_MS_SHIFT_MSK   NO_OS_BIT(0)

◆ ADE9153A_MS_STAT_MSK

#define ADE9153A_MS_STAT_MSK   NO_OS_BIT(29)

◆ ADE9153A_MS_SYSRDY_MSK

#define ADE9153A_MS_SYSRDY_MSK   NO_OS_BIT(14)

◆ ADE9153A_MS_SYSRDYP_MSK

#define ADE9153A_MS_SYSRDYP_MSK   NO_OS_BIT(0)

◆ ADE9153A_MS_TIMEOUT_MSK

#define ADE9153A_MS_TIMEOUT_MSK   NO_OS_BIT(3)

◆ ADE9153A_NO_BYTES_R_16

#define ADE9153A_NO_BYTES_R_16   0x0006

◆ ADE9153A_NO_BYTES_R_32

#define ADE9153A_NO_BYTES_R_32   0x0008

◆ ADE9153A_NO_BYTES_W_16

#define ADE9153A_NO_BYTES_W_16   0x0004

◆ ADE9153A_NO_BYTES_W_32

#define ADE9153A_NO_BYTES_W_32   0x0006

◆ ADE9153A_NOLOAD_TMR_MSK

#define ADE9153A_NOLOAD_TMR_MSK   NO_OS_GENMASK(7, 5)

◆ ADE9153A_OIA_EN_MSK

#define ADE9153A_OIA_EN_MSK   NO_OS_BIT(0)

◆ ADE9153A_OIA_MSK

#define ADE9153A_OIA_MSK   NO_OS_BIT(4)

◆ ADE9153A_OIA_VAL_MSK

#define ADE9153A_OIA_VAL_MSK   NO_OS_GENMASK(23, 0)

◆ ADE9153A_OIB_EN_MSK

#define ADE9153A_OIB_EN_MSK   NO_OS_BIT(1)

◆ ADE9153A_OIB_MSK

#define ADE9153A_OIB_MSK   NO_OS_BIT(5)

◆ ADE9153A_OIB_VAL_MSK

#define ADE9153A_OIB_VAL_MSK   NO_OS_GENMASK(23, 0)

◆ ADE9153A_OILVL_VAL_MSK

#define ADE9153A_OILVL_VAL_MSK   NO_OS_GENMASK(23, 0)

◆ ADE9153A_PEAK_SEL_MSK

#define ADE9153A_PEAK_SEL_MSK   NO_OS_GENMASK(3, 2)

◆ ADE9153A_PF_RDY_MSK

#define ADE9153A_PF_RDY_MSK   NO_OS_BIT(25)

◆ ADE9153A_PWR_SETTLE_MSK

#define ADE9153A_PWR_SETTLE_MSK   NO_OS_GENMASK(9, 8)

◆ ADE9153A_PWRRDY_MSK

#define ADE9153A_PWRRDY_MSK   NO_OS_BIT(10)

◆ ADE9153A_RD_RST_EN_MSK

#define ADE9153A_RD_RST_EN_MSK   NO_OS_BIT(3)

◆ ADE9153A_REG_

#define ADE9153A_REG_   AI_WAV_2 0x610

◆ ADE9153A_REG_ACCMODE

#define ADE9153A_REG_ACCMODE   0x492

◆ ADE9153A_REG_ACT_NL_LVL

#define ADE9153A_REG_ACT_NL_LVL   0x41C

◆ ADE9153A_REG_AFVAR

#define ADE9153A_REG_AFVAR   0x207

◆ ADE9153A_REG_AFVAR_1

#define ADE9153A_REG_AFVAR_1   0x60A

◆ ADE9153A_REG_AFVAR_2

#define ADE9153A_REG_AFVAR_2   0x616

◆ ADE9153A_REG_AFVAR_ACC

#define ADE9153A_REG_AFVAR_ACC   0x3BB

◆ ADE9153A_REG_AFVAR_OS

#define ADE9153A_REG_AFVAR_OS   0x007

◆ ADE9153A_REG_AFVARHR_HI

#define ADE9153A_REG_AFVARHR_HI   0x3BD

◆ ADE9153A_REG_AFVARHR_LO

#define ADE9153A_REG_AFVARHR_LO   0x3BC

◆ ADE9153A_REG_AI_PGAGAIN

#define ADE9153A_REG_AI_PGAGAIN   0x4B9

◆ ADE9153A_REG_AI_WAV

#define ADE9153A_REG_AI_WAV   0x200

◆ ADE9153A_REG_AI_WAV_1

#define ADE9153A_REG_AI_WAV_1   0x600

◆ ADE9153A_REG_AIGAIN

#define ADE9153A_REG_AIGAIN   0x000

◆ ADE9153A_REG_AIRMS

#define ADE9153A_REG_AIRMS   0x202

◆ ADE9153A_REG_AIRMS_1

#define ADE9153A_REG_AIRMS_1   0x604

◆ ADE9153A_REG_AIRMS_2

#define ADE9153A_REG_AIRMS_2   0x612

◆ ADE9153A_REG_AIRMS_OC

#define ADE9153A_REG_AIRMS_OC   0x209

◆ ADE9153A_REG_AIRMS_OC_OS

#define ADE9153A_REG_AIRMS_OC_OS   0x009

◆ ADE9153A_REG_AIRMS_OS

#define ADE9153A_REG_AIRMS_OS   0x003

◆ ADE9153A_REG_ANGL_AI_BI

#define ADE9153A_REG_ANGL_AI_BI   0x488

◆ ADE9153A_REG_ANGL_AV_AI

#define ADE9153A_REG_ANGL_AV_AI   0x485

◆ ADE9153A_REG_APERIOD

#define ADE9153A_REG_APERIOD   0x418

◆ ADE9153A_REG_APF

#define ADE9153A_REG_APF   0x208

◆ ADE9153A_REG_APF_1

#define ADE9153A_REG_APF_1   0x60E

◆ ADE9153A_REG_APF_2

#define ADE9153A_REG_APF_2   0x617

◆ ADE9153A_REG_APGAIN

#define ADE9153A_REG_APGAIN   0x005

◆ ADE9153A_REG_APHASECAL

#define ADE9153A_REG_APHASECAL   0x001

◆ ADE9153A_REG_APP_NL_LVL

#define ADE9153A_REG_APP_NL_LVL   0x41E

◆ ADE9153A_REG_AV_WAV

#define ADE9153A_REG_AV_WAV   0x201

◆ ADE9153A_REG_AV_WAV_1

#define ADE9153A_REG_AV_WAV_1   0x601

◆ ADE9153A_REG_AV_WAV_2

#define ADE9153A_REG_AV_WAV_2   0x611

◆ ADE9153A_REG_AVA

#define ADE9153A_REG_AVA   0x206

◆ ADE9153A_REG_AVA_1

#define ADE9153A_REG_AVA_1   0x60C

◆ ADE9153A_REG_AVA_2

#define ADE9153A_REG_AVA_2   0x615

◆ ADE9153A_REG_AVA_ACC

#define ADE9153A_REG_AVA_ACC   0x3B1

◆ ADE9153A_REG_AVAHR_HI

#define ADE9153A_REG_AVAHR_HI   0x3B3

◆ ADE9153A_REG_AVAHR_LO

#define ADE9153A_REG_AVAHR_LO   0x3B2

◆ ADE9153A_REG_AVGAIN

#define ADE9153A_REG_AVGAIN   0x002

◆ ADE9153A_REG_AVRMS

#define ADE9153A_REG_AVRMS   0x203

◆ ADE9153A_REG_AVRMS_1

#define ADE9153A_REG_AVRMS_1   0x606

◆ ADE9153A_REG_AVRMS_2

#define ADE9153A_REG_AVRMS_2   0x613

◆ ADE9153A_REG_AVRMS_OC

#define ADE9153A_REG_AVRMS_OC   0x20A

◆ ADE9153A_REG_AVRMS_OC_OS

#define ADE9153A_REG_AVRMS_OC_OS   0x008

◆ ADE9153A_REG_AVRMS_OS

#define ADE9153A_REG_AVRMS_OS   0x004

◆ ADE9153A_REG_AWATT

#define ADE9153A_REG_AWATT   0x204

◆ ADE9153A_REG_AWATT_1

#define ADE9153A_REG_AWATT_1   0x608

◆ ADE9153A_REG_AWATT_2

#define ADE9153A_REG_AWATT_2   0x614

◆ ADE9153A_REG_AWATT_ACC

#define ADE9153A_REG_AWATT_ACC   0x39D

◆ ADE9153A_REG_AWATT_OS

#define ADE9153A_REG_AWATT_OS   0x006

◆ ADE9153A_REG_AWATTHR_HI

#define ADE9153A_REG_AWATTHR_HI   0x39F

◆ ADE9153A_REG_AWATTHR_LO

#define ADE9153A_REG_AWATTHR_LO   0x39E

◆ ADE9153A_REG_BI_PGAGAIN

#define ADE9153A_REG_BI_PGAGAIN   0x023

◆ ADE9153A_REG_BI_WAV

#define ADE9153A_REG_BI_WAV   0x210

◆ ADE9153A_REG_BI_WAV_1

#define ADE9153A_REG_BI_WAV_1   0x602

◆ ADE9153A_REG_BI_WAV_2

#define ADE9153A_REG_BI_WAV_2   0x618

◆ ADE9153A_REG_BIGAIN

#define ADE9153A_REG_BIGAIN   0x010

◆ ADE9153A_REG_BIRMS

#define ADE9153A_REG_BIRMS   0x212

◆ ADE9153A_REG_BIRMS_1

#define ADE9153A_REG_BIRMS_1   0x605

◆ ADE9153A_REG_BIRMS_2

#define ADE9153A_REG_BIRMS_2   0x61A

◆ ADE9153A_REG_BIRMS_OC

#define ADE9153A_REG_BIRMS_OC   0x219

◆ ADE9153A_REG_BIRMS_OC_OS

#define ADE9153A_REG_BIRMS_OC_OS   0x019

◆ ADE9153A_REG_BIRMS_OS

#define ADE9153A_REG_BIRMS_OS   0x013

◆ ADE9153A_REG_BPHASECAL

#define ADE9153A_REG_BPHASECAL   0x011

◆ ADE9153A_REG_CF1DEN

#define ADE9153A_REG_CF1DEN   0x494

◆ ADE9153A_REG_CF2DEN

#define ADE9153A_REG_CF2DEN   0x495

◆ ADE9153A_REG_CF_LCFG

#define ADE9153A_REG_CF_LCFG   0x425

◆ ADE9153A_REG_CFMODE

#define ADE9153A_REG_CFMODE   0x490

◆ ADE9153A_REG_CHIP_ID_HI

#define ADE9153A_REG_CHIP_ID_HI   0x472

◆ ADE9153A_REG_CHIP_ID_LO

#define ADE9153A_REG_CHIP_ID_LO   0x473

◆ ADE9153A_REG_CHIP_STATUS

#define ADE9153A_REG_CHIP_STATUS   0x4C2

◆ ADE9153A_REG_COMPMODE

#define ADE9153A_REG_COMPMODE   0x491

◆ ADE9153A_REG_CONFIG0

#define ADE9153A_REG_CONFIG0   0x020

◆ ADE9153A_REG_CONFIG1

#define ADE9153A_REG_CONFIG1   0x481

◆ ADE9153A_REG_CONFIG2

#define ADE9153A_REG_CONFIG2   0x4AF

◆ ADE9153A_REG_CONFIG3

#define ADE9153A_REG_CONFIG3   0x493

◆ ADE9153A_REG_CRC_FORCE

#define ADE9153A_REG_CRC_FORCE   0x4B4

◆ ADE9153A_REG_CRC_RSLT

#define ADE9153A_REG_CRC_RSLT   0x4A8

◆ ADE9153A_REG_CRC_SPI

#define ADE9153A_REG_CRC_SPI   0x4A9

◆ ADE9153A_REG_CT_CORNER

#define ADE9153A_REG_CT_CORNER   0x04A

◆ ADE9153A_REG_CT_PHASE_DELAY

#define ADE9153A_REG_CT_PHASE_DELAY   0x049

◆ ADE9153A_REG_CT_PHASE_MEAS

#define ADE9153A_REG_CT_PHASE_MEAS   0x424

◆ ADE9153A_REG_DICOEFF

#define ADE9153A_REG_DICOEFF   0x022

◆ ADE9153A_REG_DIP_CYC

#define ADE9153A_REG_DIP_CYC   0x48B

◆ ADE9153A_REG_DIP_LVL

#define ADE9153A_REG_DIP_LVL   0x410

◆ ADE9153A_REG_DIPA

#define ADE9153A_REG_DIPA   0x411

◆ ADE9153A_REG_EGY_TIME

#define ADE9153A_REG_EGY_TIME   0x4B2

◆ ADE9153A_REG_EP_CFG

#define ADE9153A_REG_EP_CFG   0x4B0

◆ ADE9153A_REG_EVENT_STATUS

#define ADE9153A_REG_EVENT_STATUS   0x4C1

◆ ADE9153A_REG_IPEAK

#define ADE9153A_REG_IPEAK   0x400

◆ ADE9153A_REG_LAST_CMD

#define ADE9153A_REG_LAST_CMD   0x4AE

◆ ADE9153A_REG_LAST_DATA_16

#define ADE9153A_REG_LAST_DATA_16   0x4AC

◆ ADE9153A_REG_LAST_DATA_32

#define ADE9153A_REG_LAST_DATA_32   0x423

◆ ADE9153A_REG_MASK

#define ADE9153A_REG_MASK   0x405

◆ ADE9153A_REG_MS_ACAL_AICC

#define ADE9153A_REG_MS_ACAL_AICC   0x220

◆ ADE9153A_REG_MS_ACAL_AICERT

#define ADE9153A_REG_MS_ACAL_AICERT   0x221

◆ ADE9153A_REG_MS_ACAL_AVCC

#define ADE9153A_REG_MS_ACAL_AVCC   0x224

◆ ADE9153A_REG_MS_ACAL_AVCERT

#define ADE9153A_REG_MS_ACAL_AVCERT   0x225

◆ ADE9153A_REG_MS_ACAL_BICC

#define ADE9153A_REG_MS_ACAL_BICC   0x222

◆ ADE9153A_REG_MS_ACAL_BICERT

#define ADE9153A_REG_MS_ACAL_BICERT   0x223

◆ ADE9153A_REG_MS_ACAL_CFG

#define ADE9153A_REG_MS_ACAL_CFG   0x030

◆ ADE9153A_REG_MS_AICC_USER

#define ADE9153A_REG_MS_AICC_USER   0x045

◆ ADE9153A_REG_MS_AVCC_USER

#define ADE9153A_REG_MS_AVCC_USER   0x047

◆ ADE9153A_REG_MS_BICC_USER

#define ADE9153A_REG_MS_BICC_USER   0x046

◆ ADE9153A_REG_MS_STATUS_CURRENT

#define ADE9153A_REG_MS_STATUS_CURRENT   0x240

◆ ADE9153A_REG_MS_STATUS_IRQ

#define ADE9153A_REG_MS_STATUS_IRQ   0x4C0

◆ ADE9153A_REG_NFVAR_ACC

#define ADE9153A_REG_NFVAR_ACC   0x3F7

◆ ADE9153A_REG_NWATT_ACC

#define ADE9153A_REG_NWATT_ACC   0x3EF

◆ ADE9153A_REG_OI_LVL

#define ADE9153A_REG_OI_LVL   0x409

◆ ADE9153A_REG_OIA

#define ADE9153A_REG_OIA   0x40A

◆ ADE9153A_REG_OIB

#define ADE9153A_REG_OIB   0x40B

◆ ADE9153A_REG_PFVAR_ACC

#define ADE9153A_REG_PFVAR_ACC   0x3F3

◆ ADE9153A_REG_PHNOLOAD

#define ADE9153A_REG_PHNOLOAD   0x41F

◆ ADE9153A_REG_PHSIGN

#define ADE9153A_REG_PHSIGN   0x49D

◆ ADE9153A_REG_PWATT_ACC

#define ADE9153A_REG_PWATT_ACC   0x3EB

◆ ADE9153A_REG_PWR_TIME

#define ADE9153A_REG_PWR_TIME   0x4B1

◆ ADE9153A_REG_REACT_NL_LVL

#define ADE9153A_REG_REACT_NL_LVL   0x41D

◆ ADE9153A_REG_RUN

#define ADE9153A_REG_RUN   0x480

◆ ADE9153A_REG_STATUS

#define ADE9153A_REG_STATUS   0x402

◆ ADE9153A_REG_SWELL_CYC

#define ADE9153A_REG_SWELL_CYC   0x48C

◆ ADE9153A_REG_SWELL_LVL

#define ADE9153A_REG_SWELL_LVL   0x414

◆ ADE9153A_REG_SWELLA

#define ADE9153A_REG_SWELLA   0x415

◆ ADE9153A_REG_TEMP_CFG

#define ADE9153A_REG_TEMP_CFG   0x4B6

◆ ADE9153A_REG_TEMP_RSLT

#define ADE9153A_REG_TEMP_RSLT   0x4B7

◆ ADE9153A_REG_TEMP_TRIM

#define ADE9153A_REG_TEMP_TRIM   0x471

◆ ADE9153A_REG_UART_BAUD_SWITCH

#define ADE9153A_REG_UART_BAUD_SWITCH   0x4DC

◆ ADE9153A_REG_USER_PERIOD

#define ADE9153A_REG_USER_PERIOD   0x40E

◆ ADE9153A_REG_VARTHR

#define ADE9153A_REG_VARTHR   0x421

◆ ADE9153A_REG_VATHR

#define ADE9153A_REG_VATHR   0x422

◆ ADE9153A_REG_VDIV_RSMALL

#define ADE9153A_REG_VDIV_RSMALL   0x04C

◆ ADE9153A_REG_VERSION

#define ADE9153A_REG_VERSION   0x4FE

◆ ADE9153A_REG_VERSION_DSP

#define ADE9153A_REG_VERSION_DSP   0x241

◆ ADE9153A_REG_VERSION_PRODUCT

#define ADE9153A_REG_VERSION_PRODUCT   0x242

◆ ADE9153A_REG_VLEVEL

#define ADE9153A_REG_VLEVEL   0x40F

◆ ADE9153A_REG_VNOM

#define ADE9153A_REG_VNOM   0x021

◆ ADE9153A_REG_VPEAK

#define ADE9153A_REG_VPEAK   0x401

◆ ADE9153A_REG_WR_LOCK

#define ADE9153A_REG_WR_LOCK   0x4BF

◆ ADE9153A_REG_WTHR

#define ADE9153A_REG_WTHR   0x420

◆ ADE9153A_REG_ZX_CFG

#define ADE9153A_REG_ZX_CFG   0x49A

◆ ADE9153A_REG_ZXTHRSH

#define ADE9153A_REG_ZXTHRSH   0x499

◆ ADE9153A_REG_ZXTOUT

#define ADE9153A_REG_ZXTOUT   0x498

◆ ADE9153A_RESET_DEL

#define ADE9153A_RESET_DEL   0x1F4

◆ ADE9153A_REVAPA_MSK

#define ADE9153A_REVAPA_MSK   NO_OS_BIT(0)

◆ ADE9153A_REVPCF1_MSK

#define ADE9153A_REVPCF1_MSK   NO_OS_BIT(4)

◆ ADE9153A_REVPCF2_MSK

#define ADE9153A_REVPCF2_MSK   NO_OS_BIT(5)

◆ ADE9153A_REVRPA_MSK

#define ADE9153A_REVRPA_MSK   NO_OS_BIT(2)

◆ ADE9153A_RMS_OC_RDY_MSK

#define ADE9153A_RMS_OC_RDY_MSK   NO_OS_BIT(11)

◆ ADE9153A_RMS_OC_SRC_MSK

#define ADE9153A_RMS_OC_SRC_MSK   NO_OS_BIT(4)

◆ ADE9153A_RSTDONE_MSK

#define ADE9153A_RSTDONE_MSK   NO_OS_BIT(16)

◆ ADE9153A_RUN

#define ADE9153A_RUN   0x0001

◆ ADE9153A_SELFREQ_MSK

#define ADE9153A_SELFREQ_MSK   NO_OS_BIT(4)

◆ ADE9153A_SPI_READ

#define ADE9153A_SPI_READ   NO_OS_BIT(3)

◆ ADE9153A_START_16ADDR

#define ADE9153A_START_16ADDR   0x473

◆ ADE9153A_STOP

#define ADE9153A_STOP   0x0000

◆ ADE9153A_SWELLA_MSK

#define ADE9153A_SWELLA_MSK   NO_OS_BIT(2)

◆ ADE9153A_SWELLA_VAL_MSK

#define ADE9153A_SWELLA_VAL_MSK   NO_OS_GENMASK(23, 0)

◆ ADE9153A_SWRST_MSK

#define ADE9153A_SWRST_MSK   NO_OS_BIT(0)

◆ ADE9153A_TEMP_EN_MSK

#define ADE9153A_TEMP_EN_MSK   NO_OS_BIT(2)

◆ ADE9153A_TEMP_GAIN_MSK

#define ADE9153A_TEMP_GAIN_MSK   NO_OS_GENMASK(15, 0)

◆ ADE9153A_TEMP_OFFSET_MSK

#define ADE9153A_TEMP_OFFSET_MSK   NO_OS_GENMASK(31, 16)

◆ ADE9153A_TEMP_RDY_MSK

#define ADE9153A_TEMP_RDY_MSK   NO_OS_BIT(12)

◆ ADE9153A_TEMP_RESULT_MSK

#define ADE9153A_TEMP_RESULT_MSK   NO_OS_GENMASK(11, 0)

◆ ADE9153A_TEMP_START_MSK

#define ADE9153A_TEMP_START_MSK   NO_OS_BIT(3)

◆ ADE9153A_TEMP_TIME_MSK

#define ADE9153A_TEMP_TIME_MSK   NO_OS_GENMASK(1, 0)

◆ ADE9153A_UART_ERROR0_MSK

#define ADE9153A_UART_ERROR0_MSK   NO_OS_BIT(4)

◆ ADE9153A_UART_ERROR1_MSK

#define ADE9153A_UART_ERROR1_MSK   NO_OS_BIT(5)

◆ ADE9153A_UART_ERROR2_MSK

#define ADE9153A_UART_ERROR2_MSK   NO_OS_BIT(6)

◆ ADE9153A_UART_RESET_MSK

#define ADE9153A_UART_RESET_MSK   NO_OS_BIT(7)

◆ ADE9153A_UNLOCK_KEY

#define ADE9153A_UNLOCK_KEY   0x4AD1

◆ ADE9153A_UPERIOD_SEL_MSK

#define ADE9153A_UPERIOD_SEL_MSK   NO_OS_BIT(12)

◆ ADE9153A_VANL_MSK

#define ADE9153A_VANL_MSK   NO_OS_BIT(14)

◆ ADE9153A_VARACC_MSK

#define ADE9153A_VARACC_MSK   NO_OS_GENMASK(3, 2)

◆ ADE9153A_VERSION

#define ADE9153A_VERSION   0x9153a

◆ ADE9153A_VLEVEL_VAL_MSK

#define ADE9153A_VLEVEL_VAL_MSK   NO_OS_GENMASK(23, 0)

◆ ADE9153A_VNOMA_EN_MSK

#define ADE9153A_VNOMA_EN_MSK   NO_OS_BIT(5)

◆ ADE9153A_VPEAKVAL_MSK

#define ADE9153A_VPEAKVAL_MSK   NO_OS_GENMASK(23, 0)

◆ ADE9153A_WATTACC_MSK

#define ADE9153A_WATTACC_MSK   NO_OS_GENMASK(1, 0)

◆ ADE9153A_WATTNL_MSK

#define ADE9153A_WATTNL_MSK   NO_OS_BIT(13)

◆ ADE9153A_ZX_OUT_OE_MSK

#define ADE9153A_ZX_OUT_OE_MSK   NO_OS_BIT(2)

◆ ADE9153A_ZX_SRC_SEL_MSK

#define ADE9153A_ZX_SRC_SEL_MSK   NO_OS_BIT(3)

◆ ADE9153A_ZXAI_MSK

#define ADE9153A_ZXAI_MSK   NO_OS_BIT(19)

◆ ADE9153A_ZXAV_MSK

#define ADE9153A_ZXAV_MSK   NO_OS_BIT(17)

◆ ADE9153A_ZXBI_MSK

#define ADE9153A_ZXBI_MSK   NO_OS_BIT(20)

◆ ADE9153A_ZXTOAV_MSK

#define ADE9153A_ZXTOAV_MSK   NO_OS_BIT(21)

◆ DISABLE

#define DISABLE   0u

◆ ENABLE

#define ENABLE   1u

Enumeration Type Documentation

◆ ade9153a_acal_ch_e

select channels for autocalibration

Enumerator
AUTOCAL_AV 
AUTOCAL_BI 
AUTOCAL_AI 

◆ ade9153a_acalmode_e

select power mode for ch B, ch A

Enumerator
NORMAL 
TURBO 

◆ ade9153a_accmode_e

ADE9153A varacc/watacc acc mode.

Enumerator
ADE9153A_SIGNED_ACC_MODE 
ADE9153A_ABSOLUTE_VAL_ACC_MODE 
ADE9153A_POSITIVE_ACC_MODE 
ADE9153A_NEGATIVE_ACC_MODE 

◆ ade9153a_ai_gain_e

ADE9153A PGA gain for current CH A.

Enumerator
ADE9153A_AI_GAIN_16 
ADE9153A_AI_GAIN_24 
ADE9153A_AI_GAIN_32 
ADE9153A_AI_GAIN_38_4 

◆ ade9153a_bi_gain_e

ADE9153A Bi Gain.

Enumerator
ADE9153A_PGA_CHB_GAIN_1 
ADE9153A_PGA_CHB_GAIN_2 
ADE9153A_PGA_CHB_GAIN_4 

◆ ade9153a_cf2sel_e

ADE9153A CF2SEL type of energy output at CF2 Pin.

Enumerator
ADE9153A_TOTAL_ACTIVE_POWER 
ADE9153A_TOTAL_APPARENT_POWER 
ADE9153A_TOTAL_FUNDAMENTAL_REACTIVE_POWER 

◆ ade9153a_chip_stat_err_e

ADE9153A chip status errors.

Enumerator
ADE9153A_ERROR0 
ADE9153A_ERROR1 
ADE9153A_ERROR2 
ADE9153A_ERROR3 
ADE9153A_UART_ERROR0 
ADE9153A_UART_ERROR1 
ADE9153A_UART_ERROR2 
ADE9153A_UART_RESET 

◆ ade9153a_hpf_crn_e

ADE9153A Hpf crn high pass filter corner freq.

Enumerator
ADE9153A_HPF_CORNER_38_695_HZ 
ADE9153A_HPF_CORNER_19_6375_HZ 
ADE9153A_HPF_CORNER_9_895_HZ 
ADE9153A_HPF_CORNER_4_9675_HZ 
ADE9153A_HPF_CORNER_2_49_HZ 
ADE9153A_HPF_CORNER_1_2475_HZ 
ADE9153A_HPF_CORNER_0_625_HZ 
ADE9153A_HPF_CORNER_0_3125_HZ 

◆ ade9153a_noload_tmr_e

ADE9153A Hpf no load tmr.

Enumerator
ADE9153A_NOLOAD_TMR_SAMPLES_64 
ADE9153A_NOLOAD_TMR_SAMPLES_128 
ADE9153A_NOLOAD_TMR_SAMPLES_256 
ADE9153A_NOLOAD_TMR_SAMPLES_512 
ADE9153A_NOLOAD_TMR_SAMPLES_1024 
ADE9153A_NOLOAD_TMR_SAMPLES_2048 
ADE9153A_NOLOAD_TMR_SAMPLES_4096 
ADE9153A_NOLOAD_TMR_DISABLE 

◆ ade9153a_peak_sel_e

ADE9153A Peak sel.

Enumerator
ADE9153A_PEAK_DETECTION_DISABLE_PHA_PHB 
ADE9153A_PEAK_DETECTION_ENABLE_V_I_PHA 
ADE9153A_PEAK_DETECTION_ENABLE_I_PHB 
ADE9153A_PEAK_DETECTION_ENABLE_V_I_PHA_PHB 

◆ ade9153a_phnoload_e

Type of energy that is in no load condition.

Enumerator
AFVARNL 
AVANL 
AWATTNL 

◆ ade9153a_pwr_settle_e

ADE9153A Power settle.

Enumerator
ADE9153A_SETTLE_64_MS 
ADE9153A_SETTLE_128_MS 
ADE9153A_SETTLE_256_MS 
ADE9153A_SETTLE_0_MS 

◆ ade9153a_selfreq_e

select frequency

Enumerator
F_50_HZ 
F_60_HZ 

◆ ade9153a_temp_time_e

ADE9153A Temperature readings.

Enumerator
ADE9153A_TEMP_TIME_SAMPLES_1 
ADE9153A_TEMP_TIME_SAMPLES_256 
ADE9153A_TEMP_TIME_SAMPLES_512 
ADE9153A_TEMP_TIME_SAMPLES_1024 

◆ dip_swell_irq_mode_en

Dip swell irq mode.

Enumerator
CONTINUOUSE 
ONE_INT 

Function Documentation

◆ ade9153a_ai_gain()

int ade9153a_ai_gain ( struct ade9153a_dev * dev,
enum ade9153a_ai_gain_e gain )

Set the PGA gain for I chA.

Parameters
dev- The device structure.
gain- Gain value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ai_swap()

int ade9153a_ai_swap ( struct ade9153a_dev * dev,
uint8_t set )

Set the signal side of the PGA.

Parameters
dev- The device structure.
set- 0 - signal on IAN 1 - signal on IAP
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_auto_calibration_cfg()

int ade9153a_auto_calibration_cfg ( struct ade9153a_dev * dev,
enum ade9153a_acal_ch_e ch,
enum ade9153a_acalmode_e mode )

Auto calibration config.

Parameters
dev- The device structure.
ch- channel enabled for autocalibration
mode- current channel mode
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_auto_calibration_run()

int ade9153a_auto_calibration_run ( struct ade9153a_dev * dev)

Auto calibration run.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_auto_calibration_stop()

int ade9153a_auto_calibration_stop ( struct ade9153a_dev * dev)

Auto calibration stop.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_avarsign_status()

int ade9153a_avarsign_status ( struct ade9153a_dev * dev,
uint8_t * status )

Sign of reactive power.

Parameters
dev- The device structure.
status- status indicator 0 - positive 1 - negative
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_awsign_status()

int ade9153a_awsign_status ( struct ade9153a_dev * dev,
uint8_t * status )

Sign of active power.

Parameters
dev- The device structure.
status- status indicator 0 - positive 1 - negative
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_bi_pgagain_set()

int ade9153a_bi_pgagain_set ( struct ade9153a_dev * dev,
enum ade9153a_bi_gain_e gain )

Set PGA gain for current channel B.

Parameters
dev- The device structure.
gain- value of the PGA gain
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_burst_en()

int ade9153a_burst_en ( struct ade9153a_dev * dev)

Burst read enable/disable.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf1_lt_status()

int ade9153a_cf1_lt_status ( struct ade9153a_dev * dev,
uint8_t * status )

CF1_LT status.

Parameters
dev- The device structure.
status- status indicator
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf1dis()

int ade9153a_cf1dis ( struct ade9153a_dev * dev)

CF1 output disable.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf1sel()

int ade9153a_cf1sel ( struct ade9153a_dev * dev,
enum ade9153a_cf2sel_e energy_type )

Set type of energy output on CF1 pin.

Parameters
dev- The device structure.
energy_type- type of energy output
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf1sign_status()

int ade9153a_cf1sign_status ( struct ade9153a_dev * dev,
uint8_t * status )

Sign of CF1 power.

Parameters
dev- The device structure.
status- status indicator 0 - positive 1 - negative
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf2_lt_status()

int ade9153a_cf2_lt_status ( struct ade9153a_dev * dev,
uint8_t * status )

CF2_LT status.

Parameters
dev- The device structure.
status- status indicator
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf2dis()

int ade9153a_cf2dis ( struct ade9153a_dev * dev)

CF2 output disable.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf2sel()

int ade9153a_cf2sel ( struct ade9153a_dev * dev,
enum ade9153a_cf2sel_e energy_type )

Set type of energy output on CF2 pin.

Parameters
dev- The device structure.
energy_type- type of energy output
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf2sign_status()

int ade9153a_cf2sign_status ( struct ade9153a_dev * dev,
uint8_t * status )

Sign of CF2 power.

Parameters
dev- The device structure.
status- status indicator 0 - positive 1 - negative
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf_acc_clr()

int ade9153a_cf_acc_clr ( struct ade9153a_dev * dev)

Clear accumulation in the digital freq conv.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf_ltmr_val()

int ade9153a_cf_ltmr_val ( struct ade9153a_dev * dev,
uint32_t * val )

cf_ltmr read value.

Parameters
dev- The device structure.
val- cf_ltmr value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_cf_ltmr_write()

int ade9153a_cf_ltmr_write ( struct ade9153a_dev * dev,
uint32_t reg_data )

cf_ltmr write value.

Parameters
dev- The device structure.
reg_data- Value to write.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_chip_status()

int ade9153a_chip_status ( struct ade9153a_dev * dev,
uint8_t * status )

Chip status.

Parameters
dev- The device structure.
status- Status code
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_apa_chg_sgn()

int ade9153a_clear_apa_chg_sgn ( struct ade9153a_dev * dev)

Clear APA (active power) sign change int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_cf1()

int ade9153a_clear_cf1 ( struct ade9153a_dev * dev)

Clear CF1 pulse issued int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_cf1_chg()

int ade9153a_clear_cf1_chg ( struct ade9153a_dev * dev)

Clear CF1 polarity change int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_cf2()

int ade9153a_clear_cf2 ( struct ade9153a_dev * dev)

Clear CF2 pulse issued int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_cf2_chg()

int ade9153a_clear_cf2_chg ( struct ade9153a_dev * dev)

Clear CF2 polarity change int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_chip_stat()

int ade9153a_clear_chip_stat ( struct ade9153a_dev * dev,
uint32_t * reg_val )

Clear chip status int.

Parameters
dev- The device structure.
reg_val- register value.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_crc_chg()

int ade9153a_clear_crc_chg ( struct ade9153a_dev * dev)

Clear CRC change int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_crc_done()

int ade9153a_clear_crc_done ( struct ade9153a_dev * dev)

Clear CRC done int mask.

Parameters
dev- The device structure..
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_dready()

int ade9153a_clear_dready ( struct ade9153a_dev * dev)

Clear new waveform samples ready int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_egyrdy()

int ade9153a_clear_egyrdy ( struct ade9153a_dev * dev)

Clear power values egy ready int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_event_stat()

int ade9153a_clear_event_stat ( struct ade9153a_dev * dev,
uint32_t * reg_val )

Clear event status int.

Parameters
dev- The device structure.
reg_val- register value.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_fvarnl()

int ade9153a_clear_fvarnl ( struct ade9153a_dev * dev)

Clear fundamental reactive energy no load condition int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_ms_stat()

int ade9153a_clear_ms_stat ( struct ade9153a_dev * dev,
uint32_t * reg_val )

Clear MS status int.

Parameters
dev- The device structure.
reg_val- register value.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_pf_rdy()

int ade9153a_clear_pf_rdy ( struct ade9153a_dev * dev)

Clear PF ready int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_pwrrdy()

int ade9153a_clear_pwrrdy ( struct ade9153a_dev * dev)

Clear power values registers update int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_rms_oc_rdy()

int ade9153a_clear_rms_oc_rdy ( struct ade9153a_dev * dev)

Clear RMS_OC values update int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_rpa_chg_sgn()

int ade9153a_clear_rpa_chg_sgn ( struct ade9153a_dev * dev)

Clear RPA (reactive power) sign change int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_rstdone()

int ade9153a_clear_rstdone ( struct ade9153a_dev * dev)

Clear reset done int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_temp_rdy()

int ade9153a_clear_temp_rdy ( struct ade9153a_dev * dev)

Clear new temperature reading ready int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_vanl()

int ade9153a_clear_vanl ( struct ade9153a_dev * dev)

Clear total apparent energy no load condition int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_wattnl()

int ade9153a_clear_wattnl ( struct ade9153a_dev * dev)

Clear total active energy no load condition int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_zxai()

int ade9153a_clear_zxai ( struct ade9153a_dev * dev)

Clear zero crossing detect on I ch A int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_zxav()

int ade9153a_clear_zxav ( struct ade9153a_dev * dev)

Clear zero crossing detect on V ch int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_zxbi()

int ade9153a_clear_zxbi ( struct ade9153a_dev * dev)

Clear zero crossing detect on I ch B int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_clear_zxtoav()

int ade9153a_clear_zxtoav ( struct ade9153a_dev * dev)

Clear zero crossing timout on V ch int mask.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_compmode()

int ade9153a_compmode ( struct ade9153a_dev * dev)

COMPMODE.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_control_interrupt()

int ade9153a_control_interrupt ( struct ade9153a_dev * dev,
uint16_t reg_addr,
uint32_t int_msk,
uint8_t en )

Enable/disable interrupt.

Parameters
dev- The device structure.
reg_addr- MASK register address.
int_msk- Interrupt mask.
en- Enable/Disable.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_dip_swell_irq_mode()

int ade9153a_dip_swell_irq_mode ( struct ade9153a_dev * dev,
enum dip_swell_irq_mode_en mode )

Dip swell interrupt mode.

Parameters
dev- The device structure.
mode- IRQ mode
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_dipa_val()

int ade9153a_dipa_val ( struct ade9153a_dev * dev,
uint32_t * val )

Voltage value during dip condition.

Parameters
dev- The device structure.
val- dipa value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_cf1_int()

int ade9153a_disable_cf1_int ( struct ade9153a_dev * dev)

Disable CF1 interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_cf2_int()

int ade9153a_disable_cf2_int ( struct ade9153a_dev * dev)

Disable CF2 interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_chip_stat_int()

int ade9153a_disable_chip_stat_int ( struct ade9153a_dev * dev)

Disable CHIP_STAT interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_crc_chg_int()

int ade9153a_disable_crc_chg_int ( struct ade9153a_dev * dev)

Disable crc change interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_crc_done_int()

int ade9153a_disable_crc_done_int ( struct ade9153a_dev * dev)

Disable crc done interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_dready_int()

int ade9153a_disable_dready_int ( struct ade9153a_dev * dev)

Disable data ready interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_egyrdy_int()

int ade9153a_disable_egyrdy_int ( struct ade9153a_dev * dev)

Disable EGYRDY interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_event_stat_int()

int ade9153a_disable_event_stat_int ( struct ade9153a_dev * dev)

Disable EVENT_STAT interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_fvarnl_int()

int ade9153a_disable_fvarnl_int ( struct ade9153a_dev * dev)

Disable fundamental reactive energy no load condition interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_ms_stat_int()

int ade9153a_disable_ms_stat_int ( struct ade9153a_dev * dev)

Disable MS_STAT interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_pf_rdy_int()

int ade9153a_disable_pf_rdy_int ( struct ade9153a_dev * dev)

Disable pf ready interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_pwrrdy_int()

int ade9153a_disable_pwrrdy_int ( struct ade9153a_dev * dev)

Disable PWRRDY interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_revapa_int()

int ade9153a_disable_revapa_int ( struct ade9153a_dev * dev)

Disable Phase A total active power changed sign interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_revpcf1_int()

int ade9153a_disable_revpcf1_int ( struct ade9153a_dev * dev)

Disable CF1 polarity change sign interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_revpcf2_int()

int ade9153a_disable_revpcf2_int ( struct ade9153a_dev * dev)

Disable CF2 polarity change sign interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_revrpa_int()

int ade9153a_disable_revrpa_int ( struct ade9153a_dev * dev)

Disable Phase A fundamental reactive power changed sign interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_rms_oc_rdy_int()

int ade9153a_disable_rms_oc_rdy_int ( struct ade9153a_dev * dev)

Disable RMS_OC values update interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_temp_rdy_int()

int ade9153a_disable_temp_rdy_int ( struct ade9153a_dev * dev)

Disable new temperature reading interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_vanl_int()

int ade9153a_disable_vanl_int ( struct ade9153a_dev * dev)

Disable total apparent energy no load condition interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_wattnl_int()

int ade9153a_disable_wattnl_int ( struct ade9153a_dev * dev)

Disable total active energy no load condition interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_zxai_int()

int ade9153a_disable_zxai_int ( struct ade9153a_dev * dev)

Disable zero corssing detected on I ch A interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_zxav_int()

int ade9153a_disable_zxav_int ( struct ade9153a_dev * dev)

Disable zero corssing detected on V ch interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_zxbi_int()

int ade9153a_disable_zxbi_int ( struct ade9153a_dev * dev)

Disable zero corssing detected on I ch B interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_disable_zxtoav_int()

int ade9153a_disable_zxtoav_int ( struct ade9153a_dev * dev)

Disable zero corssing timeout on voltage ch interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_diszxlpf()

int ade9153a_diszxlpf ( struct ade9153a_dev * dev)

Zero crossing lpf disable.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_dready_oe()

int ade9153a_dready_oe ( struct ade9153a_dev * dev)

DREADY driven to CF2 pin.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_egy_ld_accum()

int ade9153a_egy_ld_accum ( struct ade9153a_dev * dev,
uint8_t en )

Internal energy register accum.

Parameters
dev- The device structure.
en- 0 - internal energy register added to the user accessible energy register. 1 - internal energy register overwrites the user accessible energy register.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_egy_pwr_en()

int ade9153a_egy_pwr_en ( struct ade9153a_dev * dev)

Enable the energy and power accumulator when the run bit is also set.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_egy_tmr_mode()

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.

Parameters
dev- The device structure.
en- 0 - Accumulate energy based on 4 kSPS samples. 1 - Accumulate energy based on the zero-crossing events
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_cf1_int()

int ade9153a_enable_cf1_int ( struct ade9153a_dev * dev)

Enable CF1 interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_cf2_int()

int ade9153a_enable_cf2_int ( struct ade9153a_dev * dev)

Enable CF2 interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_chip_stat_int()

int ade9153a_enable_chip_stat_int ( struct ade9153a_dev * dev)

Enable an interrupt when any bit in CHIP_STATUS reg is set.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_crc_chg_int()

int ade9153a_enable_crc_chg_int ( struct ade9153a_dev * dev)

Enable crc change interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_crc_done_int()

int ade9153a_enable_crc_done_int ( struct ade9153a_dev * dev)

Enable crc done interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_dready_int()

int ade9153a_enable_dready_int ( struct ade9153a_dev * dev)

Enable data ready interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_egyrdy_int()

int ade9153a_enable_egyrdy_int ( struct ade9153a_dev * dev)

Enable EGYRDY interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_event_stat_int()

int ade9153a_enable_event_stat_int ( struct ade9153a_dev * dev)

Enable an interrupt when any bit in EVENT_STATUS reg is set.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_fvarnl_int()

int ade9153a_enable_fvarnl_int ( struct ade9153a_dev * dev)

Enable fundamental reactive energy no load condition interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_ms_stat_int()

int ade9153a_enable_ms_stat_int ( struct ade9153a_dev * dev)

Enable an interrupt when any bit in MS_STATUS_IRQ reg is set.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_pf_rdy_int()

int ade9153a_enable_pf_rdy_int ( struct ade9153a_dev * dev)

Enable pf ready interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_pwrrdy_int()

int ade9153a_enable_pwrrdy_int ( struct ade9153a_dev * dev)

Enable PWRRDY interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_revapa_int()

int ade9153a_enable_revapa_int ( struct ade9153a_dev * dev)

Enable Phase A total active power changed sign interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_revpcf1_int()

int ade9153a_enable_revpcf1_int ( struct ade9153a_dev * dev)

Enable CF1 polarity change sign interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_revpcf2_int()

int ade9153a_enable_revpcf2_int ( struct ade9153a_dev * dev)

Enable CF2 polarity change sign interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_revrpa_int()

int ade9153a_enable_revrpa_int ( struct ade9153a_dev * dev)

Enable Phase A fundamental reactive power changed sign interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_rms_oc_rdy_int()

int ade9153a_enable_rms_oc_rdy_int ( struct ade9153a_dev * dev)

Enable RMS_OC values update interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_temp_rdy_int()

int ade9153a_enable_temp_rdy_int ( struct ade9153a_dev * dev)

Enable new temperature reading interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_vanl_int()

int ade9153a_enable_vanl_int ( struct ade9153a_dev * dev)

Enable total apparent energy no load condition interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_wattnl_int()

int ade9153a_enable_wattnl_int ( struct ade9153a_dev * dev)

Enable total active energy no load condition interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_zxai_int()

int ade9153a_enable_zxai_int ( struct ade9153a_dev * dev)

Enable zero corssing detected on I ch A interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_zxav_int()

int ade9153a_enable_zxav_int ( struct ade9153a_dev * dev)

Enable zero corssing detected on V ch interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_zxbi_int()

int ade9153a_enable_zxbi_int ( struct ade9153a_dev * dev)

Enable zero corssing detected on I ch B interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_enable_zxtoav_int()

int ade9153a_enable_zxtoav_int ( struct ade9153a_dev * dev)

Enable zero corssing timeout on voltage ch interrupt.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_energy_vals()

int ade9153a_energy_vals ( struct ade9153a_dev * dev,
struct ade9153a_energy_values * data )

Read energy values.

Parameters
dev- The device structure.
data- Structure to store energy values
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ext_ref()

int ade9153a_ext_ref ( struct ade9153a_dev * dev,
uint8_t en )

External voltage reference enable/disable.

Parameters
dev- The device structure.
en- enable / disable val.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ext_ref_status()

int ade9153a_ext_ref_status ( struct ade9153a_dev * dev,
uint8_t * status )

External_reference status.

Parameters
dev- The device structure.
status- status indicator
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_force_crc_update()

int ade9153a_force_crc_update ( struct ade9153a_dev * dev)

Force CRC calculation to start (update).

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_freq_s_status()

int ade9153a_freq_s_status ( struct ade9153a_dev * dev,
uint8_t * status )

Frequency setting.

Parameters
dev- The device structure.
status- status 0 - 50Hz 1 - 60Hz
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_apa_chg_sgn()

int ade9153a_get_apa_chg_sgn ( struct ade9153a_dev * dev,
uint8_t * status )

Get APA (active power) sign change indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_cf1()

int ade9153a_get_cf1 ( struct ade9153a_dev * dev,
uint8_t * status )

Get CF1 pulse issued indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_cf1_chg()

int ade9153a_get_cf1_chg ( struct ade9153a_dev * dev,
uint8_t * status )

Get CF1 polarity change indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_cf2()

int ade9153a_get_cf2 ( struct ade9153a_dev * dev,
uint8_t * status )

Get CF2 pulse issued indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_cf2_chg()

int ade9153a_get_cf2_chg ( struct ade9153a_dev * dev,
uint8_t * status )

Get CF2 polarity change indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_chip_stat()

int ade9153a_get_chip_stat ( struct ade9153a_dev * dev,
uint8_t * status )

Get chip status indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_crc_chg()

int ade9153a_get_crc_chg ( struct ade9153a_dev * dev,
uint8_t * status )

Get CRC change indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_crc_done()

int ade9153a_get_crc_done ( struct ade9153a_dev * dev,
uint8_t * status )

Get CRC done indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_dready()

int ade9153a_get_dready ( struct ade9153a_dev * dev,
uint8_t * status )

Get new waveform samples ready indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_egyrdy()

int ade9153a_get_egyrdy ( struct ade9153a_dev * dev,
uint8_t * status )

Get power values egy ready indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_event_stat()

int ade9153a_get_event_stat ( struct ade9153a_dev * dev,
uint8_t * status )

Get event status indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_fvarnl()

int ade9153a_get_fvarnl ( struct ade9153a_dev * dev,
uint8_t * status )

Get fundamental reactive energy no load condition indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_int_status()

int ade9153a_get_int_status ( struct ade9153a_dev * dev,
uint32_t msk,
uint8_t * status )

Get interrupt indicator from STATUS register.

Parameters
dev- The device structure.
msk- Interrupt mask.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_ms_stat()

int ade9153a_get_ms_stat ( struct ade9153a_dev * dev,
uint8_t * status )

Get MS status indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_pf_rdy()

int ade9153a_get_pf_rdy ( struct ade9153a_dev * dev,
uint8_t * status )

Get PF ready indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_phnoload_status()

int ade9153a_get_phnoload_status ( struct ade9153a_dev * dev,
uint8_t * status )

Get phnoload status.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_pwrrdy()

int ade9153a_get_pwrrdy ( struct ade9153a_dev * dev,
uint8_t * status )

Get power values registers update indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_rms_oc_rdy()

int ade9153a_get_rms_oc_rdy ( struct ade9153a_dev * dev,
uint8_t * status )

Get RMS_OC values update indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_rpa_chg_sgn()

int ade9153a_get_rpa_chg_sgn ( struct ade9153a_dev * dev,
uint8_t * status )

Get RPA (reactive power) sign change indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_rstdone()

int ade9153a_get_rstdone ( struct ade9153a_dev * dev,
uint8_t * status )

Get reset done indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_temp_rdy()

int ade9153a_get_temp_rdy ( struct ade9153a_dev * dev,
uint8_t * status )

Get new temperature reading ready indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_vanl()

int ade9153a_get_vanl ( struct ade9153a_dev * dev,
uint8_t * status )

Get total apparent energy no load condition indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_wattnl()

int ade9153a_get_wattnl ( struct ade9153a_dev * dev,
uint8_t * status )

Get total active energy no load condition indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_zxai()

int ade9153a_get_zxai ( struct ade9153a_dev * dev,
uint8_t * status )

Get zero crossing detect on I ch A indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_zxav()

int ade9153a_get_zxav ( struct ade9153a_dev * dev,
uint8_t * status )

Get zero crossing detect on V ch indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_zxbi()

int ade9153a_get_zxbi ( struct ade9153a_dev * dev,
uint8_t * status )

Get zero crossing detect on I ch B indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_get_zxtoav()

int ade9153a_get_zxtoav ( struct ade9153a_dev * dev,
uint8_t * status )

Get zero crossing timout on V ch indicator.

Parameters
dev- The device structure.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_half_rms_vals()

int ade9153a_half_rms_vals ( struct ade9153a_dev * dev,
struct ade9153a_half_rms_values * data )

Read half rms values.

Parameters
dev- The device structure.
data- Structure to store half rms values
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_hpf_crn()

int ade9153a_hpf_crn ( struct ade9153a_dev * dev,
enum ade9153a_hpf_crn_e hpf_corner_freq )

Hpf corner freq.

Parameters
dev- The device structure.
hpf_corner_freq- the corner freq for hpf
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_hpf_disable()

int ade9153a_hpf_disable ( struct ade9153a_dev * dev)

Disable hpf for all channels.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_hw_reset()

int ade9153a_hw_reset ( struct ade9153a_dev * dev)

Reset the device using HW reset.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_i_ch_b_int_enable()

int ade9153a_i_ch_b_int_enable ( struct ade9153a_dev * dev)

Current channel B integrator enable.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_init()

int ade9153a_init ( struct ade9153a_dev ** device,
struct ade9153a_init_param init_param )

Initialize the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ip_phase()

int ade9153a_ip_phase ( struct ade9153a_dev * dev,
uint8_t * ch )

Ipeak channel phase.

Parameters
dev- The device structure.
ch- stores the ch that generates the IPEAKVAL 1 - for ch A, 2 - for ch B, 0 - none
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ipk_val()

int ade9153a_ipk_val ( struct ade9153a_dev * dev,
uint32_t * val )

Ipeak val.

Parameters
dev- The device structure.
val- Ipeak val (xI_WAV/2^5)
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_lpf_ap_disable()

int ade9153a_lpf_ap_disable ( struct ade9153a_dev * dev)

Disable the low-pass filter in the total active power datapath.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_lpf_rp_disable()

int ade9153a_lpf_rp_disable ( struct ade9153a_dev * dev)

Disable the low pass filter in the fundamental reactive power datapath.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ms_absent()

int ade9153a_ms_absent ( struct ade9153a_dev * dev,
uint8_t * status )

mSure not detected on the last enabled ch

Parameters
dev- The device structure.
status- status indicator 1 - mSure not detected
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ms_conferr()

int ade9153a_ms_conferr ( struct ade9153a_dev * dev,
uint8_t * status )

Invalid config of mSure status.

Parameters
dev- The device structure.
status- status indicator 1 - config error
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ms_ready()

int ade9153a_ms_ready ( struct ade9153a_dev * dev,
uint8_t * status )

mSure ready

Parameters
dev- The device structure.
status- status indicator 1 - ready
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ms_shift()

int ade9153a_ms_shift ( struct ade9153a_dev * dev,
uint8_t * status )

mSure shift detected in CC val

Parameters
dev- The device structure.
status- status indicator 1 - shift detected (must run mSure again)
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ms_sysrdy()

int ade9153a_ms_sysrdy ( struct ade9153a_dev * dev,
uint8_t * status )

New run of mSure ready.

Parameters
dev- The device structure.
status- status indicator 1 - ready
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_ms_timeout()

int ade9153a_ms_timeout ( struct ade9153a_dev * dev,
uint8_t * status )

mSure timed out (600s)

Parameters
dev- The device structure.
status- status indicator 1 - time out
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_msure_status()

int ade9153a_msure_status ( struct ade9153a_dev * dev,
uint8_t * status )

mSure status

Parameters
dev- The device structure.
status- stores the mSure status 0 - not ready run 1 - ready to run
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_noload_tmr()

int ade9153a_noload_tmr ( struct ade9153a_dev * dev,
enum ade9153a_noload_tmr_e noload_samples )

Set no. of samples for no load condition.

Parameters
dev- The device structure.
noload_samples- no. of samples
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_oi_lvl_val()

int ade9153a_oi_lvl_val ( struct ade9153a_dev * dev,
uint32_t * val )

Overcurrent detection threshold level val.

Parameters
dev- The device structure.
val- OI_LVL value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_oia_en()

int ade9153a_oia_en ( struct ade9153a_dev * dev)

Ch A overcurretn detection enable.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_oia_val()

int ade9153a_oia_val ( struct ade9153a_dev * dev,
uint32_t * val )

Ch A overcurrent val.

Parameters
dev- The device structure.
val- ch A overcurrent value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_oib_en()

int ade9153a_oib_en ( struct ade9153a_dev * dev)

Ch B overcurretn detection enable.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_oib_val()

int ade9153a_oib_val ( struct ade9153a_dev * dev,
uint32_t * val )

Ch B overcurrent val.

Parameters
dev- The device structure.
val- ch B overcurrent value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_peak_sel()

int ade9153a_peak_sel ( struct ade9153a_dev * dev,
enum ade9153a_peak_sel_e peak_sel )

Select peak detection channels.

Parameters
dev- The device structure.
peak_sel- Channel selection for peak detection
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_power_quality_vals()

int ade9153a_power_quality_vals ( struct ade9153a_dev * dev,
struct ade9153a_pq_values * data )

Read power quaility values.

Parameters
dev- The device structure.
data- Structure to store power quality values
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_power_vals()

int ade9153a_power_vals ( struct ade9153a_dev * dev,
struct ade9153a_power_values * data )

Read power values.

Parameters
dev- The device structure.
data- Structure to store power values
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_pwr_settle_set()

int ade9153a_pwr_settle_set ( struct ade9153a_dev * dev,
enum ade9153a_pwr_settle_e time )

Set PWR_SETTLE.

Parameters
dev- The device structure.
time- The time values
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_rd_rst_en()

int ade9153a_rd_rst_en ( struct ade9153a_dev * dev)

Energy register read with value reset.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_read()

int ade9153a_read ( struct ade9153a_dev * dev,
uint16_t reg_addr,
uint32_t * reg_data )

Read device register.

Parameters
dev- The device structure.
reg_addr- The register address.
reg_data- The data read from 32bit register.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_read_autocal_vals()

int ade9153a_read_autocal_vals ( struct ade9153a_dev * dev,
struct ade9153a_autocal_vals * data )

Read autocalibration values.

Parameters
dev- The device structure.
data- Structure to store autocalibration values
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_remove()

int ade9153a_remove ( struct ade9153a_dev * dev)

Remove the device and release resources.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_rms_oc_src_adc_samples_enable()

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.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_rms_oc_src_x_wav_enable()

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.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_rms_vals()

int ade9153a_rms_vals ( struct ade9153a_dev * dev,
struct ade9153a_rms_values * data )

Read rms values.

Parameters
dev- The device structure.
data- Structure to store rms values
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_run()

int ade9153a_run ( struct ade9153a_dev * dev)

Start measurements.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_selfreq()

int ade9153a_selfreq ( struct ade9153a_dev * dev,
enum ade9153a_selfreq_e freq )

Frequency select.

Parameters
dev- The device structure.
freq- 0 - 50 Hz, 1 - 60 Hz
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_set_interface_serial()

int ade9153a_set_interface_serial ( struct ade9153a_dev * dev)

Select comms interface Serial.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_set_interface_spi()

int ade9153a_set_interface_spi ( struct ade9153a_dev * dev)

Select comms interface SPI.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_setup()

int ade9153a_setup ( void * dev,
struct ade9153a_init_param init_param )

ADE9153A setup.

Parameters
dev- The device structure.
init_param- The structure that contains the device initial parameters.

◆ ade9153a_start_autocal_ai()

int ade9153a_start_autocal_ai ( struct ade9153a_dev * dev,
enum ade9153a_acalmode_e mode )

Start autocalibration AI channel.

Parameters
dev- The device structure.
mode- normal or turbo
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_start_autocal_av()

int ade9153a_start_autocal_av ( struct ade9153a_dev * dev,
enum ade9153a_acalmode_e mode )

Start autocalibration AV channel.

Parameters
dev- The device structure.
mode- normal or turbo
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_start_autocal_bi()

int ade9153a_start_autocal_bi ( struct ade9153a_dev * dev,
enum ade9153a_acalmode_e mode )

Start autocalibration BI channel.

Parameters
dev- The device structure.
mode- normal or turbo
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_stop()

int ade9153a_stop ( struct ade9153a_dev * dev)

Stop measurements.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_sw_reset()

int ade9153a_sw_reset ( struct ade9153a_dev * dev)

Reset the device using SW reset.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_swella_val()

int ade9153a_swella_val ( struct ade9153a_dev * dev,
uint32_t * val )

Voltage value during swell condition.

Parameters
dev- The device structure.
val- swella value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_temp_en()

int ade9153a_temp_en ( struct ade9153a_dev * dev)

Enable the temperature sensor.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_temp_gain_val()

int ade9153a_temp_gain_val ( struct ade9153a_dev * dev,
uint32_t * val )

temperature sensor gain.

Parameters
dev- The device structure.
val- sensor gain value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_temp_offset_val()

int ade9153a_temp_offset_val ( struct ade9153a_dev * dev,
uint32_t * val )

temperature sensor offset.

Parameters
dev- The device structure.
val- sensor offset value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_temp_result()

int ade9153a_temp_result ( struct ade9153a_dev * dev,
uint16_t * val )

Temperature result.

Parameters
dev- The device structure.
val- temp val
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_temp_start()

int ade9153a_temp_start ( struct ade9153a_dev * dev)

Manually request a new temperature sensor reading.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_temp_time()

int ade9153a_temp_time ( struct ade9153a_dev * dev,
enum ade9153a_temp_time_e temp_no_samples )

Select the number of temperature readings to average.

Parameters
dev- The device structure.
temp_no_samples- no. of samples
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_temp_val()

int ade9153a_temp_val ( struct ade9153a_dev * dev,
struct ade9153a_temperature_value * data )

Temperature value in deg C.

Parameters
dev- The device structure.
data- Structure to store temperature values
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_uperiod_sel()

int ade9153a_uperiod_sel ( struct ade9153a_dev * dev,
uint8_t en )

User period select.

Parameters
dev- The device structure.
en- 0 -voltage line period 1 - user configured line period
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_varacc()

int ade9153a_varacc ( struct ade9153a_dev * dev,
enum ade9153a_accmode_e varacc_type )

Select fundamental reactive power accumulation mode.

Parameters
dev- The device structure.
varacc_type- type of energy output
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_version_product()

int ade9153a_version_product ( struct ade9153a_dev * dev,
uint32_t * data_read )

Version product.

Parameters
dev- The device structure.
data_read- The version product read value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_vlevel_val()

int ade9153a_vlevel_val ( struct ade9153a_dev * dev,
uint32_t * val )

Vlevel val.

Parameters
dev- The device structure.
val- Vlevel value
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_vnoma_enable()

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.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_vpk_val()

int ade9153a_vpk_val ( struct ade9153a_dev * dev,
uint32_t * val )

Vpeak val.

Parameters
dev- The device structure.
val- Vpeak val (AV_WAV/2^5)
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_wattacc()

int ade9153a_wattacc ( struct ade9153a_dev * dev,
enum ade9153a_accmode_e wattacc_type )

Select Total active power accumulation mode.

Parameters
dev- The device structure.
wattacc_type- type of energy output
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_wr_lock()

int ade9153a_wr_lock ( struct ade9153a_dev * dev)

Lock device.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_wr_unlock()

int ade9153a_wr_unlock ( struct ade9153a_dev * dev)

Unlock device.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_write()

int ade9153a_write ( struct ade9153a_dev * dev,
uint16_t reg_addr,
uint32_t reg_data )

Write device register.

Parameters
dev-The device structure.
reg_addr- The register address.
reg_data- The data to be written.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_zx_out_oe()

int ade9153a_zx_out_oe ( struct ade9153a_dev * dev)

ZX driven to CF2 pin.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_zx_src_after_hpf_enable()

int ade9153a_zx_src_after_hpf_enable ( struct ade9153a_dev * dev)

ZX data source after hpf and phase compensation.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ade9153a_zx_src_before_hpf_enable()

int ade9153a_zx_src_before_hpf_enable ( struct ade9153a_dev * dev)

ZX data source before hpf and phase compensation.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.