no-OS
Classes | Macros | Enumerations | Functions
ade7880.h File Reference

Header file of ADE7880 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_print_log.h"
Include dependency graph for ade7880.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ade7880_init_param
 ADE7880 Device initialization parameters. More...
 
struct  ade7880_dev
 ADE7880 Device structure. More...
 

Macros

#define ADE7880_SPI_READ_CMD   0x01
 
#define ADE7880_SPI_WRITE_CMD   0x00
 
#define ENABLE   0x0001
 
#define DISABLE   0x0000
 
#define ADE7880_REG_AIGAIN   0x4380
 
#define ADE7880_REG_AVGAIN   0x4381
 
#define ADE7880_REG_BIGAIN   0x4382
 
#define ADE7880_REG_BVGAIN   0x4383
 
#define ADE7880_REG_CIGAIN   0x4384
 
#define ADE7880_REG_CVGAIN   0x4385
 
#define ADE7880_REG_NIGAIN   0x4386
 
#define ADE7880_REG_DICOEFF   0x4388
 
#define ADE7880_REG_APGAIN   0x4389
 
#define ADE7880_REG_AWATTOS   0x438A
 
#define ADE7880_REG_BPGAIN   0x438B
 
#define ADE7880_REG_BWATTOS   0x438C
 
#define ADE7880_REG_CPGAIN   0x438D
 
#define ADE7880_REG_CWATTOS   0x438E
 
#define ADE7880_REG_AIRMSOS   0x438F
 
#define ADE7880_REG_AVRMSOS   0x4390
 
#define ADE7880_REG_BIRMSOS   0x4391
 
#define ADE7880_REG_BVRMSOS   0x4392
 
#define ADE7880_REG_CIRMSOS   0x4393
 
#define ADE7880_REG_CVRMSOS   0x4394
 
#define ADE7880_REG_NIRMSOS   0x4395
 
#define ADE7880_REG_HPGAIN   0x4398
 
#define ADE7880_REG_ISUMLVL   0x4399
 
#define ADE7880_REG_VLEVEL   0x439F
 
#define ADE7880_REG_AFWATTOS   0x43A2
 
#define ADE7880_REG_BFWATTOS   0x43A3
 
#define ADE7880_REG_CFWATTOS   0x43A4
 
#define ADE7880_REG_AFVAROS   0x43A5
 
#define ADE7880_REG_BFVAROS   0x43A6
 
#define ADE7880_REG_CFVAROS   0x43A7
 
#define ADE7880_REG_AFIRMSOS   0x43A8
 
#define ADE7880_REG_BFIRMSOS   0x43A9
 
#define ADE7880_REG_CFIRMSOS   0x43AA
 
#define ADE7880_REG_AFVRMSOS   0x43AB
 
#define ADE7880_REG_BFVRMSOS   0x43AC
 
#define ADE7880_REG_CFVRMSOS   0x43AD
 
#define ADE7880_REG_HXWATTOS   0x43AE
 
#define ADE7880_REG_HYWATTOS   0x43AF
 
#define ADE7880_REG_HZWATTOS   0x43B0
 
#define ADE7880_REG_HXVAROS   0x43B1
 
#define ADE7880_REG_HYVAROS   0x43B2
 
#define ADE7880_REG_HZVAROS   0x43B3
 
#define ADE7880_REG_HXIRMSOS   0x43B4
 
#define ADE7880_REG_HYIRMSOS   0x43B5
 
#define ADE7880_REG_HZIRMSOS   0x43B6
 
#define ADE7880_REG_HXVRMSOS   0x43B7
 
#define ADE7880_REG_HYVRMSOS   0x43B8
 
#define ADE7880_REG_HZVRMSOS   0x43B9
 
#define ADE7880_REG_AIRMS   0x43C0
 
#define ADE7880_REG_AVRMS   0x43C1
 
#define ADE7880_REG_BIRMS   0x43C2
 
#define ADE7880_REG_BVRMS   0x43C3
 
#define ADE7880_REG_CIRMS   0x43C4
 
#define ADE7880_REG_CVRMS   0x43C5
 
#define ADE7880_REG_NIRMS   0x43C6
 
#define ADE7880_REG_ISUM   0x43C7
 
#define ADE7880_REG_RUN   0xE228
 
#define ADE7880_REG_AWATTHR   0xE400
 
#define ADE7880_REG_BWATTHR   0xE401
 
#define ADE7880_REG_CWATTHR   0xE402
 
#define ADE7880_REG_AFWATTHR   0xE403
 
#define ADE7880_REG_BFWATTHR   0xE404
 
#define ADE7880_REG_CFWATTHR   0xE405
 
#define ADE7880_REG_AFVARHR   0xE409
 
#define ADE7880_REG_BFVARHR   0xE40A
 
#define ADE7880_REG_CFVARHR   0xE40B
 
#define ADE7880_REG_AVAHR   0xE40C
 
#define ADE7880_REG_BVAHR   0xE40D
 
#define ADE7880_REG_CVAHR   0xE40E
 
#define ADE7880_REG_IPEAK   0xE500
 
#define ADE7880_REG_VPEAK   0xE501
 
#define ADE7880_REG_STATUS0   0xE502
 
#define ADE7880_REG_STATUS1   0xE503
 
#define ADE7880_REG_AIMAV   0xE504
 
#define ADE7880_REG_BIMAV   0xE505
 
#define ADE7880_REG_CIMAV   0xE506
 
#define ADE7880_REG_OILVL   0xE507
 
#define ADE7880_REG_OVLVL   0xE508
 
#define ADE7880_REG_SAGLVL   0xE509
 
#define ADE7880_REG_MASK0   0xE50A
 
#define ADE7880_REG_MASK1   0xE50B
 
#define ADE7880_REG_IAWV   0xE50C
 
#define ADE7880_REG_IBWV   0xE50D
 
#define ADE7880_REG_ICWV   0xE50E
 
#define ADE7880_REG_INWV   0xE50F
 
#define ADE7880_REG_VAWV   0xE510
 
#define ADE7880_REG_VBWV   0xE511
 
#define ADE7880_REG_VCWV   0xE512
 
#define ADE7880_REG_AWATT   0xE513
 
#define ADE7880_REG_BWATT   0xE514
 
#define ADE7880_REG_CWATT   0xE515
 
#define ADE7880_REG_AVA   0xE519
 
#define ADE7880_REG_BVA   0xE51A
 
#define ADE7880_REG_CVA   0xE51B
 
#define ADE7880_REG_CHECKSUM   0xE51F
 
#define ADE7880_REG_VNOM   0xE520
 
#define ADE7880_REG_LAST_RWDATA32   0xE5FF
 
#define ADE7880_REG_PHSTATUS   0xE600
 
#define ADE7880_REG_ANGLE0   0xE601
 
#define ADE7880_REG_ANGLE1   0xE602
 
#define ADE7880_REG_ANGLE2   0xE603
 
#define ADE7880_REG_PHNOLOAD   0xE608
 
#define ADE7880_REG_LINECYC   0xE60C
 
#define ADE7880_REG_ZXTOUT   0xE60D
 
#define ADE7880_REG_COMPMODE   0xE60E
 
#define ADE7880_REG_GAIN   0xE60F
 
#define ADE7880_REG_CFMODE   0xE610
 
#define ADE7880_REG_CF1DEN   0xE611
 
#define ADE7880_REG_CF2DEN   0xE612
 
#define ADE7880_REG_CF3DEN   0xE613
 
#define ADE7880_REG_APHCAL   0xE614
 
#define ADE7880_REG_BPHCAL   0xE615
 
#define ADE7880_REG_CPHCAL   0xE616
 
#define ADE7880_REG_PHSIGN   0xE617
 
#define ADE7880_REG_CONFIG   0xE618
 
#define ADE7880_REG_MMODE   0xE700
 
#define ADE7880_REG_ACCMODE   0xE701
 
#define ADE7880_REG_LCYCMODE   0xE702
 
#define ADE7880_REG_PEAKCYC   0xE703
 
#define ADE7880_REG_SAGCYC   0xE704
 
#define ADE7880_REG_CFCYC   0xE705
 
#define ADE7880_REG_HSDC_CFG   0xE706
 
#define ADE7880_REG_VERSION   0xE707
 
#define ADE7880_REG_RESERVED   0xE7E4
 
#define ADE7880_REG_LAST_RWDATA8   0xE7FD
 
#define ADE7880_REG_FVRMS   0xE880
 
#define ADE7880_REG_FIRMS   0xE881
 
#define ADE7880_REG_FWATT   0xE882
 
#define ADE7880_REG_FVAR   0xE883
 
#define ADE7880_REG_FVA   0xE884
 
#define ADE7880_REG_FPF   0xE885
 
#define ADE7880_REG_VTHD   0xE886
 
#define ADE7880_REG_ITHD   0xE887
 
#define ADE7880_REG_HXVRMS   0xE888
 
#define ADE7880_REG_HXIRMS   0xE889
 
#define ADE7880_REG_HXWATT   0xE88A
 
#define ADE7880_REG_HXVAR   0xE88B
 
#define ADE7880_REG_HXVA   0xE88C
 
#define ADE7880_REG_HXPF   0xE88D
 
#define ADE7880_REG_HXVHD   0xE88E
 
#define ADE7880_REG_HXIHD   0xE88F
 
#define ADE7880_REG_HYVRMS   0xE890
 
#define ADE7880_REG_HYIRMS   0xE891
 
#define ADE7880_REG_HYWATT   0xE892
 
#define ADE7880_REG_HFVAR   0xE893
 
#define ADE7880_REG_HYVA   0xE894
 
#define ADE7880_REG_HYPF   0xE895
 
#define ADE7880_REG_HYVHD   0xE896
 
#define ADE7880_REG_HYIHD   0xE897
 
#define ADE7880_REG_HZVRMS   0xE898
 
#define ADE7880_REG_HZIRMS   0xE899
 
#define ADE7880_REG_HZWATT   0xE89A
 
#define ADE7880_REG_HZVAR   0xE89B
 
#define ADE7880_REG_HZVA   0xE89C
 
#define ADE7880_REG_HZPF   0xE89D
 
#define ADE7880_REG_HZVHD   0xE89E
 
#define ADE7880_REG_HZIHD   0xE89F
 
#define ADE7880_REG_HCONFIG   0xE900
 
#define ADE7880_REG_APF   0xE902
 
#define ADE7880_REG_BPF   0xE903
 
#define ADE7880_REG_CPF   0xE904
 
#define ADE7880_REG_APERIOD   0xE905
 
#define ADE7880_REG_BPERIOD   0xE906
 
#define ADE7880_REG_CPERIOD   0xE907
 
