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

Implementation of ADE9153A Driver. More...

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

Detailed Description

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.

SPDX-License-Identifier: BSD-3-Clause

Function Documentation

◆ ade9153a_ai_gain()

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

Set the PGA gain for I chA.

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

◆ ade9153a_ai_swap()

int ade9153a_ai_swap ( struct ade9153a_dev * dev,
uint8_t set )

Set the signal side of the PGA.

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

◆ ade9153a_auto_calibration_cfg()

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

Auto calibration config.

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

◆ ade9153a_auto_calibration_run()

int ade9153a_auto_calibration_run ( struct ade9153a_dev * dev)

Auto calibration run.

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

◆ ade9153a_auto_calibration_stop()

int ade9153a_auto_calibration_stop ( struct ade9153a_dev * dev)

Auto calibration stop.

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

◆ ade9153a_avarsign_status()

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

Sign of reactive power.

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

◆ ade9153a_awsign_status()

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

Sign of active power.

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

◆ ade9153a_bi_pgagain_set()

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

Set PGA gain for current channel B.

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

◆ ade9153a_burst_en()

int ade9153a_burst_en ( struct ade9153a_dev * dev)

Burst read enable/disable.

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

◆ ade9153a_cf1_lt_status()

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

CF1_LT status.

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

◆ ade9153a_cf1dis()

int ade9153a_cf1dis ( struct ade9153a_dev * dev)

CF1 output disable.

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

◆ ade9153a_cf1sel()

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

Set type of energy output on CF1 pin.

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

◆ ade9153a_cf1sign_status()

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

Sign of CF1 power.

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

◆ ade9153a_cf2_lt_status()

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

CF2_LT status.

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

◆ ade9153a_cf2dis()

int ade9153a_cf2dis ( struct ade9153a_dev * dev)

CF2 output disable.

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

◆ ade9153a_cf2sel()

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

Set type of energy output on CF2 pin.

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

◆ ade9153a_cf2sign_status()

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

Sign of CF2 power.

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

◆ ade9153a_cf_acc_clr()

int ade9153a_cf_acc_clr ( struct ade9153a_dev * dev)

Clear accumulation in the digital freq conv.

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

◆ ade9153a_cf_ltmr_val()

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

cf_ltmr read value.

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

◆ ade9153a_cf_ltmr_write()

int ade9153a_cf_ltmr_write ( struct ade9153a_dev * dev,
uint32_t reg_data )

cf_ltmr write value.

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

◆ ade9153a_chip_status()

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

Chip status.

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

◆ ade9153a_clear_apa_chg_sgn()

int ade9153a_clear_apa_chg_sgn ( struct ade9153a_dev * dev)

Clear APA (active power) sign change int mask.

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

◆ ade9153a_clear_cf1()

int ade9153a_clear_cf1 ( struct ade9153a_dev * dev)

Clear CF1 pulse issued int mask.

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

◆ ade9153a_clear_cf1_chg()

int ade9153a_clear_cf1_chg ( struct ade9153a_dev * dev)

Clear CF1 polarity change int mask.

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

◆ ade9153a_clear_cf2()

int ade9153a_clear_cf2 ( struct ade9153a_dev * dev)

Clear CF2 pulse issued int mask.

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

◆ ade9153a_clear_cf2_chg()

int ade9153a_clear_cf2_chg ( struct ade9153a_dev * dev)

Clear CF2 polarity change int mask.

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

◆ ade9153a_clear_chip_stat()

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

Clear chip status int.

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

◆ ade9153a_clear_crc_chg()

int ade9153a_clear_crc_chg ( struct ade9153a_dev * dev)

Clear CRC change int mask.

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

◆ ade9153a_clear_crc_done()

int ade9153a_clear_crc_done ( struct ade9153a_dev * dev)

Clear CRC done int mask.

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

◆ ade9153a_clear_dready()

int ade9153a_clear_dready ( struct ade9153a_dev * dev)

Clear new waveform samples ready int mask.

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

◆ ade9153a_clear_egyrdy()

int ade9153a_clear_egyrdy ( struct ade9153a_dev * dev)

Clear power values egy ready int mask.

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

◆ ade9153a_clear_event_stat()

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

Clear event status int.

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

◆ ade9153a_clear_fvarnl()

int ade9153a_clear_fvarnl ( struct ade9153a_dev * dev)

Clear fundamental reactive energy no load condition int mask.

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

◆ ade9153a_clear_ms_stat()

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

Clear MS status int.

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

