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