#define ADE7880_REG_APNOLOAD   0xE908
 
#define ADE7880_REG_VARNOLOAD   0xE909
 
#define ADE7880_REG_VANOLOAD   0xE90A
 
#define ADE7880_REG_LAST_ADD   0xE9FE
 
#define ADE7880_REG_LAST_RWDATA16   0xE9FF
 
#define ADE7880_REG_CONFIG3   0xEA00
 
#define ADE7880_REG_LAST_OP   0xEA01
 
#define ADE7880_REG_WTHR   0xEA02
 
#define ADE7880_REG_VARTHR   0xEA03
 
#define ADE7880_REG_VATHR   0xEA04
 
#define ADE7880_REG_HX   0xEA08
 
#define ADE7880_REG_HY   0xEA09
 
#define ADE7880_REG_HZ   0xEA0A
 
#define ADE7880_REG_LPOILVL   0xEC00
 
#define ADE7880_REG_CONFIG2   0xEC01
 
#define ADE7880_IPPHASE2   NO_OS_BIT(26)
 
#define ADE7880_IPPHASE1   NO_OS_BIT(25)
 
#define ADE7880_IPPHASE0   NO_OS_BIT(24)
 
#define ADE7880_IPEAKVAL   NO_OS_GENMASK(23, 0)
 
#define ADE7880_VPPHASE2   NO_OS_BIT(26)
 
#define ADE7880_VPPHASE1   NO_OS_BIT(25)
 
#define ADE7880_VPPHASE0   NO_OS_BIT(24)
 
#define ADE7880_VPEAKVAL   NO_OS_GENMASK(23, 0)
 
#define ADE7880_STATUS0_HREADY   NO_OS_BIT(19)
 
#define ADE7880_STATUS0_REVPSUM3   NO_OS_BIT(18)
 
#define ADE7880_STATUS0_DREADY   NO_OS_BIT(17)
 
#define ADE7880_STATUS0_CF3   NO_OS_BIT(16)
 
#define ADE7880_STATUS0_CF2   NO_OS_BIT(15)
 
#define ADE7880_STATUS0_CF1   NO_OS_BIT(14)
 
#define ADE7880_STATUS0_REVPSUM2   NO_OS_BIT(13)
 
#define ADE7880_STATUS0_REVFRPC   NO_OS_BIT(12)
 
#define ADE7880_STATUS0_REVFRPB   NO_OS_BIT(11)
 
#define ADE7880_STATUS0_REVFRPA   NO_OS_BIT(10)
 
#define ADE7880_STATUS0_REVPSUM1   NO_OS_BIT(9)
 
#define ADE7880_STATUS0_REVAPC   NO_OS_BIT(8)
 
#define ADE7880_STATUS0_REVAPB   NO_OS_BIT(7)
 
#define ADE7880_STATUS0_REVAPA   NO_OS_BIT(6)
 
#define ADE7880_STATUS0_LENERGY   NO_OS_BIT(5)
 
#define ADE7880_STATUS0_VAEHF   NO_OS_BIT(4)
 
#define ADE7880_STATUS0_FREHF   NO_OS_BIT(3)
 
#define ADE7880_STATUS0_FAEHF   NO_OS_BIT(1)
 
#define ADE7880_STATUS0_AEHF   NO_OS_BIT(0)
 
#define ADE7880_STATUS1_CRC   NO_OS_BIT(25)
 
#define ADE7880_STATUS1_PKV   NO_OS_BIT(24)
 
#define ADE7880_STATUS1_PKI   NO_OS_BIT(23)
 
#define ADE7880_STATUS1_MISMTCH   NO_OS_BIT(20)
 
#define ADE7880_STATUS1_SEQERR   NO_OS_BIT(19)
 
#define ADE7880_STATUS1_OV   NO_OS_BIT(18)
 
#define ADE7880_STATUS1_OI   NO_OS_BIT(17)
 
#define ADE7880_STATUS1_SAG   NO_OS_BIT(16)
 
#define ADE7880_STATUS1_RSTDONE   NO_OS_BIT(15)
 
#define ADE7880_STATUS1_ZXIC   NO_OS_BIT(14)
 
#define ADE7880_STATUS1_ZXIB   NO_OS_BIT(13)
 
#define ADE7880_STATUS1_ZXIA   NO_OS_BIT(12)
 
#define ADE7880_STATUS1_ZXVC   NO_OS_BIT(11)
 
#define ADE7880_STATUS1_ZXVB   NO_OS_BIT(10)
 
#define ADE7880_STATUS1_ZXVA   NO_OS_BIT(9)
 
#define ADE7880_STATUS1_ZXTOIC   NO_OS_BIT(8)
 
#define ADE7880_STATUS1_ZXTOIB   NO_OS_BIT(7)
 
#define ADE7880_STATUS1_ZXTOIA   NO_OS_BIT(6)
 
#define ADE7880_STATUS1_ZXTOVC   NO_OS_BIT(5)
 
#define ADE7880_STATUS1_ZXTOVB   NO_OS_BIT(4)
 
#define ADE7880_STATUS1_ZXTOVA   NO_OS_BIT(3)
 
#define ADE7880_STATUS1_VANLOAD   NO_OS_BIT(2)
 
#define ADE7880_STATUS1_FNLOAD   NO_OS_BIT(1)
 
#define ADE7880_STATUS1_NLOAD   NO_OS_BIT(0)
 
#define ADE7880_MASK0_HREADY   NO_OS_BIT(19)
 
#define ADE7880_MASK0_REVPSUM3   NO_OS_BIT(18)
 
#define ADE7880_MASK0_DREADY   NO_OS_BIT(17)
 
#define ADE7880_MASK0_CF3   NO_OS_BIT(16)
 
#define ADE7880_MASK0_CF2   NO_OS_BIT(15)
 
#define ADE7880_MASK0_CF1   NO_OS_BIT(14)
 
#define ADE7880_MASK0_REVPSUM2   NO_OS_BIT(13)
 
#define ADE7880_MASK0_REVFRPC   NO_OS_BIT(12)
 
#define ADE7880_MASK0_REVFRPB   NO_OS_BIT(11)
 
#define ADE7880_MASK0_REVFRPA   NO_OS_BIT(10)
 
#define ADE7880_MASK0_REVPSUM1   NO_OS_BIT(9)
 
#define ADE7880_MASK0_REVAPC   NO_OS_BIT(8)
 
#define ADE7880_MASK0_REVAPB   NO_OS_BIT(7)
 
#define ADE7880_MASK0_REVAPA   NO_OS_BIT(6)
 
#define ADE7880_MASK0_LENERGY   NO_OS_BIT(5)
 
#define ADE7880_MASK0_VAEHF   NO_OS_BIT(4)
 
#define ADE7880_MASK0_FREHF   NO_OS_BIT(3)
 
#define ADE7880_MASK0_FAEHF   NO_OS_BIT(1)
 
#define ADE7880_MASK0_AEHF   NO_OS_BIT(0)
 
#define ADE7880_MASK1_CRC   NO_OS_BIT(25)
 
#define ADE7880_MASK1_PKV   NO_OS_BIT(24)
 
#define ADE7880_MASK1_PKI   NO_OS_BIT(23)
 
#define ADE7880_MASK1_MISMTCH   NO_OS_BIT(20)
 
#define ADE7880_MASK1_SEQERR   NO_OS_BIT(19)
 
#define ADE7880_MASK1_OV   NO_OS_BIT(18)
 
#define ADE7880_MASK1_OI   NO_OS_BIT(17)
 
#define ADE7880_MASK1_SAG   NO_OS_BIT(16)
 
#define ADE7880_MASK1_RSTDONE   NO_OS_BIT(15)
 
#define ADE7880_MASK1_ZXIC   NO_OS_BIT(14)
 
#define ADE7880_MASK1_ZXIB   NO_OS_BIT(13)
 
#define ADE7880_MASK1_ZXIA   NO_OS_BIT(12)
 
#define ADE7880_MASK1_ZXVC   NO_OS_BIT(11)
 
#define ADE7880_MASK1_ZXVB   NO_OS_BIT(10)
 
#define ADE7880_MASK1_ZXVA   NO_OS_BIT(9)
 
#define ADE7880_MASK1_ZXTOIC   NO_OS_BIT(8)
 
#define ADE7880_MASK1_ZXTOIB   NO_OS_BIT(7)
 
#define ADE7880_MASK1_ZXTOIA   NO_OS_BIT(6)
 
#define ADE7880_MASK1_ZXTOVC   NO_OS_BIT(5)
 
#define ADE7880_MASK1_ZXTOVB   NO_OS_BIT(4)
 
#define ADE7880_MASK1_ZXTOVA   NO_OS_BIT(3)
 
#define ADE7880_MASK1_VANLOAD   NO_OS_BIT(2)
 
#define ADE7880_MASK1_FNLOAD   NO_OS_BIT(1)
 
#define ADE7880_MASK1_NLOAD   NO_OS_BIT(0)
 
#define ADE7880_VSPHASE2   NO_OS_BIT(14)
 
#define ADE7880_VSPHASE1   NO_OS_BIT(13)
 
#define ADE7880_VSPHASE0   NO_OS_BIT(12)
 
#define ADE7880_OVPHASE2   NO_OS_BIT(11)
 
#define ADE7880_OVPHASE1   NO_OS_BIT(10)
 
#define ADE7880_OVPHASE0   NO_OS_BIT(9)
 
#define ADE7880_OIPHASE2   NO_OS_BIT(5)
 
#define ADE7880_OIPHASE1   NO_OS_BIT(4)
 
#define ADE7880_OIPHASE0   NO_OS_BIT(3)
 
#define ADE7880_VANLPHASE2   NO_OS_BIT(8)
 
#define ADE7880_VANLPHASE1   NO_OS_BIT(7)
 
#define ADE7880_VANLPHASE0   NO_OS_BIT(6)
 
#define ADE7880_FNLPHASE2   NO_OS_BIT(5)
 
#define ADE7880_FNLPHASE1   NO_OS_BIT(4)
 
#define ADE7880_FNLPHASE0   NO_OS_BIT(3)
 
#define ADE7880_NLPHASE2   NO_OS_BIT(2)
 
#define ADE7880_NLPHASE1   NO_OS_BIT(1)
 
#define ADE7880_NLPHASE0   NO_OS_BIT(0)
 
#define ADE7880_SELFREQ   NO_OS_BIT(14)
 
#define ADE7880_VNOMCEN   NO_OS_BIT(13)
 
#define ADE7880_VNOMBEN   NO_OS_BIT(12)
 
#define ADE7880_VNOMAEN   NO_OS_BIT(11)
 
#define ADE7880_ANGLESEL   NO_OS_GENMASK(10, 9)
 