◆ ade9153a_clear_pf_rdy()

int ade9153a_clear_pf_rdy ( struct ade9153a_dev * dev)

Clear PF ready int mask.

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

◆ ade9153a_clear_pwrrdy()

int ade9153a_clear_pwrrdy ( struct ade9153a_dev * dev)

Clear power values registers update int mask.

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

◆ ade9153a_clear_rms_oc_rdy()

int ade9153a_clear_rms_oc_rdy ( struct ade9153a_dev * dev)

Clear RMS_OC values update int mask.

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

◆ ade9153a_clear_rpa_chg_sgn()

int ade9153a_clear_rpa_chg_sgn ( struct ade9153a_dev * dev)

Clear RPA (reactive power) sign change int mask.

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

◆ ade9153a_clear_rstdone()

int ade9153a_clear_rstdone ( struct ade9153a_dev * dev)

Clear reset done int mask.

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

◆ ade9153a_clear_temp_rdy()

int ade9153a_clear_temp_rdy ( struct ade9153a_dev * dev)

Clear new temperature reading ready int mask.

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

◆ ade9153a_clear_vanl()

int ade9153a_clear_vanl ( struct ade9153a_dev * dev)

Clear total apparent energy no load condition int mask.

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

◆ ade9153a_clear_wattnl()

int ade9153a_clear_wattnl ( struct ade9153a_dev * dev)

Clear total active energy no load condition int mask.

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

◆ ade9153a_clear_zxai()

int ade9153a_clear_zxai ( struct ade9153a_dev * dev)

Clear zero crossing detect on I ch A int mask.

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

◆ ade9153a_clear_zxav()

int ade9153a_clear_zxav ( struct ade9153a_dev * dev)

Clear zero crossing detect on V ch int mask.

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

◆ ade9153a_clear_zxbi()

int ade9153a_clear_zxbi ( struct ade9153a_dev * dev)

Clear zero crossing detect on I ch B int mask.

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

◆ ade9153a_clear_zxtoav()

int ade9153a_clear_zxtoav ( struct ade9153a_dev * dev)

Clear zero crossing timout on V ch int mask.

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

◆ ade9153a_compmode()

int ade9153a_compmode ( struct ade9153a_dev * dev)

COMPMODE.

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

◆ ade9153a_control_interrupt()

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

Enable/disable interrupt.

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

◆ ade9153a_dip_swell_irq_mode()

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

Dip swell interrupt mode.

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

◆ ade9153a_dipa_val()

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

Voltage value during dip condition.

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

◆ ade9153a_disable_cf1_int()

int ade9153a_disable_cf1_int ( struct ade9153a_dev * dev)

Disable CF1 interrupt.

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

◆ ade9153a_disable_cf2_int()

int ade9153a_disable_cf2_int ( struct ade9153a_dev * dev)

Disable CF2 interrupt.

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

◆ ade9153a_disable_chip_stat_int()

int ade9153a_disable_chip_stat_int ( struct ade9153a_dev * dev)

Disable CHIP_STAT interrupt.

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

◆ ade9153a_disable_crc_chg_int()

int ade9153a_disable_crc_chg_int ( struct ade9153a_dev * dev)

Disable crc change interrupt.

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

◆ ade9153a_disable_crc_done_int()

int ade9153a_disable_crc_done_int ( struct ade9153a_dev * dev)

Disable crc done interrupt.

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

◆ ade9153a_disable_dready_int()

int ade9153a_disable_dready_int ( struct ade9153a_dev * dev)

Disable data ready interrupt.

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

◆ ade9153a_disable_egyrdy_int()

int ade9153a_disable_egyrdy_int ( struct ade9153a_dev * dev)

Disable EGYRDY interrupt.

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

◆ ade9153a_disable_event_stat_int()

int ade9153a_disable_event_stat_int ( struct ade9153a_dev * dev)

Disable EVENT_STAT interrupt.

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

◆ ade9153a_disable_fvarnl_int()

int ade9153a_disable_fvarnl_int ( struct ade9153a_dev * dev)

Disable fundamental reactive energy no load condition interrupt.

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

◆ ade9153a_disable_ms_stat_int()

int ade9153a_disable_ms_stat_int ( struct ade9153a_dev * dev)

Disable MS_STAT interrupt.

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

◆ ade9153a_disable_pf_rdy_int()

int ade9153a_disable_pf_rdy_int ( struct ade9153a_dev * dev)

Disable pf ready interrupt.

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

◆ ade9153a_disable_pwrrdy_int()

