no-OS
Functions
ade9153a.c File Reference

Implementation of ADE9153A Driver. More...

#include "ade9153a.h"
#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.c:

Functions

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

Detailed Description

Implementation 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.

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.

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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.

◆ NO_OS_DECLARE_CRC16_TABLE()

NO_OS_DECLARE_CRC16_TABLE ( ade9153a_crc16  )