#define ADE7880_TERMSEL3_2   NO_OS_BIT(8)
 
#define ADE7880_TERMSEL3_1   NO_OS_BIT(7)
 
#define ADE7880_TERMSEL3_0   NO_OS_BIT(6)
 
#define ADE7880_TERMSEL2_2   NO_OS_BIT(5)
 
#define ADE7880_TERMSEL2_1   NO_OS_BIT(4)
 
#define ADE7880_TERMSEL2_0   NO_OS_BIT(3)
 
#define ADE7880_TERMSEL1_2   NO_OS_BIT(2)
 
#define ADE7880_TERMSEL1_1   NO_OS_BIT(1)
 
#define ADE7880_TERMSEL1_0   NO_OS_BIT(0)
 
#define ADE7880_PGA3   NO_OS_GENMASK(8, 6)
 
#define ADE7880_PGA2   NO_OS_GENMASK(5, 3)
 
#define ADE7880_PGA1   NO_OS_GENMASK(2, 0)
 
#define ADE7880_CF3LATCH   NO_OS_BIT(14)
 
#define ADE7880_CF2LATCH   NO_OS_BIT(13)
 
#define ADE7880_CF1LATCH   NO_OS_BIT(12)
 
#define ADE7880_CF3DIS   NO_OS_BIT(11)
 
#define ADE7880_CF2DIS   NO_OS_BIT(10)
 
#define ADE7880_CF1DIS   NO_OS_BIT(9)
 
#define ADE7880_CF3SEL   NO_OS_GENMASK(8, 6)
 
#define ADE7880_CF2SEL   NO_OS_GENMASK(5, 3)
 
#define ADE7880_CF1SEL   NO_OS_GENMASK(2, 0)
 
#define ADE7880_PHCALVAL   NO_OS_GENMASK(9, 0)
 
#define ADE7880_SUM3SIGN   NO_OS_BIT(8)
 
#define ADE7880_SUM2SIGN   NO_OS_BIT(7)
 
#define ADE7880_CFVARSIGN   NO_OS_BIT(6)
 
#define ADE7880_BFVARSIGN   NO_OS_BIT(5)
 
#define ADE7880_AFVARSIGN   NO_OS_BIT(4)
 
#define ADE7880_SUM1SIGN   NO_OS_BIT(3)
 
#define ADE7880_CWSIGN   NO_OS_BIT(2)
 
#define ADE7880_BWSIGN   NO_OS_BIT(1)
 
#define ADE7880_AWSIGN   NO_OS_BIT(0)
 
#define ADE7880_VTOIC   NO_OS_GENMASK(13, 12)
 
#define ADE7880_VTOIB   NO_OS_GENMASK(11, 10)
 
#define ADE7880_VTOIA   NO_OS_GENMASK(9, 8)
 
#define ADE7880_SWRST   NO_OS_BIT(7)
 
#define ADE7880_HSDCEN   NO_OS_BIT(6)
 
#define ADE7880_MOD2SHORT   NO_OS_BIT(5)
 
#define ADE7880_MOD1SHORT   NO_OS_BIT(4)
 
#define ADE7880_SWAP   NO_OS_BIT(3)
 
#define ADE7880_CF2DIS   NO_OS_BIT(2)
 
#define ADE7880_INTEN   NO_OS_BIT(0)
 
#define ADE7880_PEAKSEL2   NO_OS_BIT(4)
 
#define ADE7880_PEAKSEL1   NO_OS_BIT(3)
 
#define ADE7880_PEAKSEL0   NO_OS_BIT(2)
 
#define ADE7880_REVAPSEL   NO_OS_BIT(6)
 
#define ADE7880_CONSEL   NO_OS_GENMASK(5, 4)
 
#define ADE7880_VARACC   NO_OS_GENMASK(3, 2)
 
#define ADE7880_WATTACC   NO_OS_GENMASK(1, 0)
 
#define ADE7880_PFMODE   NO_OS_BIT(7)
 
#define ADE7880_RSTREAD   NO_OS_BIT(6)
 
#define ADE7880_ZXSEL2   NO_OS_BIT(5)
 
#define ADE7880_ZXSEL1   NO_OS_BIT(4)
 
#define ADE7880_ZXSEL0   NO_OS_BIT(3)
 
#define ADE7880_LVA   NO_OS_BIT(2)
 
#define ADE7880_LVAR   NO_OS_BIT(1)
 
#define ADE7880_LWATT   NO_OS_BIT(0)
 
#define ADE7880_HSAPOL   NO_OS_BIT(5)
 
#define ADE7880_HXFER   NO_OS_GENMASK(4, 3)
 
#define ADE7880_HGAP   NO_OS_BIT(2)
 
#define ADE7880_HSIZE   NO_OS_BIT(1)
 
#define ADE7880_HCLK   NO_OS_BIT(0)
 
#define ADE7880_ININTEN   NO_OS_BIT(3)
 
#define ADE7880_INSEL   NO_OS_BIT(2)
 
#define ADE7880_LPFSEL   NO_OS_BIT(1)
 
#define ADE7880_HPFEN   NO_OS_BIT(0)
 
#define ADE7880_ACTPHSEL   NO_OS_GENMASK(9, 8)
 
#define ADE7880_HRATE   NO_OS_GENMASK(7, 5)
 
#define ADE7880_HSTIME   NO_OS_GENMASK(4, 3)
 
#define ADE7880_HPHASE   NO_OS_GENMASK(2, 1)
 
#define ADE7880_HRCFG   NO_OS_BIT(0)
 
#define ADE7880_LPLINE   NO_OS_GENMASK(7, 3)
 
#define ADE7880_LPOIL   NO_OS_GENMASK(2, 0)
 
#define ADE7880_I2C_LOCK   NO_OS_BIT(1)
 
#define ADE7880_EXTREFEN   NO_OS_BIT(0)
 
#define ADE7880_CHIP_ID   0x0EA0
 
#define ADE7880_RESET_RECOVER   100
 
#define ADE7880_RAM_PROTECTION1   0xE7FE
 
#define ADE7880_RAM_PROTECTION2   0xE7E3
 
#define ADE7880_RAM_PROT_VAL1   0xAD
 
#define ADE7880_RAM_PROT_VAL2   0x80
 
#define ADE7880_SET_SPI_ADDR   0xEBFF
 
#define ADE7880_DUMB_VAL   0x01
 
#define ADE7880_DICOEFF   0x00000000
 
#define ADE7880_VLEVEL_VAL   0x007A1200
 
#define ADE7880_RUN_ON   0x0001
 
#define ADE7880_RMS_FS_CODES   5326737
 
#define ADE7880_BURDEN_RES   10
 
#define ADE7880_CURRENT_TR_RATIO   1000
 
#define ADE7880_CURRENT_TR_FCN   (ADE7880_CURRENT_TR_RATIO / ADE7880_BURDEN_RES)
 
#define ADE7880_UP_RES   1000000
 
#define ADE7880_DOWN_RES   1000
 
#define ADE7880_VOLTAGE_TR_FCN   ((ADE7880_DOWN_RES + ADE7880_UP_RES) / ADE7880_DOWN_RES)
 
#define ADE7880_FS_VOLTAGE   3535
 

Enumerations

enum  ade7880_anglesel_e {
  ADE7880_ANGLESEL_V_I,
  ADE7880_ANGLESEL_V,
  ADE7880_ANGLESEL_I,
  ADE7880_NO_ANGLESEL
}
 ADE7880 angles measurement. More...
 
enum  ade7880_pga_gain_e {
  ADE7880_PGAGAIN_1,
  ADE7880_PGAGAIN_2,
  ADE7880_PGAGAIN_4,
  ADE7880_PGAGAIN_8,
  ADE7880_PGAGAIN_16
}
 ADE7880 phase currents/neutral current/phase voltages gain selection is currently being used. More...
 
enum  ade7880_cfxsel_e {
  ADE7880_CFXSEL_0,
  ADE7880_CFXSEL_1 = 2,
  ADE7880_CFXSEL_2,
  ADE7880_CFXSEL_3
}
 ADE7880 These bits indicate the value the CFx frequency is proportional to. More...
 
enum  ade7880_vtoia_e {
  ADE7880_VTOIA_A,
  ADE7880_VTOIA_B,
  ADE7880_VTOIA_C
}
 ADE7880 These bits decide what phase voltage is considered together with Phase A current in the power path. More...
 
enum  ade7880_vtoib_e {
  ADE7880_VTOIB_B,
  ADE7880_VTOIB_C,
  ADE7880_VTOIB_A
}
 ADE7880 These bits decide what phase voltage is considered together with Phase B current in the power path. More...
 
enum  ade7880_vtoic_e {
  ADE7880_VTOIC_C,
  ADE7880_VTOIC_A,
  ADE7880_VTOIC_B
}
 ADE7880 These bits decide what phase voltage is considered together with Phase C current in the power path. More...
 
enum  ade7880_wattacc_e {
  ADE7880_WATTACC_SIGNED_ACC,
  ADE7880_WATTACC_POSITIVE_ACC,
  ADE7880_WATTACC_RESERVED,
  ADE7880_WATTACC_ABSOLUTE_ACC
}
 ADE7880 These bits decide the accumulation mode of fundamental active powers. More...
 
enum  ade7880_varacc_e {
  ADE7880_VARACC_SIGNED_ACC,
  ADE7880_VARACC_RESERVED,
  ADE7880_VARACC_SIGN_WATTACC,
  ADE7880_VARACC_ABSOLUTE_ACC
}
 ADE7880 These bits decide the accumulation mode of funamental reactive powers. More...
 
enum  ade7880_consel_e {
  ADE7880_CONSEL_3P_3W,
  ADE7880_CONSEL_3P_3W_DELTA,
  ADE7880_CONSEL_3P_4W,
  ADE7880_CONSEL_3P_4W_DELTA
}
 ADE7880 These bits select the inputs to the energy accumulation registers. IA’, IB’, and IC’ are IA, IB, and IC shifted respectively by −90° More...
 
enum  ade7880_hxfer_e {
  ADE7880_HXFER_16,
  ADE7880_HXFER_7,
  ADE7880_HXFER_9,
  ADE7880_HXFER_RESERVED
}
 ADE7880 These bits select the data transmitted on HSDC. More...
 
enum  ade7880_hphase_e {
  ADE7880_HPHASE_A,
  ADE7880_HPHASE_B,
  ADE7880_HPHASE_C,
  ADE7880_HPHASE_N
}
 ADE7880 These bits decide what phase or neutral is analyzed by the harmonic calculations block. More...
 