int ade9153a_disable_pwrrdy_int ( struct ade9153a_dev * dev)

Disable PWRRDY interrupt.

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

◆ ade9153a_disable_revapa_int()

int ade9153a_disable_revapa_int ( struct ade9153a_dev * dev)

Disable Phase A total active power changed sign interrupt.

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

◆ ade9153a_disable_revpcf1_int()

int ade9153a_disable_revpcf1_int ( struct ade9153a_dev * dev)

Disable CF1 polarity change sign interrupt.

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

◆ ade9153a_disable_revpcf2_int()

int ade9153a_disable_revpcf2_int ( struct ade9153a_dev * dev)

Disable CF2 polarity change sign interrupt.

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

◆ ade9153a_disable_revrpa_int()

int ade9153a_disable_revrpa_int ( struct ade9153a_dev * dev)

Disable Phase A fundamental reactive power changed sign interrupt.

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

◆ ade9153a_disable_rms_oc_rdy_int()

int ade9153a_disable_rms_oc_rdy_int ( struct ade9153a_dev * dev)

Disable RMS_OC values update interrupt.

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

◆ ade9153a_disable_temp_rdy_int()

int ade9153a_disable_temp_rdy_int ( struct ade9153a_dev * dev)

Disable new temperature reading interrupt.

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

◆ ade9153a_disable_vanl_int()

int ade9153a_disable_vanl_int ( struct ade9153a_dev * dev)

Disable total apparent energy no load condition interrupt.

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

◆ ade9153a_disable_wattnl_int()

int ade9153a_disable_wattnl_int ( struct ade9153a_dev * dev)

Disable total active energy no load condition interrupt.

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

◆ ade9153a_disable_zxai_int()

int ade9153a_disable_zxai_int ( struct ade9153a_dev * dev)

Disable zero corssing detected on I ch A interrupt.

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

◆ ade9153a_disable_zxav_int()

int ade9153a_disable_zxav_int ( struct ade9153a_dev * dev)

Disable zero corssing detected on V ch interrupt.

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

◆ ade9153a_disable_zxbi_int()

int ade9153a_disable_zxbi_int ( struct ade9153a_dev * dev)

Disable zero corssing detected on I ch B interrupt.

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

◆ ade9153a_disable_zxtoav_int()

int ade9153a_disable_zxtoav_int ( struct ade9153a_dev * dev)

Disable zero corssing timeout on voltage ch interrupt.

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

◆ ade9153a_diszxlpf()

int ade9153a_diszxlpf ( struct ade9153a_dev * dev)

Zero crossing lpf disable.

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

◆ ade9153a_dready_oe()

int ade9153a_dready_oe ( struct ade9153a_dev * dev)

DREADY driven to CF2 pin.

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

◆ ade9153a_egy_ld_accum()

int ade9153a_egy_ld_accum ( struct ade9153a_dev * dev,
uint8_t en )

Internal energy register accum.

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

◆ ade9153a_egy_pwr_en()

int ade9153a_egy_pwr_en ( struct ade9153a_dev * dev)

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

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

◆ ade9153a_egy_tmr_mode()

int ade9153a_egy_tmr_mode ( struct ade9153a_dev * dev,
uint8_t en )

Energy accumulated based on the number of 4 kSPS samples or zero-crossing events.

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

◆ ade9153a_enable_cf1_int()

int ade9153a_enable_cf1_int ( struct ade9153a_dev * dev)

Enable CF1 interrupt.

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

◆ ade9153a_enable_cf2_int()

int ade9153a_enable_cf2_int ( struct ade9153a_dev * dev)

Enable CF2 interrupt.

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

◆ ade9153a_enable_chip_stat_int()

int ade9153a_enable_chip_stat_int ( struct ade9153a_dev * dev)

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

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

◆ ade9153a_enable_crc_chg_int()

int ade9153a_enable_crc_chg_int ( struct ade9153a_dev * dev)

Enable crc change interrupt.

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

◆ ade9153a_enable_crc_done_int()

int ade9153a_enable_crc_done_int ( struct ade9153a_dev * dev)

Enable crc done interrupt.

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

◆ ade9153a_enable_dready_int()

int ade9153a_enable_dready_int ( struct ade9153a_dev * dev)

Enable data ready interrupt.

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

◆ ade9153a_enable_egyrdy_int()

int ade9153a_enable_egyrdy_int ( struct ade9153a_dev * dev)

Enable EGYRDY interrupt.

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

◆ ade9153a_enable_event_stat_int()