enum  ade7880_hstime_e {
  ADE7880_HSTIM_500,
  ADE7880_HSTIM_700,
  ADE7880_HSTIM_1000,
  ADE7880_HSTIM_1250
}
 ADE7880 These bits decide the delay period after which, if HRCFG bit is set to 0, Bit 19 (HREADY) in the STATUS0 register is set to 1. More...
 
enum  ade7880_hrate_e {
  ADE7880_HRATE_8K,
  ADE7880_HRATE_4K,
  ADE7880_HRATE_1K,
  ADE7880_HRATE_62_5,
  ADE7880_HRATE_7_8125,
  ADE7880_HRATE_1_953125,
  ADE7880_HRATE_0_9765625,
  ADE7880_HRATE_DISABLED
}
 ADE7880 These bits manage the update rate of the harmonic registers. More...
 
enum  ade7880_actphsel_e {
  ADE7880_ACTPHSEL_A,
  ADE7880_ACTPHSEL_B,
  ADE7880_ACTPHSEL_C,
  ADE7880_ACTPHSEL_RESERVED
}
 ADE7880 These bits select the phase voltage used as time base for harmonic calculations. More...
 
enum  ade7880_freq_sel_e {
  ADE7880_SELFREQ_50,
  ADE7880_SELFREQ_60
}
 ADE7880 Freq value. More...
 
enum  ade7880_phase {
  ADE7880_PHASE_A,
  ADE7880_PHASE_B,
  ADE7880_PHASE_C
}
 ADE7880 available phases. More...
 
enum  ade7880_power_mode_e {
  NORMAL_MODE,
  REDUCED_POWER_MODE,
  LOW_POWER_MODE,
  SLEEP_MODE
}
 ADE7880 Power mode selection. More...
 

Functions

int ade7880_read (struct ade7880_dev *dev, uint16_t reg_addr, uint32_t *reg_data)
 Read device register. More...
 
int ade7880_write (struct ade7880_dev *dev, uint16_t reg_addr, uint32_t reg_data)
 Write device register. More...
 
int ade7880_set_power_mode (struct ade7880_dev *dev)
 Set power mode. More...
 
int ade7880_update_bits (struct ade7880_dev *dev, uint16_t reg_addr, uint32_t mask, uint32_t reg_data)
 Update specific register bits. More...
 
int ade7880_read_data_ph (struct ade7880_dev *dev, enum ade7880_phase phase)
 Read the power/energy for specific phase. More...
 
int ade7880_init (struct ade7880_dev **device, struct ade7880_init_param init_param)
 Initialize the device. More...
 
int ade7880_setup (struct ade7880_dev *dev)
 Setup the device. More...
 
int ade7880_remove (struct ade7880_dev *dev)
 Remove the device and release resources. More...
 
int ade7880_get_int_status0 (struct ade7880_dev *dev, uint32_t msk, uint8_t *status)
 Get interrupt indicator from STATUS0 register. More...
 

Detailed Description

Header file of ADE7880 Driver.

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

Copyright 2024(c) Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ ADE7880_ACTPHSEL

#define ADE7880_ACTPHSEL   NO_OS_GENMASK(9, 8)

◆ ADE7880_AFVARSIGN

#define ADE7880_AFVARSIGN   NO_OS_BIT(4)

◆ ADE7880_ANGLESEL

#define ADE7880_ANGLESEL   NO_OS_GENMASK(10, 9)

◆ ADE7880_AWSIGN

#define ADE7880_AWSIGN   NO_OS_BIT(0)

◆ ADE7880_BFVARSIGN

#define ADE7880_BFVARSIGN   NO_OS_BIT(5)

◆ ADE7880_BURDEN_RES

#define ADE7880_BURDEN_RES   10

◆ ADE7880_BWSIGN

#define ADE7880_BWSIGN   NO_OS_BIT(1)

◆ ADE7880_CF1DIS

#define ADE7880_CF1DIS   NO_OS_BIT(9)

◆ ADE7880_CF1LATCH

#define ADE7880_CF1LATCH   NO_OS_BIT(12)

◆ ADE7880_CF1SEL

#define ADE7880_CF1SEL   NO_OS_GENMASK(2, 0)

◆ ADE7880_CF2DIS [1/2]

#define ADE7880_CF2DIS   NO_OS_BIT(10)

◆ ADE7880_CF2DIS [2/2]

#define ADE7880_CF2DIS   NO_OS_BIT(2)

◆ ADE7880_CF2LATCH

#define ADE7880_CF2LATCH   NO_OS_BIT(13)

◆ ADE7880_CF2SEL

#define ADE7880_CF2SEL   NO_OS_GENMASK(5, 3)

◆ ADE7880_CF3DIS

#define ADE7880_CF3DIS   NO_OS_BIT(11)

◆ ADE7880_CF3LATCH

#define ADE7880_CF3LATCH   NO_OS_BIT(14)

◆ ADE7880_CF3SEL

#define ADE7880_CF3SEL   NO_OS_GENMASK(8, 6)

◆ ADE7880_CFVARSIGN

#define ADE7880_CFVARSIGN   NO_OS_BIT(6)

◆ ADE7880_CHIP_ID

#define ADE7880_CHIP_ID   0x0EA0

◆ ADE7880_CONSEL

#define ADE7880_CONSEL   NO_OS_GENMASK(5, 4)

◆ ADE7880_CURRENT_TR_FCN

#define ADE7880_CURRENT_TR_FCN   (ADE7880_CURRENT_TR_RATIO / ADE7880_BURDEN_RES)

◆ ADE7880_CURRENT_TR_RATIO

#define ADE7880_CURRENT_TR_RATIO   1000

◆ ADE7880_CWSIGN

#define ADE7880_CWSIGN   NO_OS_BIT(2)

◆ ADE7880_DICOEFF

#define ADE7880_DICOEFF   0x00000000

◆ ADE7880_DOWN_RES

#define ADE7880_DOWN_RES   1000

◆ ADE7880_DUMB_VAL

#define ADE7880_DUMB_VAL   0x01

◆ ADE7880_EXTREFEN

#define ADE7880_EXTREFEN   NO_OS_BIT(0)

◆ ADE7880_FNLPHASE0

#define ADE7880_FNLPHASE0   NO_OS_BIT(3)

◆ ADE7880_FNLPHASE1

#define ADE7880_FNLPHASE1   NO_OS_BIT(4)

◆ ADE7880_FNLPHASE2

#define ADE7880_FNLPHASE2   NO_OS_BIT(5)

◆ ADE7880_FS_VOLTAGE

#define ADE7880_FS_VOLTAGE   3535

◆ ADE7880_HCLK

#define ADE7880_HCLK   NO_OS_BIT(0)

◆ ADE7880_HGAP

#define ADE7880_HGAP   NO_OS_BIT(2)

◆ ADE7880_HPFEN

#define ADE7880_HPFEN   NO_OS_BIT(0)

◆ ADE7880_HPHASE

#define ADE7880_HPHASE   NO_OS_GENMASK(2, 1)

◆ ADE7880_HRATE

#define ADE7880_HRATE   NO_OS_GENMASK(7, 5)

◆ ADE7880_HRCFG

#define ADE7880_HRCFG   NO_OS_BIT(0)

◆ ADE7880_HSAPOL

#define ADE7880_HSAPOL   NO_OS_BIT(5)

◆ ADE7880_HSDCEN

#define ADE7880_HSDCEN   NO_OS_BIT(6)

◆ ADE7880_HSIZE

#define ADE7880_HSIZE   NO_OS_BIT(1)

◆ ADE7880_HSTIME

#define ADE7880_HSTIME   NO_OS_GENMASK(4, 3)

◆ ADE7880_HXFER

#define ADE7880_HXFER   NO_OS_GENMASK(4, 3)

◆ ADE7880_I2C_LOCK

#define ADE7880_I2C_LOCK   NO_OS_BIT(1)

◆ ADE7880_ININTEN

#define ADE7880_ININTEN   NO_OS_BIT(3)

◆ ADE7880_INSEL

#define ADE7880_INSEL   NO_OS_BIT(2)

◆ ADE7880_INTEN

#define ADE7880_INTEN   NO_OS_BIT(0)

◆ ADE7880_IPEAKVAL

#define ADE7880_IPEAKVAL   NO_OS_GENMASK(23, 0)

◆ ADE7880_IPPHASE0

#define ADE7880_IPPHASE0   NO_OS_BIT(24)

◆ ADE7880_IPPHASE1

#define ADE7880_IPPHASE1   NO_OS_BIT(25)

◆ ADE7880_IPPHASE2

#define ADE7880_IPPHASE2   NO_OS_BIT(26)

◆ ADE7880_LPFSEL

#define ADE7880_LPFSEL   NO_OS_BIT(1)

◆ ADE7880_LPLINE

#define ADE7880_LPLINE   NO_OS_GENMASK(7, 3)

◆ ADE7880_LPOIL

#define ADE7880_LPOIL   NO_OS_GENMASK(2, 0)

◆ ADE7880_LVA

#define ADE7880_LVA   NO_OS_BIT(2)

◆ ADE7880_LVAR

#define ADE7880_LVAR   NO_OS_BIT(1)

◆ ADE7880_LWATT

#define ADE7880_LWATT   NO_OS_BIT(0)

◆ ADE7880_MASK0_AEHF

#define ADE7880_MASK0_AEHF   NO_OS_BIT(0)

◆ ADE7880_MASK0_CF1

#define ADE7880_MASK0_CF1   NO_OS_BIT(14)

◆ ADE7880_MASK0_CF2

#define ADE7880_MASK0_CF2   NO_OS_BIT(15)

◆ ADE7880_MASK0_CF3

#define ADE7880_MASK0_CF3   NO_OS_BIT(16)

◆ ADE7880_MASK0_DREADY

#define ADE7880_MASK0_DREADY   NO_OS_BIT(17)

◆ ADE7880_MASK0_FAEHF

#define ADE7880_MASK0_FAEHF   NO_OS_BIT(1)

◆ ADE7880_MASK0_FREHF

#define ADE7880_MASK0_FREHF   NO_OS_BIT(3)

◆ ADE7880_MASK0_HREADY

#define ADE7880_MASK0_HREADY   NO_OS_BIT(19)

◆ ADE7880_MASK0_LENERGY

#define ADE7880_MASK0_LENERGY   NO_OS_BIT(5)

◆ ADE7880_MASK0_REVAPA

#define ADE7880_MASK0_REVAPA   NO_OS_BIT(6)

◆ ADE7880_MASK0_REVAPB

#define ADE7880_MASK0_REVAPB   NO_OS_BIT(7)

◆ ADE7880_MASK0_REVAPC

#define ADE7880_MASK0_REVAPC   NO_OS_BIT(8)

◆ ADE7880_MASK0_REVFRPA

#define ADE7880_MASK0_REVFRPA   NO_OS_BIT(10)

◆ ADE7880_MASK0_REVFRPB

#define ADE7880_MASK0_REVFRPB   NO_OS_BIT(11)

◆ ADE7880_MASK0_REVFRPC

#define ADE7880_MASK0_REVFRPC   NO_OS_BIT(12)

◆ ADE7880_MASK0_REVPSUM1

#define ADE7880_MASK0_REVPSUM1   NO_OS_BIT(9)

◆ ADE7880_MASK0_REVPSUM2

#define ADE7880_MASK0_REVPSUM2   NO_OS_BIT(13)

◆ ADE7880_MASK0_REVPSUM3

#define ADE7880_MASK0_REVPSUM3   NO_OS_BIT(18)

◆ ADE7880_MASK0_VAEHF

#define ADE7880_MASK0_VAEHF   NO_OS_BIT(4)

◆ ADE7880_MASK1_CRC

#define ADE7880_MASK1_CRC   NO_OS_BIT(25)

◆ ADE7880_MASK1_FNLOAD

#define ADE7880_MASK1_FNLOAD   NO_OS_BIT(1)

◆ ADE7880_MASK1_MISMTCH

#define ADE7880_MASK1_MISMTCH   NO_OS_BIT(20)

◆ ADE7880_MASK1_NLOAD

#define ADE7880_MASK1_NLOAD   NO_OS_BIT(0)

◆ ADE7880_MASK1_OI

#define ADE7880_MASK1_OI   NO_OS_BIT(17)

◆ ADE7880_MASK1_OV

#define ADE7880_MASK1_OV   NO_OS_BIT(18)

◆ ADE7880_MASK1_PKI

#define ADE7880_MASK1_PKI   NO_OS_BIT(23)

◆ ADE7880_MASK1_PKV

#define ADE7880_MASK1_PKV   NO_OS_BIT(24)

◆ ADE7880_MASK1_RSTDONE

#define ADE7880_MASK1_RSTDONE   NO_OS_BIT(15)

◆ ADE7880_MASK1_SAG

#define ADE7880_MASK1_SAG   NO_OS_BIT(16)

◆ ADE7880_MASK1_SEQERR

#define ADE7880_MASK1_SEQERR   NO_OS_BIT(19)

◆ ADE7880_MASK1_VANLOAD

#define ADE7880_MASK1_VANLOAD   NO_OS_BIT(2)

◆ ADE7880_MASK1_ZXIA

#define ADE7880_MASK1_ZXIA   NO_OS_BIT(12)

◆ ADE7880_MASK1_ZXIB

#define ADE7880_MASK1_ZXIB   NO_OS_BIT(13)

◆ ADE7880_MASK1_ZXIC

#define ADE7880_MASK1_ZXIC   NO_OS_BIT(14)

◆ ADE7880_MASK1_ZXTOIA

#define ADE7880_MASK1_ZXTOIA   NO_OS_BIT(6)

◆ ADE7880_MASK1_ZXTOIB

#define ADE7880_MASK1_ZXTOIB   NO_OS_BIT(7)

◆ ADE7880_MASK1_ZXTOIC

#define ADE7880_MASK1_ZXTOIC   NO_OS_BIT(8)

◆ ADE7880_MASK1_ZXTOVA

#define ADE7880_MASK1_ZXTOVA   NO_OS_BIT(3)

◆ ADE7880_MASK1_ZXTOVB

#define ADE7880_MASK1_ZXTOVB   NO_OS_BIT(4)

◆ ADE7880_MASK1_ZXTOVC

#define ADE7880_MASK1_ZXTOVC   NO_OS_BIT(5)

◆ ADE7880_MASK1_ZXVA

#define ADE7880_MASK1_ZXVA   NO_OS_BIT(9)

◆ ADE7880_MASK1_ZXVB

#define ADE7880_MASK1_ZXVB   NO_OS_BIT(10)

◆ ADE7880_MASK1_ZXVC

#define ADE7880_MASK1_ZXVC   NO_OS_BIT(11)

◆ ADE7880_MOD1SHORT

#define ADE7880_MOD1SHORT   NO_OS_BIT(4)

◆ ADE7880_MOD2SHORT

#define ADE7880_MOD2SHORT   NO_OS_BIT(5)

◆ ADE7880_NLPHASE0

#define ADE7880_NLPHASE0   NO_OS_BIT(0)

◆ ADE7880_NLPHASE1

#define ADE7880_NLPHASE1   NO_OS_BIT(1)

◆ ADE7880_NLPHASE2

#define ADE7880_NLPHASE2   NO_OS_BIT(2)

◆ ADE7880_OIPHASE0

#define ADE7880_OIPHASE0   NO_OS_BIT(3)

◆ ADE7880_OIPHASE1

#define ADE7880_OIPHASE1   NO_OS_BIT(4)

◆ ADE7880_OIPHASE2

#define ADE7880_OIPHASE2   NO_OS_BIT(5)

◆ ADE7880_OVPHASE0

#define ADE7880_OVPHASE0   NO_OS_BIT(9)

◆ ADE7880_OVPHASE1

#define ADE7880_OVPHASE1   NO_OS_BIT(10)

◆ ADE7880_OVPHASE2

#define ADE7880_OVPHASE2   NO_OS_BIT(11)

◆ ADE7880_PEAKSEL0

#define ADE7880_PEAKSEL0   NO_OS_BIT(2)

◆ ADE7880_PEAKSEL1

#define ADE7880_PEAKSEL1   NO_OS_BIT(3)

◆ ADE7880_PEAKSEL2

#define ADE7880_PEAKSEL2   NO_OS_BIT(4)

◆ ADE7880_PFMODE

#define ADE7880_PFMODE   NO_OS_BIT(7)

◆ ADE7880_PGA1

#define ADE7880_PGA1   NO_OS_GENMASK(2, 0)

◆ ADE7880_PGA2

#define ADE7880_PGA2   NO_OS_GENMASK(5, 3)

◆ ADE7880_PGA3

#define ADE7880_PGA3   NO_OS_GENMASK(8, 6)

◆ ADE7880_PHCALVAL

#define ADE7880_PHCALVAL   NO_OS_GENMASK(9, 0)

◆ ADE7880_RAM_PROT_VAL1

#define ADE7880_RAM_PROT_VAL1   0xAD

◆ ADE7880_RAM_PROT_VAL2

#define ADE7880_RAM_PROT_VAL2   0x80

◆ ADE7880_RAM_PROTECTION1

#define ADE7880_RAM_PROTECTION1   0xE7FE

◆ ADE7880_RAM_PROTECTION2

#define ADE7880_RAM_PROTECTION2   0xE7E3

◆ ADE7880_REG_ACCMODE

#define ADE7880_REG_ACCMODE   0xE701

◆ ADE7880_REG_AFIRMSOS

#define ADE7880_REG_AFIRMSOS   0x43A8

◆ ADE7880_REG_AFVARHR

#define ADE7880_REG_AFVARHR   0xE409

◆ ADE7880_REG_AFVAROS

#define ADE7880_REG_AFVAROS   0x43A5

◆ ADE7880_REG_AFVRMSOS

#define ADE7880_REG_AFVRMSOS   0x43AB

◆ ADE7880_REG_AFWATTHR

#define ADE7880_REG_AFWATTHR   0xE403

◆ ADE7880_REG_AFWATTOS

#define ADE7880_REG_AFWATTOS   0x43A2

◆ ADE7880_REG_AIGAIN

#define ADE7880_REG_AIGAIN   0x4380

◆ ADE7880_REG_AIMAV

#define ADE7880_REG_AIMAV   0xE504

◆ ADE7880_REG_AIRMS

#define ADE7880_REG_AIRMS   0x43C0

◆ ADE7880_REG_AIRMSOS

#define ADE7880_REG_AIRMSOS   0x438F

◆ ADE7880_REG_ANGLE0

#define ADE7880_REG_ANGLE0   0xE601

◆ ADE7880_REG_ANGLE1

#define ADE7880_REG_ANGLE1   0xE602

◆ ADE7880_REG_ANGLE2

#define ADE7880_REG_ANGLE2   0xE603

◆ ADE7880_REG_APERIOD

#define ADE7880_REG_APERIOD   0xE905

◆ ADE7880_REG_APF

#define ADE7880_REG_APF   0xE902

◆ ADE7880_REG_APGAIN

#define ADE7880_REG_APGAIN   0x4389

◆ ADE7880_REG_APHCAL

#define ADE7880_REG_APHCAL   0xE614

◆ ADE7880_REG_APNOLOAD

#define ADE7880_REG_APNOLOAD   0xE908

◆ ADE7880_REG_AVA

#define ADE7880_REG_AVA   0xE519

◆ ADE7880_REG_AVAHR

#define ADE7880_REG_AVAHR   0xE40C

◆ ADE7880_REG_AVGAIN

#define ADE7880_REG_AVGAIN   0x4381

◆ ADE7880_REG_AVRMS

#define ADE7880_REG_AVRMS   0x43C1

◆ ADE7880_REG_AVRMSOS

#define ADE7880_REG_AVRMSOS   0x4390

◆ ADE7880_REG_AWATT

#define ADE7880_REG_AWATT   0xE513

◆ ADE7880_REG_AWATTHR

#define ADE7880_REG_AWATTHR   0xE400

◆ ADE7880_REG_AWATTOS

#define ADE7880_REG_AWATTOS   0x438A

◆ ADE7880_REG_BFIRMSOS

#define ADE7880_REG_BFIRMSOS   0x43A9

◆ ADE7880_REG_BFVARHR

#define ADE7880_REG_BFVARHR   0xE40A

◆ ADE7880_REG_BFVAROS

#define ADE7880_REG_BFVAROS   0x43A6

◆ ADE7880_REG_BFVRMSOS

#define ADE7880_REG_BFVRMSOS   0x43AC

◆ ADE7880_REG_BFWATTHR

#define ADE7880_REG_BFWATTHR   0xE404

◆ ADE7880_REG_BFWATTOS

#define ADE7880_REG_BFWATTOS   0x43A3

◆ ADE7880_REG_BIGAIN

#define ADE7880_REG_BIGAIN   0x4382

◆ ADE7880_REG_BIMAV

#define ADE7880_REG_BIMAV   0xE505

◆ ADE7880_REG_BIRMS

#define ADE7880_REG_BIRMS   0x43C2

◆ ADE7880_REG_BIRMSOS

#define ADE7880_REG_BIRMSOS   0x4391

◆ ADE7880_REG_BPERIOD

#define ADE7880_REG_BPERIOD   0xE906

◆ ADE7880_REG_BPF

#define ADE7880_REG_BPF   0xE903