int ade9153a_enable_event_stat_int ( struct ade9153a_dev * dev)

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

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

◆ ade9153a_enable_fvarnl_int()

int ade9153a_enable_fvarnl_int ( struct ade9153a_dev * dev)

Enable fundamental reactive energy no load condition interrupt.

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

◆ ade9153a_enable_ms_stat_int()

int ade9153a_enable_ms_stat_int ( struct ade9153a_dev * dev)

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

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

◆ ade9153a_enable_pf_rdy_int()

int ade9153a_enable_pf_rdy_int ( struct ade9153a_dev * dev)

Enable pf ready interrupt.

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

◆ ade9153a_enable_pwrrdy_int()

int ade9153a_enable_pwrrdy_int ( struct ade9153a_dev * dev)

Enable PWRRDY interrupt.

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

◆ ade9153a_enable_revapa_int()

int ade9153a_enable_revapa_int ( struct ade9153a_dev * dev)

Enable Phase A total active power changed sign interrupt.

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

◆ ade9153a_enable_revpcf1_int()

int ade9153a_enable_revpcf1_int ( struct ade9153a_dev * dev)

Enable CF1 polarity change sign interrupt.

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

◆ ade9153a_enable_revpcf2_int()

int ade9153a_enable_revpcf2_int ( struct ade9153a_dev * dev)

Enable CF2 polarity change sign interrupt.

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

◆ ade9153a_enable_revrpa_int()

int ade9153a_enable_revrpa_int ( struct ade9153a_dev * dev)

Enable Phase A fundamental reactive power changed sign interrupt.

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

◆ ade9153a_enable_rms_oc_rdy_int()

int ade9153a_enable_rms_oc_rdy_int ( struct ade9153a_dev * dev)

Enable RMS_OC values update interrupt.

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

◆ ade9153a_enable_temp_rdy_int()

int ade9153a_enable_temp_rdy_int ( struct ade9153a_dev * dev)

Enable new temperature reading interrupt.

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

◆ ade9153a_enable_vanl_int()

int ade9153a_enable_vanl_int ( struct ade9153a_dev * dev)

Enable total apparent energy no load condition interrupt.

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

◆ ade9153a_enable_wattnl_int()

int ade9153a_enable_wattnl_int ( struct ade9153a_dev * dev)

Enable total active energy no load condition interrupt.

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

◆ ade9153a_enable_zxai_int()

int ade9153a_enable_zxai_int ( struct ade9153a_dev * dev)

Enable zero corssing detected on I ch A interrupt.

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

◆ ade9153a_enable_zxav_int()

int ade9153a_enable_zxav_int ( struct ade9153a_dev * dev)

Enable zero corssing detected on V ch interrupt.

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

◆ ade9153a_enable_zxbi_int()

int ade9153a_enable_zxbi_int ( struct ade9153a_dev * dev)

Enable zero corssing detected on I ch B interrupt.

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

◆ ade9153a_enable_zxtoav_int()

int ade9153a_enable_zxtoav_int ( struct ade9153a_dev * dev)

Enable zero corssing timeout on voltage ch interrupt.

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

◆ ade9153a_energy_vals()

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

Read energy values.

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

◆ ade9153a_ext_ref()

int ade9153a_ext_ref ( struct ade9153a_dev * dev,
uint8_t en )

External voltage reference enable/disable.

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

◆ ade9153a_ext_ref_status()

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

External_reference status.

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

◆ ade9153a_force_crc_update()

int ade9153a_force_crc_update ( struct ade9153a_dev * dev)

Force CRC calculation to start (update).

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

◆ ade9153a_freq_s_status()

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

Frequency setting.

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

◆ ade9153a_get_apa_chg_sgn()

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

Get APA (active power) sign change indicator.

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

◆ ade9153a_get_cf1()

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

Get CF1 pulse issued indicator.

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

◆ ade9153a_get_cf1_chg()

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

Get CF1 polarity change indicator.

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

◆ ade9153a_get_cf2()

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

Get CF2 pulse issued indicator.

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

◆ ade9153a_get_cf2_chg()

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

Get CF2 polarity change indicator.

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

◆ ade9153a_get_chip_stat()

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

Get chip status indicator.

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

◆ ade9153a_get_crc_chg()

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

Get CRC change indicator.

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

◆ ade9153a_get_crc_done()

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

Get CRC done indicator.

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

◆ ade9153a_get_dready()

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

Get new waveform samples ready indicator.

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

◆ ade9153a_get_egyrdy()

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