◆ ADE7880_REG_BPGAIN

#define ADE7880_REG_BPGAIN   0x438B

◆ ADE7880_REG_BPHCAL

#define ADE7880_REG_BPHCAL   0xE615

◆ ADE7880_REG_BVA

#define ADE7880_REG_BVA   0xE51A

◆ ADE7880_REG_BVAHR

#define ADE7880_REG_BVAHR   0xE40D

◆ ADE7880_REG_BVGAIN

#define ADE7880_REG_BVGAIN   0x4383

◆ ADE7880_REG_BVRMS

#define ADE7880_REG_BVRMS   0x43C3

◆ ADE7880_REG_BVRMSOS

#define ADE7880_REG_BVRMSOS   0x4392

◆ ADE7880_REG_BWATT

#define ADE7880_REG_BWATT   0xE514

◆ ADE7880_REG_BWATTHR

#define ADE7880_REG_BWATTHR   0xE401

◆ ADE7880_REG_BWATTOS

#define ADE7880_REG_BWATTOS   0x438C

◆ ADE7880_REG_CF1DEN

#define ADE7880_REG_CF1DEN   0xE611

◆ ADE7880_REG_CF2DEN

#define ADE7880_REG_CF2DEN   0xE612

◆ ADE7880_REG_CF3DEN

#define ADE7880_REG_CF3DEN   0xE613

◆ ADE7880_REG_CFCYC

#define ADE7880_REG_CFCYC   0xE705

◆ ADE7880_REG_CFIRMSOS

#define ADE7880_REG_CFIRMSOS   0x43AA

◆ ADE7880_REG_CFMODE

#define ADE7880_REG_CFMODE   0xE610

◆ ADE7880_REG_CFVARHR

#define ADE7880_REG_CFVARHR   0xE40B

◆ ADE7880_REG_CFVAROS

#define ADE7880_REG_CFVAROS   0x43A7

◆ ADE7880_REG_CFVRMSOS

#define ADE7880_REG_CFVRMSOS   0x43AD

◆ ADE7880_REG_CFWATTHR

#define ADE7880_REG_CFWATTHR   0xE405

◆ ADE7880_REG_CFWATTOS

#define ADE7880_REG_CFWATTOS   0x43A4

◆ ADE7880_REG_CHECKSUM

#define ADE7880_REG_CHECKSUM   0xE51F

◆ ADE7880_REG_CIGAIN

#define ADE7880_REG_CIGAIN   0x4384

◆ ADE7880_REG_CIMAV

#define ADE7880_REG_CIMAV   0xE506

◆ ADE7880_REG_CIRMS

#define ADE7880_REG_CIRMS   0x43C4

◆ ADE7880_REG_CIRMSOS

#define ADE7880_REG_CIRMSOS   0x4393

◆ ADE7880_REG_COMPMODE

#define ADE7880_REG_COMPMODE   0xE60E

◆ ADE7880_REG_CONFIG

#define ADE7880_REG_CONFIG   0xE618

◆ ADE7880_REG_CONFIG2

#define ADE7880_REG_CONFIG2   0xEC01

◆ ADE7880_REG_CONFIG3

#define ADE7880_REG_CONFIG3   0xEA00

◆ ADE7880_REG_CPERIOD

#define ADE7880_REG_CPERIOD   0xE907

◆ ADE7880_REG_CPF

#define ADE7880_REG_CPF   0xE904

◆ ADE7880_REG_CPGAIN

#define ADE7880_REG_CPGAIN   0x438D

◆ ADE7880_REG_CPHCAL

#define ADE7880_REG_CPHCAL   0xE616

◆ ADE7880_REG_CVA

#define ADE7880_REG_CVA   0xE51B

◆ ADE7880_REG_CVAHR

#define ADE7880_REG_CVAHR   0xE40E

◆ ADE7880_REG_CVGAIN

#define ADE7880_REG_CVGAIN   0x4385

◆ ADE7880_REG_CVRMS

#define ADE7880_REG_CVRMS   0x43C5

◆ ADE7880_REG_CVRMSOS

#define ADE7880_REG_CVRMSOS   0x4394

◆ ADE7880_REG_CWATT

#define ADE7880_REG_CWATT   0xE515

◆ ADE7880_REG_CWATTHR

#define ADE7880_REG_CWATTHR   0xE402

◆ ADE7880_REG_CWATTOS

#define ADE7880_REG_CWATTOS   0x438E

◆ ADE7880_REG_DICOEFF

#define ADE7880_REG_DICOEFF   0x4388

◆ ADE7880_REG_FIRMS

#define ADE7880_REG_FIRMS   0xE881

◆ ADE7880_REG_FPF

#define ADE7880_REG_FPF   0xE885

◆ ADE7880_REG_FVA

#define ADE7880_REG_FVA   0xE884

◆ ADE7880_REG_FVAR

#define ADE7880_REG_FVAR   0xE883

◆ ADE7880_REG_FVRMS

#define ADE7880_REG_FVRMS   0xE880

◆ ADE7880_REG_FWATT

#define ADE7880_REG_FWATT   0xE882

◆ ADE7880_REG_GAIN

#define ADE7880_REG_GAIN   0xE60F

◆ ADE7880_REG_HCONFIG

#define ADE7880_REG_HCONFIG   0xE900

◆ ADE7880_REG_HFVAR

#define ADE7880_REG_HFVAR   0xE893

◆ ADE7880_REG_HPGAIN

#define ADE7880_REG_HPGAIN   0x4398

◆ ADE7880_REG_HSDC_CFG

#define ADE7880_REG_HSDC_CFG   0xE706

◆ ADE7880_REG_HX

#define ADE7880_REG_HX   0xEA08

◆ ADE7880_REG_HXIHD

#define ADE7880_REG_HXIHD   0xE88F

◆ ADE7880_REG_HXIRMS

#define ADE7880_REG_HXIRMS   0xE889

◆ ADE7880_REG_HXIRMSOS

#define ADE7880_REG_HXIRMSOS   0x43B4

◆ ADE7880_REG_HXPF

#define ADE7880_REG_HXPF   0xE88D

◆ ADE7880_REG_HXVA

#define ADE7880_REG_HXVA   0xE88C

◆ ADE7880_REG_HXVAR

#define ADE7880_REG_HXVAR   0xE88B

◆ ADE7880_REG_HXVAROS

#define ADE7880_REG_HXVAROS   0x43B1

◆ ADE7880_REG_HXVHD

#define ADE7880_REG_HXVHD   0xE88E

◆ ADE7880_REG_HXVRMS

#define ADE7880_REG_HXVRMS   0xE888

◆ ADE7880_REG_HXVRMSOS

#define ADE7880_REG_HXVRMSOS   0x43B7

◆ ADE7880_REG_HXWATT

#define ADE7880_REG_HXWATT   0xE88A

◆ ADE7880_REG_HXWATTOS

#define ADE7880_REG_HXWATTOS   0x43AE

◆ ADE7880_REG_HY

#define ADE7880_REG_HY   0xEA09

◆ ADE7880_REG_HYIHD

#define ADE7880_REG_HYIHD   0xE897

◆ ADE7880_REG_HYIRMS

#define ADE7880_REG_HYIRMS   0xE891

◆ ADE7880_REG_HYIRMSOS

#define ADE7880_REG_HYIRMSOS   0x43B5

◆ ADE7880_REG_HYPF

#define ADE7880_REG_HYPF   0xE895

◆ ADE7880_REG_HYVA

#define ADE7880_REG_HYVA   0xE894

◆ ADE7880_REG_HYVAROS

#define ADE7880_REG_HYVAROS   0x43B2

◆ ADE7880_REG_HYVHD

#define ADE7880_REG_HYVHD   0xE896

◆ ADE7880_REG_HYVRMS

#define ADE7880_REG_HYVRMS   0xE890

◆ ADE7880_REG_HYVRMSOS

#define ADE7880_REG_HYVRMSOS   0x43B8

◆ ADE7880_REG_HYWATT

#define ADE7880_REG_HYWATT   0xE892

◆ ADE7880_REG_HYWATTOS

#define ADE7880_REG_HYWATTOS   0x43AF

◆ ADE7880_REG_HZ

#define ADE7880_REG_HZ   0xEA0A

◆ ADE7880_REG_HZIHD

#define ADE7880_REG_HZIHD   0xE89F

◆ ADE7880_REG_HZIRMS

#define ADE7880_REG_HZIRMS   0xE899

◆ ADE7880_REG_HZIRMSOS

#define ADE7880_REG_HZIRMSOS   0x43B6

◆ ADE7880_REG_HZPF

#define ADE7880_REG_HZPF   0xE89D

◆ ADE7880_REG_HZVA

#define ADE7880_REG_HZVA   0xE89C

◆ ADE7880_REG_HZVAR

#define ADE7880_REG_HZVAR   0xE89B

◆ ADE7880_REG_HZVAROS

#define ADE7880_REG_HZVAROS   0x43B3

◆ ADE7880_REG_HZVHD

#define ADE7880_REG_HZVHD   0xE89E

◆ ADE7880_REG_HZVRMS

#define ADE7880_REG_HZVRMS   0xE898

◆ ADE7880_REG_HZVRMSOS

#define ADE7880_REG_HZVRMSOS   0x43B9

◆ ADE7880_REG_HZWATT

#define ADE7880_REG_HZWATT   0xE89A

◆ ADE7880_REG_HZWATTOS

#define ADE7880_REG_HZWATTOS   0x43B0

◆ ADE7880_REG_IAWV

#define ADE7880_REG_IAWV   0xE50C

◆ ADE7880_REG_IBWV

#define ADE7880_REG_IBWV   0xE50D

◆ ADE7880_REG_ICWV

#define ADE7880_REG_ICWV   0xE50E

◆ ADE7880_REG_INWV

#define ADE7880_REG_INWV   0xE50F

◆ ADE7880_REG_IPEAK

#define ADE7880_REG_IPEAK   0xE500

◆ ADE7880_REG_ISUM

#define ADE7880_REG_ISUM   0x43C7

◆ ADE7880_REG_ISUMLVL

#define ADE7880_REG_ISUMLVL   0x4399

◆ ADE7880_REG_ITHD

#define ADE7880_REG_ITHD   0xE887

◆ ADE7880_REG_LAST_ADD

#define ADE7880_REG_LAST_ADD   0xE9FE

◆ ADE7880_REG_LAST_OP

#define ADE7880_REG_LAST_OP   0xEA01

◆ ADE7880_REG_LAST_RWDATA16

#define ADE7880_REG_LAST_RWDATA16   0xE9FF

◆ ADE7880_REG_LAST_RWDATA32

#define ADE7880_REG_LAST_RWDATA32   0xE5FF

◆ ADE7880_REG_LAST_RWDATA8

#define ADE7880_REG_LAST_RWDATA8   0xE7FD

◆ ADE7880_REG_LCYCMODE

#define ADE7880_REG_LCYCMODE   0xE702

◆ ADE7880_REG_LINECYC

#define ADE7880_REG_LINECYC   0xE60C

◆ ADE7880_REG_LPOILVL

#define ADE7880_REG_LPOILVL   0xEC00

◆ ADE7880_REG_MASK0

#define ADE7880_REG_MASK0   0xE50A

◆ ADE7880_REG_MASK1

#define ADE7880_REG_MASK1   0xE50B

◆ ADE7880_REG_MMODE

#define ADE7880_REG_MMODE   0xE700

◆ ADE7880_REG_NIGAIN

#define ADE7880_REG_NIGAIN   0x4386

◆ ADE7880_REG_NIRMS

#define ADE7880_REG_NIRMS   0x43C6

◆ ADE7880_REG_NIRMSOS

#define ADE7880_REG_NIRMSOS   0x4395

◆ ADE7880_REG_OILVL

#define ADE7880_REG_OILVL   0xE507

◆ ADE7880_REG_OVLVL

#define ADE7880_REG_OVLVL   0xE508

◆ ADE7880_REG_PEAKCYC

#define ADE7880_REG_PEAKCYC   0xE703

◆ ADE7880_REG_PHNOLOAD

#define ADE7880_REG_PHNOLOAD   0xE608

◆ ADE7880_REG_PHSIGN

#define ADE7880_REG_PHSIGN   0xE617

◆ ADE7880_REG_PHSTATUS

#define ADE7880_REG_PHSTATUS   0xE600

◆ ADE7880_REG_RESERVED

#define ADE7880_REG_RESERVED   0xE7E4

◆ ADE7880_REG_RUN

#define ADE7880_REG_RUN   0xE228

◆ ADE7880_REG_SAGCYC

#define ADE7880_REG_SAGCYC   0xE704

◆ ADE7880_REG_SAGLVL

#define ADE7880_REG_SAGLVL   0xE509

◆ ADE7880_REG_STATUS0

#define ADE7880_REG_STATUS0   0xE502

◆ ADE7880_REG_STATUS1

#define ADE7880_REG_STATUS1   0xE503

◆ ADE7880_REG_VANOLOAD

#define ADE7880_REG_VANOLOAD   0xE90A

◆ ADE7880_REG_VARNOLOAD

#define ADE7880_REG_VARNOLOAD   0xE909

◆ ADE7880_REG_VARTHR

#define ADE7880_REG_VARTHR   0xEA03

◆ ADE7880_REG_VATHR

#define ADE7880_REG_VATHR   0xEA04

◆ ADE7880_REG_VAWV

#define ADE7880_REG_VAWV   0xE510

◆ ADE7880_REG_VBWV

#define ADE7880_REG_VBWV   0xE511

◆ ADE7880_REG_VCWV

#define ADE7880_REG_VCWV   0xE512

◆ ADE7880_REG_VERSION

#define ADE7880_REG_VERSION   0xE707

◆ ADE7880_REG_VLEVEL

#define ADE7880_REG_VLEVEL   0x439F

◆ ADE7880_REG_VNOM

#define ADE7880_REG_VNOM   0xE520

◆ ADE7880_REG_VPEAK

#define ADE7880_REG_VPEAK   0xE501

◆ ADE7880_REG_VTHD

#define ADE7880_REG_VTHD   0xE886

◆ ADE7880_REG_WTHR

#define ADE7880_REG_WTHR   0xEA02

◆ ADE7880_REG_ZXTOUT

#define ADE7880_REG_ZXTOUT   0xE60D

◆ ADE7880_RESET_RECOVER

#define ADE7880_RESET_RECOVER   100

◆ ADE7880_REVAPSEL

#define ADE7880_REVAPSEL   NO_OS_BIT(6)

◆ ADE7880_RMS_FS_CODES

#define ADE7880_RMS_FS_CODES   5326737

◆ ADE7880_RSTREAD

#define ADE7880_RSTREAD   NO_OS_BIT(6)

◆ ADE7880_RUN_ON

#define ADE7880_RUN_ON   0x0001

◆ ADE7880_SELFREQ

#define ADE7880_SELFREQ   NO_OS_BIT(14)

◆ ADE7880_SET_SPI_ADDR

#define ADE7880_SET_SPI_ADDR   0xEBFF

◆ ADE7880_SPI_READ_CMD

#define ADE7880_SPI_READ_CMD   0x01

◆ ADE7880_SPI_WRITE_CMD

#define ADE7880_SPI_WRITE_CMD   0x00

◆ ADE7880_STATUS0_AEHF

#define ADE7880_STATUS0_AEHF   NO_OS_BIT(0)

◆ ADE7880_STATUS0_CF1

#define ADE7880_STATUS0_CF1   NO_OS_BIT(14)

◆ ADE7880_STATUS0_CF2

#define ADE7880_STATUS0_CF2   NO_OS_BIT(15)

◆ ADE7880_STATUS0_CF3

#define ADE7880_STATUS0_CF3   NO_OS_BIT(16)

◆ ADE7880_STATUS0_DREADY

#define ADE7880_STATUS0_DREADY   NO_OS_BIT(17)

◆ ADE7880_STATUS0_FAEHF

#define ADE7880_STATUS0_FAEHF   NO_OS_BIT(1)

◆ ADE7880_STATUS0_FREHF

#define ADE7880_STATUS0_FREHF   NO_OS_BIT(3)

◆ ADE7880_STATUS0_HREADY

#define ADE7880_STATUS0_HREADY   NO_OS_BIT(19)

◆ ADE7880_STATUS0_LENERGY

#define ADE7880_STATUS0_LENERGY   NO_OS_BIT(5)

◆ ADE7880_STATUS0_REVAPA

#define ADE7880_STATUS0_REVAPA   NO_OS_BIT(6)

◆ ADE7880_STATUS0_REVAPB

#define ADE7880_STATUS0_REVAPB   NO_OS_BIT(7)

◆ ADE7880_STATUS0_REVAPC

#define ADE7880_STATUS0_REVAPC   NO_OS_BIT(8)

◆ ADE7880_STATUS0_REVFRPA

#define ADE7880_STATUS0_REVFRPA   NO_OS_BIT(10)

◆ ADE7880_STATUS0_REVFRPB

#define ADE7880_STATUS0_REVFRPB   NO_OS_BIT(11)

◆ ADE7880_STATUS0_REVFRPC

#define ADE7880_STATUS0_REVFRPC   NO_OS_BIT(12)

◆ ADE7880_STATUS0_REVPSUM1

#define ADE7880_STATUS0_REVPSUM1   NO_OS_BIT(9)

◆ ADE7880_STATUS0_REVPSUM2

#define ADE7880_STATUS0_REVPSUM2   NO_OS_BIT(13)

◆ ADE7880_STATUS0_REVPSUM3

#define ADE7880_STATUS0_REVPSUM3   NO_OS_BIT(18)

◆ ADE7880_STATUS0_VAEHF

#define ADE7880_STATUS0_VAEHF   NO_OS_BIT(4)

◆ ADE7880_STATUS1_CRC

#define ADE7880_STATUS1_CRC   NO_OS_BIT(25)

◆ ADE7880_STATUS1_FNLOAD

#define ADE7880_STATUS1_FNLOAD   NO_OS_BIT(1)

◆ ADE7880_STATUS1_MISMTCH

#define ADE7880_STATUS1_MISMTCH   NO_OS_BIT(20)

◆ ADE7880_STATUS1_NLOAD

#define ADE7880_STATUS1_NLOAD   NO_OS_BIT(0)

◆ ADE7880_STATUS1_OI

#define ADE7880_STATUS1_OI   NO_OS_BIT(17)

◆ ADE7880_STATUS1_OV

#define ADE7880_STATUS1_OV   NO_OS_BIT(18)

◆ ADE7880_STATUS1_PKI

#define ADE7880_STATUS1_PKI   NO_OS_BIT(23)

◆ ADE7880_STATUS1_PKV

#define ADE7880_STATUS1_PKV   NO_OS_BIT(24)

◆ ADE7880_STATUS1_RSTDONE

#define ADE7880_STATUS1_RSTDONE   NO_OS_BIT(15)

◆ ADE7880_STATUS1_SAG

#define ADE7880_STATUS1_SAG   NO_OS_BIT(16)

◆ ADE7880_STATUS1_SEQERR

#define ADE7880_STATUS1_SEQERR   NO_OS_BIT(19)

◆ ADE7880_STATUS1_VANLOAD

#define ADE7880_STATUS1_VANLOAD   NO_OS_BIT(2)

◆ ADE7880_STATUS1_ZXIA

#define ADE7880_STATUS1_ZXIA   NO_OS_BIT(12)

◆ ADE7880_STATUS1_ZXIB

#define ADE7880_STATUS1_ZXIB   NO_OS_BIT(13)

◆ ADE7880_STATUS1_ZXIC

#define ADE7880_STATUS1_ZXIC   NO_OS_BIT(14)

◆ ADE7880_STATUS1_ZXTOIA

#define ADE7880_STATUS1_ZXTOIA   NO_OS_BIT(6)

◆ ADE7880_STATUS1_ZXTOIB

#define ADE7880_STATUS1_ZXTOIB   NO_OS_BIT(7)

◆ ADE7880_STATUS1_ZXTOIC

#define ADE7880_STATUS1_ZXTOIC   NO_OS_BIT(8)

◆ ADE7880_STATUS1_ZXTOVA

#define ADE7880_STATUS1_ZXTOVA   NO_OS_BIT(3)

◆ ADE7880_STATUS1_ZXTOVB

#define ADE7880_STATUS1_ZXTOVB   NO_OS_BIT(4)

◆ ADE7880_STATUS1_ZXTOVC

#define ADE7880_STATUS1_ZXTOVC   NO_OS_BIT(5)

◆ ADE7880_STATUS1_ZXVA

#define ADE7880_STATUS1_ZXVA   NO_OS_BIT(9)

◆ ADE7880_STATUS1_ZXVB

#define ADE7880_STATUS1_ZXVB   NO_OS_BIT(10)

◆ ADE7880_STATUS1_ZXVC

#define ADE7880_STATUS1_ZXVC   NO_OS_BIT(11)

◆ ADE7880_SUM1SIGN

#define ADE7880_SUM1SIGN   NO_OS_BIT(3)

◆ ADE7880_SUM2SIGN

#define ADE7880_SUM2SIGN   NO_OS_BIT(7)

◆ ADE7880_SUM3SIGN