Get power values egy ready indicator.

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

◆ ade9153a_get_event_stat()

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

Get event status indicator.

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

◆ ade9153a_get_fvarnl()

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

Get fundamental reactive energy no load condition indicator.

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

◆ ade9153a_get_int_status()

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

Get interrupt indicator from STATUS register.

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

◆ ade9153a_get_ms_stat()

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

Get MS status indicator.

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

◆ ade9153a_get_pf_rdy()

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

Get PF ready indicator.

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

◆ ade9153a_get_phnoload_status()

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

Get phnoload status.

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

◆ ade9153a_get_pwrrdy()

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

Get power values registers update indicator.

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

◆ ade9153a_get_rms_oc_rdy()

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

Get RMS_OC values update indicator.

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

◆ ade9153a_get_rpa_chg_sgn()

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

Get RPA (reactive power) sign change indicator.

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

◆ ade9153a_get_rstdone()

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

Get reset done indicator.

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

◆ ade9153a_get_temp_rdy()

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

Get new temperature reading ready indicator.

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

◆ ade9153a_get_vanl()

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

Get total apparent energy no load condition indicator.

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

◆ ade9153a_get_wattnl()

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

Get total active energy no load condition indicator.

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

◆ ade9153a_get_zxai()

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

Get zero crossing detect on I ch A indicator.

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

◆ ade9153a_get_zxav()

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

Get zero crossing detect on V ch indicator.

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

◆ ade9153a_get_zxbi()

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

Get zero crossing detect on I ch B indicator.

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

◆ ade9153a_get_zxtoav()

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

Get zero crossing timout on V ch indicator.

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

◆ ade9153a_half_rms_vals()

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

Read half rms values.

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

◆ ade9153a_hpf_crn()

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

Hpf corner freq.

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

◆ ade9153a_hpf_disable()

int ade9153a_hpf_disable ( struct ade9153a_dev * dev)

Disable hpf for all channels.

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

◆ ade9153a_hw_reset()

int ade9153a_hw_reset ( struct ade9153a_dev * dev)

Reset the device using HW reset.

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

◆ ade9153a_i_ch_b_int_enable()

int ade9153a_i_ch_b_int_enable ( struct ade9153a_dev * dev)

Current channel B integrator enable.

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

◆ ade9153a_init()

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

Initialize the device.

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

◆ ade9153a_ip_phase()

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

Ipeak channel phase.

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

◆ ade9153a_ipk_val()

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

Ipeak val.

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

◆ ade9153a_lpf_ap_disable()

int ade9153a_lpf_ap_disable ( struct ade9153a_dev * dev)

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

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

◆ ade9153a_lpf_rp_disable()

int ade9153a_lpf_rp_disable ( struct ade9153a_dev * dev)

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

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

◆ ade9153a_ms_absent()

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

mSure not detected on the last enabled ch

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

◆ ade9153a_ms_conferr()

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

Invalid config of mSure status.

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

◆ ade9153a_ms_ready()

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

mSure ready

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

◆ ade9153a_ms_shift()

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

mSure shift detected in CC val

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

◆ ade9153a_ms_sysrdy()

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

New run of mSure ready.

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

◆ ade9153a_ms_timeout()

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

mSure timed out (600s)

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

◆ ade9153a_msure_status()

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

mSure status

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

◆ ade9153a_noload_tmr()

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

Set no. of samples for no load condition.

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

◆ ade9153a_oi_lvl_val()

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

Overcurrent detection threshold level val.

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

◆ ade9153a_oia_en()

int ade9153a_oia_en ( struct ade9153a_dev * dev)

Ch A overcurretn detection enable.

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

◆ ade9153a_oia_val()

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

Ch A overcurrent val.

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

◆ ade9153a_oib_en()

int ade9153a_oib_en ( struct ade9153a_dev * dev)

Ch B overcurretn detection enable.

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

◆ ade9153a_oib_val()

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

Ch B overcurrent val.

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

◆ ade9153a_peak_sel()

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

Select peak detection channels.

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

◆ ade9153a_power_quality_vals()

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

Read power quaility values.

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

◆ ade9153a_power_vals()

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

Read power values.

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

◆ ade9153a_pwr_settle_set()

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

Set PWR_SETTLE.

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

◆ ade9153a_rd_rst_en()

int ade9153a_rd_rst_en ( struct ade9153a_dev * dev)

Energy register read with value reset.

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

◆ ade9153a_read()

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

Read device register.

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

◆ ade9153a_read_autocal_vals()

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

Read autocalibration values.

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

◆ ade9153a_remove()

int ade9153a_remove ( struct ade9153a_dev * dev)

Remove the device and release resources.

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

◆ ade9153a_rms_oc_src_adc_samples_enable()

int ade9153a_rms_oc_src_adc_samples_enable ( struct ade9153a_dev * dev)

Use ADC samples, before the high-pass filter for the RMS_OC calculation.

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

◆ ade9153a_rms_oc_src_x_wav_enable()

int ade9153a_rms_oc_src_x_wav_enable ( struct ade9153a_dev * dev)

Use x_WAV waveforms after the high-pass filter and phase compensation for the RMS_OC calculation.

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

◆ ade9153a_rms_vals()

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

Read rms values.

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

◆ ade9153a_run()

int ade9153a_run ( struct ade9153a_dev * dev)

Start measurements.

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

◆ ade9153a_selfreq()

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

Frequency select.

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

◆ ade9153a_set_interface_serial()

int ade9153a_set_interface_serial ( struct ade9153a_dev * dev)

Select comms interface Serial.

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

◆ ade9153a_set_interface_spi()

int ade9153a_set_interface_spi ( struct ade9153a_dev * dev)

Select comms interface SPI.

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

◆ ade9153a_setup()

int ade9153a_setup ( void * dev,
struct ade9153a_init_param init_param )

ADE9153A setup.

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

◆ ade9153a_start_autocal_ai()

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

Start autocalibration AI channel.

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

◆ ade9153a_start_autocal_av()

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

Start autocalibration AV channel.

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

◆ ade9153a_start_autocal_bi()

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

Start autocalibration BI channel.

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

◆ ade9153a_stop()

int ade9153a_stop ( struct ade9153a_dev * dev)

Stop measurements.

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

◆ ade9153a_sw_reset()

int ade9153a_sw_reset ( struct ade9153a_dev * dev)

Reset the device using SW reset.

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

◆ ade9153a_swella_val()

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

Voltage value during swell condition.

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

◆ ade9153a_temp_en()

int ade9153a_temp_en ( struct ade9153a_dev * dev)

Enable the temperature sensor.

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

◆ ade9153a_temp_gain_val()

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

temperature sensor gain.

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

◆ ade9153a_temp_offset_val()

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

temperature sensor offset.

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

◆ ade9153a_temp_result()

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

Temperature result.

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

◆ ade9153a_temp_start()

int ade9153a_temp_start ( struct ade9153a_dev * dev)

Manually request a new temperature sensor reading.

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

◆ ade9153a_temp_time()

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

Select the number of temperature readings to average.

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

◆ ade9153a_temp_val()

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

Temperature value in deg C.

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

◆ ade9153a_uperiod_sel()

int ade9153a_uperiod_sel ( struct ade9153a_dev * dev,
uint8_t en )

User period select.

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

◆ ade9153a_varacc()

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

Select fundamental reactive power accumulation mode.

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

◆ ade9153a_version_product()

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

Version product.

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

◆ ade9153a_vlevel_val()

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

Vlevel val.

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

◆ ade9153a_vnoma_enable()

int ade9153a_vnoma_enable ( struct ade9153a_dev * dev)

Use the nominal phase voltage rms, VNOM, in the computation of the Phase A total apparent power.

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

◆ ade9153a_vpk_val()

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

Vpeak val.

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

◆ ade9153a_wattacc()

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

Select Total active power accumulation mode.

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

◆ ade9153a_wr_lock()

int ade9153a_wr_lock ( struct ade9153a_dev * dev)

Lock device.

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

◆ ade9153a_wr_unlock()

int ade9153a_wr_unlock ( struct ade9153a_dev * dev)

Unlock device.

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

◆ ade9153a_write()

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

Write device register.

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

◆ ade9153a_zx_out_oe()

int ade9153a_zx_out_oe ( struct ade9153a_dev * dev)

ZX driven to CF2 pin.

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

◆ ade9153a_zx_src_after_hpf_enable()

int ade9153a_zx_src_after_hpf_enable ( struct ade9153a_dev * dev)

ZX data source after hpf and phase compensation.

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

◆ ade9153a_zx_src_before_hpf_enable()

int ade9153a_zx_src_before_hpf_enable ( struct ade9153a_dev * dev)

ZX data source before hpf and phase compensation.

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

◆ NO_OS_DECLARE_CRC16_TABLE()

NO_OS_DECLARE_CRC16_TABLE ( ade9153a_crc16 )