#define ADE7880_SUM3SIGN   NO_OS_BIT(8)

◆ ADE7880_SWAP

#define ADE7880_SWAP   NO_OS_BIT(3)

◆ ADE7880_SWRST

#define ADE7880_SWRST   NO_OS_BIT(7)

◆ ADE7880_TERMSEL1_0

#define ADE7880_TERMSEL1_0   NO_OS_BIT(0)

◆ ADE7880_TERMSEL1_1

#define ADE7880_TERMSEL1_1   NO_OS_BIT(1)

◆ ADE7880_TERMSEL1_2

#define ADE7880_TERMSEL1_2   NO_OS_BIT(2)

◆ ADE7880_TERMSEL2_0

#define ADE7880_TERMSEL2_0   NO_OS_BIT(3)

◆ ADE7880_TERMSEL2_1

#define ADE7880_TERMSEL2_1   NO_OS_BIT(4)

◆ ADE7880_TERMSEL2_2

#define ADE7880_TERMSEL2_2   NO_OS_BIT(5)

◆ ADE7880_TERMSEL3_0

#define ADE7880_TERMSEL3_0   NO_OS_BIT(6)

◆ ADE7880_TERMSEL3_1

#define ADE7880_TERMSEL3_1   NO_OS_BIT(7)

◆ ADE7880_TERMSEL3_2

#define ADE7880_TERMSEL3_2   NO_OS_BIT(8)

◆ ADE7880_UP_RES

#define ADE7880_UP_RES   1000000

◆ ADE7880_VANLPHASE0

#define ADE7880_VANLPHASE0   NO_OS_BIT(6)

◆ ADE7880_VANLPHASE1

#define ADE7880_VANLPHASE1   NO_OS_BIT(7)

◆ ADE7880_VANLPHASE2

#define ADE7880_VANLPHASE2   NO_OS_BIT(8)

◆ ADE7880_VARACC

#define ADE7880_VARACC   NO_OS_GENMASK(3, 2)

◆ ADE7880_VLEVEL_VAL

#define ADE7880_VLEVEL_VAL   0x007A1200

◆ ADE7880_VNOMAEN

#define ADE7880_VNOMAEN   NO_OS_BIT(11)

◆ ADE7880_VNOMBEN

#define ADE7880_VNOMBEN   NO_OS_BIT(12)

◆ ADE7880_VNOMCEN

#define ADE7880_VNOMCEN   NO_OS_BIT(13)

◆ ADE7880_VOLTAGE_TR_FCN

#define ADE7880_VOLTAGE_TR_FCN   ((ADE7880_DOWN_RES + ADE7880_UP_RES) / ADE7880_DOWN_RES)

◆ ADE7880_VPEAKVAL

#define ADE7880_VPEAKVAL   NO_OS_GENMASK(23, 0)

◆ ADE7880_VPPHASE0

#define ADE7880_VPPHASE0   NO_OS_BIT(24)

◆ ADE7880_VPPHASE1

#define ADE7880_VPPHASE1   NO_OS_BIT(25)

◆ ADE7880_VPPHASE2

#define ADE7880_VPPHASE2   NO_OS_BIT(26)

◆ ADE7880_VSPHASE0

#define ADE7880_VSPHASE0   NO_OS_BIT(12)

◆ ADE7880_VSPHASE1

#define ADE7880_VSPHASE1   NO_OS_BIT(13)

◆ ADE7880_VSPHASE2

#define ADE7880_VSPHASE2   NO_OS_BIT(14)

◆ ADE7880_VTOIA

#define ADE7880_VTOIA   NO_OS_GENMASK(9, 8)

◆ ADE7880_VTOIB

#define ADE7880_VTOIB   NO_OS_GENMASK(11, 10)

◆ ADE7880_VTOIC

#define ADE7880_VTOIC   NO_OS_GENMASK(13, 12)

◆ ADE7880_WATTACC

#define ADE7880_WATTACC   NO_OS_GENMASK(1, 0)

◆ ADE7880_ZXSEL0

#define ADE7880_ZXSEL0   NO_OS_BIT(3)

◆ ADE7880_ZXSEL1

#define ADE7880_ZXSEL1   NO_OS_BIT(4)

◆ ADE7880_ZXSEL2

#define ADE7880_ZXSEL2   NO_OS_BIT(5)

◆ DISABLE

#define DISABLE   0x0000

◆ ENABLE

#define ENABLE   0x0001

Enumeration Type Documentation

◆ ade7880_actphsel_e

ADE7880 These bits select the phase voltage used as time base for harmonic calculations.

Enumerator
ADE7880_ACTPHSEL_A 
ADE7880_ACTPHSEL_B 
ADE7880_ACTPHSEL_C 
ADE7880_ACTPHSEL_RESERVED 

◆ ade7880_anglesel_e

ADE7880 angles measurement.

Enumerator
ADE7880_ANGLESEL_V_I 
ADE7880_ANGLESEL_V 
ADE7880_ANGLESEL_I 
ADE7880_NO_ANGLESEL 

◆ ade7880_cfxsel_e

ADE7880 These bits indicate the value the CFx frequency is proportional to.

Enumerator
ADE7880_CFXSEL_0 
ADE7880_CFXSEL_1 
ADE7880_CFXSEL_2 
ADE7880_CFXSEL_3 

◆ ade7880_consel_e

ADE7880 These bits select the inputs to the energy accumulation registers. IA’, IB’, and IC’ are IA, IB, and IC shifted respectively by −90°

Enumerator
ADE7880_CONSEL_3P_3W 
ADE7880_CONSEL_3P_3W_DELTA 
ADE7880_CONSEL_3P_4W 
ADE7880_CONSEL_3P_4W_DELTA 

◆ ade7880_freq_sel_e

ADE7880 Freq value.

Enumerator
ADE7880_SELFREQ_50 
ADE7880_SELFREQ_60 

◆ ade7880_hphase_e

ADE7880 These bits decide what phase or neutral is analyzed by the harmonic calculations block.

Enumerator
ADE7880_HPHASE_A 
ADE7880_HPHASE_B 
ADE7880_HPHASE_C 
ADE7880_HPHASE_N 

◆ ade7880_hrate_e

ADE7880 These bits manage the update rate of the harmonic registers.

Enumerator
ADE7880_HRATE_8K 
ADE7880_HRATE_4K 
ADE7880_HRATE_1K 
ADE7880_HRATE_62_5 
ADE7880_HRATE_7_8125 
ADE7880_HRATE_1_953125 
ADE7880_HRATE_0_9765625 
ADE7880_HRATE_DISABLED 

◆ ade7880_hstime_e

ADE7880 These bits decide the delay period after which, if HRCFG bit is set to 0, Bit 19 (HREADY) in the STATUS0 register is set to 1.

Enumerator
ADE7880_HSTIM_500 
ADE7880_HSTIM_700 
ADE7880_HSTIM_1000 
ADE7880_HSTIM_1250 

◆ ade7880_hxfer_e

ADE7880 These bits select the data transmitted on HSDC.

Enumerator
ADE7880_HXFER_16 
ADE7880_HXFER_7 
ADE7880_HXFER_9 
ADE7880_HXFER_RESERVED 

◆ ade7880_pga_gain_e

ADE7880 phase currents/neutral current/phase voltages gain selection is currently being used.

Enumerator
ADE7880_PGAGAIN_1 
ADE7880_PGAGAIN_2 
ADE7880_PGAGAIN_4 
ADE7880_PGAGAIN_8 
ADE7880_PGAGAIN_16 

◆ ade7880_phase

ADE7880 available phases.

Enumerator
ADE7880_PHASE_A 
ADE7880_PHASE_B 
ADE7880_PHASE_C 

◆ ade7880_power_mode_e

ADE7880 Power mode selection.

Enumerator
NORMAL_MODE 
REDUCED_POWER_MODE 
LOW_POWER_MODE 
SLEEP_MODE 

◆ ade7880_varacc_e

ADE7880 These bits decide the accumulation mode of funamental reactive powers.

Enumerator
ADE7880_VARACC_SIGNED_ACC 
ADE7880_VARACC_RESERVED 
ADE7880_VARACC_SIGN_WATTACC 
ADE7880_VARACC_ABSOLUTE_ACC 

◆ ade7880_vtoia_e

ADE7880 These bits decide what phase voltage is considered together with Phase A current in the power path.

Enumerator
ADE7880_VTOIA_A 
ADE7880_VTOIA_B 
ADE7880_VTOIA_C 

◆ ade7880_vtoib_e

ADE7880 These bits decide what phase voltage is considered together with Phase B current in the power path.

Enumerator
ADE7880_VTOIB_B 
ADE7880_VTOIB_C 
ADE7880_VTOIB_A 

◆ ade7880_vtoic_e

ADE7880 These bits decide what phase voltage is considered together with Phase C current in the power path.

Enumerator
ADE7880_VTOIC_C 
ADE7880_VTOIC_A 
ADE7880_VTOIC_B 

◆ ade7880_wattacc_e

ADE7880 These bits decide the accumulation mode of fundamental active powers.

Enumerator
ADE7880_WATTACC_SIGNED_ACC 
ADE7880_WATTACC_POSITIVE_ACC 
ADE7880_WATTACC_RESERVED 
ADE7880_WATTACC_ABSOLUTE_ACC 

Function Documentation

◆ ade7880_get_int_status0()

int ade7880_get_int_status0 ( struct ade7880_dev dev,
uint32_t  msk,
uint8_t *  status 
)

Get interrupt indicator from STATUS0 register.

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

◆ ade7880_init()

int ade7880_init ( struct ade7880_dev **  device,
struct ade7880_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.
Here is the caller graph for this function:

◆ ade7880_read()

int ade7880_read ( struct ade7880_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 the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ade7880_read_data_ph()

int ade7880_read_data_ph ( struct ade7880_dev dev,
enum ade7880_phase  phase 
)

Read the power/energy for specific phase.

Parameters
dev- The device structure.
phase- ADE7880 Phase.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ade7880_remove()

int ade7880_remove ( struct ade7880_dev dev)

Remove the device and release resources.

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

◆ ade7880_set_power_mode()

int ade7880_set_power_mode ( struct ade7880_dev dev)

Set power mode.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ade7880_setup()

int ade7880_setup ( struct ade7880_dev dev)

Setup the device.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ade7880_update_bits()

int ade7880_update_bits ( struct ade7880_dev dev,
uint16_t  reg_addr,
uint32_t  mask,
uint32_t  reg_data 
)

Update specific register bits.

Parameters
dev- The device structure.
reg_addr- The register address.
mask- Specific bits mask.
reg_data- The data to be written.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ade7880_write()

int ade7880_write ( struct ade7880_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.
Here is the caller graph for this function: