no-OS
|
Implementation of ADE9113 Driver. More...
#include <stdlib.h>
#include <errno.h>
#include <math.h>
#include "ade9113.h"
#include "no_os_delay.h"
#include "no_os_units.h"
#include "no_os_alloc.h"
#include "no_os_crc8.h"
#include "no_os_crc16.h"
#include "no_os_print_log.h"
Functions | |
NO_OS_DECLARE_CRC8_TABLE (ade9113_crc8) | |
NO_OS_DECLARE_CRC16_TABLE (ade9113_crc16) | |
int | ade9113_read (struct ade9113_dev *dev, uint8_t reg_addr, uint8_t *reg_data, enum ade9113_operation_e op_mode) |
Read device register. More... | |
int | ade9113_read_dc (struct ade9113_dev *dev, uint8_t reg_addr, uint8_t *reg_data) |
Read device register in a daisy-chain setup. More... | |
int | ade9113_write (struct ade9113_dev *dev, uint8_t reg_addr, uint8_t reg_data, enum ade9113_operation_e op_mode) |
Write device register. More... | |
int | ade9113_write_dc (struct ade9113_dev *dev, uint8_t reg_addr, uint8_t *reg_data) |
Write device register in a daisy-chain setup. More... | |
int | ade9113_init (struct ade9113_dev **device, struct ade9113_init_param init_param) |
Initialize the device. More... | |
int | ade9113_remove (struct ade9113_dev *dev) |
Remove the device and release resources. More... | |
int | ade9113_sw_reset (struct ade9113_dev *dev) |
Reset the device using SW reset. More... | |
int | ade9113_hw_reset (struct ade9113_dev *dev) |
Reset the device using SW reset. More... | |
int | ade9113_convert_to_millivolts (struct ade9113_dev *dev, uint8_t dev_no, enum ade9113_wav_e ch, int32_t *mv_val) |
Convert a 24-bit raw sample to millivolts. More... | |
int | ade9113_get_stream_dbg_mode (struct ade9113_dev *dev, enum ade9113_stream_debug_e *stream_dbg) |
Get STREAM_DBG mode. More... | |
int | ade9113_set_stream_dbg_mode (struct ade9113_dev *dev, enum ade9113_stream_debug_e stream_dbg) |
Set STREAM_DBG mode. More... | |
int | ade9113_get_crc_en_state (struct ade9113_dev *dev, uint8_t *crc_en_state) |
Get CRC enable on SPI write setting. More... | |
int | ade9113_set_crc_en_state (struct ade9113_dev *dev, uint8_t crc_en_state) |
Set CRC enable on SPI write setting. More... | |
int | ade9113_wr_lock (struct ade9113_dev *dev) |
Lock device. More... | |
int | ade9113_wr_unlock (struct ade9113_dev *dev) |
Unlock device. More... | |
int | ade9113_write_scratchpad (struct ade9113_dev *dev, uint8_t val) |
Write value in the scratchpad register. More... | |
int | ade9113_read_scratchpad (struct ade9113_dev *dev, uint8_t *val) |
Get the value stired in the scratchpad register. More... | |
int | ade9113_set_normal_mode (struct ade9113_dev *dev) |
Set normal mode of operation. More... | |
int | ade9113_set_static_mode (struct ade9113_dev *dev) |
Set static mode of operation. More... | |
int | ade9113_set_data_increments_mode (struct ade9113_dev *dev) |
Set data increments mode of operation. More... | |
int | ade9113_get_err_count (struct ade9113_dev *dev, uint8_t *err_count) |
Get ECC or PHY Error Count on ISO to NONISO Communications. More... | |
int | ade9113_invert_v2_inputs (struct ade9113_dev *dev) |
Invert V2 channel inputs. More... | |
int | ade9113_invert_v1_inputs (struct ade9113_dev *dev) |
Invert V1 channel inputs. More... | |
int | ade9113_invert_i_inputs (struct ade9113_dev *dev) |
Invert I channel inputs. More... | |
int | ade9113_invert_v2_inputs_disable (struct ade9113_dev *dev) |
Disable invert V2 channel inputs. More... | |
int | ade9113_invert_v1_inputs_disable (struct ade9113_dev *dev) |
Disable invert V1 channel inputs. More... | |
int | ade9113_invert_i_inputs_disable (struct ade9113_dev *dev) |
Disable invert I channel inputs. More... | |
int | ade9113_set_lpf_bw_2_7 (struct ade9113_dev *dev) |
Set filter bandwidth to 2.7 kHz at 8ksps output data rate. More... | |
int | ade9113_set_lpf_bw_3_3 (struct ade9113_dev *dev) |
Set filter bandwidth to 3.3 kHz at 8ksps output data rate. More... | |
int | ade9113_set_dsp_config (struct ade9113_dev *dev, enum ade9113_datapath_config_e config) |
Set digital signal processing configuration. More... | |
int | ade9113_enable_wa_dc_offset_mode (struct ade9113_dev *dev) |
Enable write access to DC_OFFSET_MODE register. More... | |
int | ade9113_disable_wa_dc_offset_mode (struct ade9113_dev *dev) |
Disable write access to DC_OFFSET_MODE register. More... | |
int | ade9113_get_crc (struct ade9113_dev *dev, uint16_t *crc) |
Get register map CRC. More... | |
int | ade9113_efuse_refresh (struct ade9113_dev *dev) |
Refresh EFuse Memory. More... | |
int | ade9113_set_emi_config (struct ade9113_dev *dev, enum ade9113_emi_config_e config) |
Select EMI frequency hopping. More... | |
int | ade9113_get_emi_hi_mask (struct ade9113_dev *dev, uint8_t *msk) |
Get EMI HI mask. More... | |
int | ade9113_get_emi_lo_mask (struct ade9113_dev *dev, uint8_t *msk) |
Get EMI LO mask. More... | |
int | ade9113_set_emi_hi_mask (struct ade9113_dev *dev, uint8_t msk) |
Set EMI HI mask. More... | |
int | ade9113_set_emi_lo_mask (struct ade9113_dev *dev, uint8_t msk) |
Set EMI LO mask. More... | |
int | ade9113_get_emi_hi_limit (struct ade9113_dev *dev, uint8_t *limit) |
Get EMI HI limit. More... | |
int | ade9113_get_emi_mid_limit (struct ade9113_dev *dev, uint8_t *limit) |
Get EMI MID limit. More... | |
int | ade9113_get_emi_lo_limit (struct ade9113_dev *dev, uint8_t *limit) |
Get EMI LO limit. More... | |
int | ade9113_control_interrupt (struct ade9113_dev *dev, uint8_t reg_addr, uint8_t int_msk, uint8_t en) |
Enable/disable interrupt. More... | |
int | ade9113_enable_status1x_int (struct ade9113_dev *dev) |
Enable STATUS1X interrupt. More... | |
int | ade9113_disable_status1x_int (struct ade9113_dev *dev) |
Disable STATUS1X interrupt. More... | |
int | ade9113_enable_status2x_int (struct ade9113_dev *dev) |
Enable STATUS2X interrupt. More... | |
int | ade9113_disable_status2x_int (struct ade9113_dev *dev) |
Disable STATUS2X interrupt. More... | |
int | ade9113_enable_com_up_int (struct ade9113_dev *dev) |
Enable COM_UP interrupt. More... | |
int | ade9113_disable_com_up_int (struct ade9113_dev *dev) |
Disable COM_UP interrupt. More... | |
int | ade9113_enable_crc_chg_int (struct ade9113_dev *dev) |
Enable CRC_CHG interrupt. More... | |
int | ade9113_disable_crc_chg_int (struct ade9113_dev *dev) |
Disable CRC_CHG interrupt. More... | |
int | ade9113_enable_spi_crc_err_int (struct ade9113_dev *dev) |
Enable SPI_CRC_ERR interrupt. More... | |
int | ade9113_disable_spi_crc_err_int (struct ade9113_dev *dev) |
Disable SPI_CRC_ERR interrupt. More... | |
int | ade9113_enable_comflt_err_int (struct ade9113_dev *dev) |
Enable COMFLT_ERR interrupt. More... | |
int | ade9113_disable_comflt_err_int (struct ade9113_dev *dev) |
Disable COMFLT_ERR interrupt. More... | |
int | ade9113_enable_v2_wav_ovrng_int (struct ade9113_dev *dev) |
Enable V2_WAV_OVRNG interrupt. More... | |
int | ade9113_disable_v2_wav_ovrng_int (struct ade9113_dev *dev) |
Disable V2_WAV_OVRNG interrupt. More... | |
int | ade9113_enable_v1_wav_ovrng_int (struct ade9113_dev *dev) |
Enable V1_WAV_OVRNG interrupt. More... | |
int | ade9113_disable_v1_wav_ovrng_int (struct ade9113_dev *dev) |
Disable V1_WAV_OVRNG interrupt. More... | |
int | ade9113_enable_i_wav_ovrng_int (struct ade9113_dev *dev) |
Enable I_WAV_OVRNG interrupt. More... | |
int | ade9113_disable_i_wav_ovrng_int (struct ade9113_dev *dev) |
Disable I_WAV_OVRNG interrupt. More... | |
int | ade9113_enable_adc_sync_done_int (struct ade9113_dev *dev) |
Enable ADC_SYNC_DONE interrupt. More... | |
int | ade9113_disable_adc_sync_done_int (struct ade9113_dev *dev) |
Disable ADC_SYNC_DONE interrupt. More... | |
int | ade9113_enable_iso_clk_stbl_err_int (struct ade9113_dev *dev) |
Enable ISO_CLK_STBL_ERR interrupt. More... | |
int | ade9113_disable_iso_clk_stbl_err_int (struct ade9113_dev *dev) |
Disable ISO_CLK_STBL_ERR interrupt. More... | |
int | ade9113_enable_iso_phy_crc_err_int (struct ade9113_dev *dev) |
Enable ISO_PHY_CRC_ERR interrupt. More... | |
int | ade9113_disable_iso_phy_crc_err_int (struct ade9113_dev *dev) |
Disable ISO_PHY_CRC_ERR interrupt. More... | |
int | ade9113_enable_iso_efuse_mem_err_int (struct ade9113_dev *dev) |
Enable ISO_EFUSE_MEM_ERR interrupt. More... | |
int | ade9113_disable_iso_efuse_mem_err_int (struct ade9113_dev *dev) |
Disable ISO_EFUSE_MEM_ERR interrupt. More... | |
int | ade9113_enable_iso_dig_mod_v2_ovf_int (struct ade9113_dev *dev) |
Enable ISO_DIG_MOD_V2_OVF interrupt. More... | |
int | ade9113_disable_iso_dig_mod_v2_ovf_int (struct ade9113_dev *dev) |
Disable ISO_DIG_MOD_V2_OVF interrupt. More... | |
int | ade9113_enable_iso_dig_mod_v1_ovf_int (struct ade9113_dev *dev) |
Enable ISO_DIG_MOD_V1_OVF interrupt. More... | |
int | ade9113_disable_iso_dig_mod_v1_ovf_int (struct ade9113_dev *dev) |
Disable ISO_DIG_MOD_V1_OVF interrupt. More... | |
int | ade9113_enable_iso_dig_mod_i_ovf_int (struct ade9113_dev *dev) |
Enable ISO_DIG_MOD_I_OVF interrupt. More... | |
int | ade9113_disable_iso_dig_mod_i_ovf_int (struct ade9113_dev *dev) |
Disable ISO_DIG_MOD_I_OVF interrupt. More... | |
int | ade9113_enable_iso_test_mmr_err_int (struct ade9113_dev *dev) |
Enable ISO_TEST_MMR_ERR interrupt. More... | |
int | ade9113_disable_iso_test_mmr_err_int (struct ade9113_dev *dev) |
Disable ISO_TEST_MMR_ERR interrupt. More... | |
int | ade9113_select_zero_crossing_edge (struct ade9113_dev *dev, enum ade9113_zx_edge_sel_e sel) |
Select zero crossing edge. More... | |
int | ade9113_select_zero_crossing_channel (struct ade9113_dev *dev, enum ade9113_zx_channel_cfg_e cfg) |
Select zero crossing channel. More... | |
int | ade9113_adc_prepare_broadcast (struct ade9113_dev *dev) |
ADC prepare broadcast. More... | |
int | ade9113_adc_align (struct ade9113_dev *dev) |
ADC align. More... | |
int | ade9113_adc_snapshot (struct ade9113_dev *dev) |
ADC snapshot. More... | |
int | ade9113_get_int_status (struct ade9113_dev *dev, uint8_t addr, uint8_t msk, uint8_t *status) |
Get interrupt indicator from STATUS register. More... | |
int | ade9113_get_statusx_val (struct ade9113_dev *dev, uint8_t addr, uint8_t *status) |
Get STATUSx register value. More... | |
int | ade9113_get_status1x (struct ade9113_dev *dev, uint8_t *status) |
Get STATUS1 indicator. More... | |
int | ade9113_get_status2x (struct ade9113_dev *dev, uint8_t *status) |
Get STATUS2 indicator. More... | |
int | ade9113_get_reset_done (struct ade9113_dev *dev, uint8_t *status) |
Get RESET_DONE indicator. More... | |
int | ade9113_get_com_up (struct ade9113_dev *dev, uint8_t *status) |
Get COM_UP indicator. More... | |
int | ade9113_get_crc_chg (struct ade9113_dev *dev, uint8_t *status) |
Get CRC_CHG indicator. More... | |
int | ade9113_get_efuse_mem_err (struct ade9113_dev *dev, uint8_t *status) |
Get EFUSE_MEM_ERR indicator. More... | |
int | ade9113_get_spi_crc_err (struct ade9113_dev *dev, uint8_t *status) |
Get SPI_CRC_ERR indicator. More... | |
int | ade9113_get_comflt_err (struct ade9113_dev *dev, uint8_t *status) |
Get COMFLT_ERR indicator. More... | |
int | ade9113_clear_reset_done_int (struct ade9113_dev *dev) |
Clear the RESET_DONE int mask. More... | |
int | ade9113_clear_com_up_int (struct ade9113_dev *dev) |
Clear the COM_UP int mask. More... | |
int | ade9113_clear_crc_chg_int (struct ade9113_dev *dev) |
Clear the CRC_CHG int mask. More... | |
int | ade9113_clear_spi_crc_err_int (struct ade9113_dev *dev) |
Clear the SPI_CRC_ERR int mask. More... | |
int | ade9113_clear_comflt_err_int (struct ade9113_dev *dev) |
Clear the COMFLT_ERR int mask. More... | |
int | ade9113_get_v2_wav_ovrng (struct ade9113_dev *dev, uint8_t *status) |
Get V2_WAV_OVRNG indicator. More... | |
int | ade9113_clear_v2_wav_ovrng_int (struct ade9113_dev *dev) |
Clear the V2_WAV_OVRNG int mask. More... | |
int | ade9113_get_v1_wav_ovrng (struct ade9113_dev *dev, uint8_t *status) |
Get V1_WAV_OVRNG indicator. More... | |
int | ade9113_clear_v1_wav_ovrng_int (struct ade9113_dev *dev) |
Clear the V1_WAV_OVRNG int mask. More... | |
int | ade9113_get_i_wav_ovrng (struct ade9113_dev *dev, uint8_t *status) |
Get I_WAV_OVRNG indicator. More... | |
int | ade9113_clear_i_wav_ovrng_int (struct ade9113_dev *dev) |
Clear the I_WAV_OVRNG int mask. More... | |
int | ade9113_get_adc_sync_done (struct ade9113_dev *dev, uint8_t *status) |
Get ADC_SYNC_DONE indicator. More... | |
int | ade9113_clear_adc_sync_done_int (struct ade9113_dev *dev) |
Clear the ADC_SYNC_DONE int mask. More... | |
int | ade9113_get_iso_clk_stbl_err (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_CLK_STBL_ERR indicator. More... | |
int | ade9113_clear_iso_clk_stbl_err_int (struct ade9113_dev *dev) |
Clear the ISO_CLK_STBL_ERR int mask. More... | |
int | ade9113_get_iso_phy_crc_err (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_PHY_CRC_ERR indicator. More... | |
int | ade9113_clear_iso_phy_crc_err_int (struct ade9113_dev *dev) |
Clear the ISO_PHY_CRC_ERR int mask. More... | |
int | ade9113_get_iso_efuse_mem_err_err (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_EFUSE_MEM_ERR indicator. More... | |
int | ade9113_clear_iso_efuse_mem_err_int (struct ade9113_dev *dev) |
Clear the ISO_EFUSE_MEM_ERR int mask. More... | |
int | ade9113_get_iso_dig_mod_v2_ovf (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_DIG_MOD_V2_OVF indicator. More... | |
int | ade9113_clear_iso_dig_mod_v2_ovf_int (struct ade9113_dev *dev) |
Clear the ISO_DIG_MOD_V2_OVF int mask. More... | |
int | ade9113_get_iso_dig_mod_v1_ovf (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_DIG_MOD_V1_OVF indicator. More... | |
int | ade9113_clear_iso_dig_mod_v1_ovf_int (struct ade9113_dev *dev) |
Clear the ISO_DIG_MOD_V1_OVF int mask. More... | |
int | ade9113_get_iso_dig_mod_i_ovf (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_DIG_MOD_I_OVF indicator. More... | |
int | ade9113_clear_iso_dig_mod_i_ovf_int (struct ade9113_dev *dev) |
Clear the ISO_DIG_MOD_I_OVF int mask. More... | |
int | ade9113_get_iso_test_mmr_err (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_TEST_MMR_ERR indicator. More... | |
int | ade9113_clear_iso_test_mmr_err_int (struct ade9113_dev *dev) |
Clear the ISO_TEST_MMR_ERR int mask. More... | |
int | ade9113_get_iso_status_rd_ecc_err (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_STATUS_RD_ECC_ERR indicator. More... | |
int | ade9113_get_iso_phy_err (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_PHY_ERR indicator. More... | |
int | ade9113_get_iso_ecc_err (struct ade9113_dev *dev, uint8_t *status) |
Get ISO_ECC_ERR indicator. More... | |
int | ade9113_get_crc_done_flag (struct ade9113_dev *dev, uint8_t *status) |
Get CRC_DONE indicator. More... | |
int | ade9113_clear_crc_done_int (struct ade9113_dev *dev) |
Clear the CRC_DONE int mask. More... | |
int | ade9113_force_crc_recalculation (struct ade9113_dev *dev) |
Force background register map CRC recalculation. More... | |
int | ade9113_get_silicon_revision (struct ade9113_dev *dev, uint8_t *silicon_rev) |
Get SILICON_REVISION value. More... | |
int | ade9113_get_version_product (struct ade9113_dev *dev, uint8_t *ver_product) |
Get VERSION_PRODUCT value. More... | |
int | ade9113_get_wav (struct ade9113_dev *dev, enum ade9113_wav_e selection, uint32_t *val) |
Get wave value. More... | |
int | ade9113_drdy_int_enable (struct ade9113_dev *dev) |
DRDY inerrupt enable. More... | |
int | ade9113_drdy_int_disable (struct ade9113_dev *dev) |
DRDY inerrupt disable. More... | |
Implementation of ADE9113 Driver.
Copyright 2023(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 ade9113_adc_align | ( | struct ade9113_dev * | dev | ) |
ADC align.
dev | - The device structure. |
int ade9113_adc_prepare_broadcast | ( | struct ade9113_dev * | dev | ) |
ADC prepare broadcast.
dev | - The device structure. |
int ade9113_adc_snapshot | ( | struct ade9113_dev * | dev | ) |
ADC snapshot.
dev | - The device structure. |
int ade9113_clear_adc_sync_done_int | ( | struct ade9113_dev * | dev | ) |
Clear the ADC_SYNC_DONE int mask.
dev | - The device structure. |
int ade9113_clear_com_up_int | ( | struct ade9113_dev * | dev | ) |
Clear the COM_UP int mask.
dev | - The device structure. |
int ade9113_clear_comflt_err_int | ( | struct ade9113_dev * | dev | ) |
Clear the COMFLT_ERR int mask.
dev | - The device structure. |
int ade9113_clear_crc_chg_int | ( | struct ade9113_dev * | dev | ) |
Clear the CRC_CHG int mask.
dev | - The device structure. |
int ade9113_clear_crc_done_int | ( | struct ade9113_dev * | dev | ) |
Clear the CRC_DONE int mask.
dev | - The device structure. |
int ade9113_clear_i_wav_ovrng_int | ( | struct ade9113_dev * | dev | ) |
Clear the I_WAV_OVRNG int mask.
dev | - The device structure. |
int ade9113_clear_iso_clk_stbl_err_int | ( | struct ade9113_dev * | dev | ) |
Clear the ISO_CLK_STBL_ERR int mask.
dev | - The device structure. |
int ade9113_clear_iso_dig_mod_i_ovf_int | ( | struct ade9113_dev * | dev | ) |
Clear the ISO_DIG_MOD_I_OVF int mask.
dev | - The device structure. |
int ade9113_clear_iso_dig_mod_v1_ovf_int | ( | struct ade9113_dev * | dev | ) |
Clear the ISO_DIG_MOD_V1_OVF int mask.
dev | - The device structure. |
int ade9113_clear_iso_dig_mod_v2_ovf_int | ( | struct ade9113_dev * | dev | ) |
Clear the ISO_DIG_MOD_V2_OVF int mask.
dev | - The device structure. |
int ade9113_clear_iso_efuse_mem_err_int | ( | struct ade9113_dev * | dev | ) |
Clear the ISO_EFUSE_MEM_ERR int mask.
dev | - The device structure. |
int ade9113_clear_iso_phy_crc_err_int | ( | struct ade9113_dev * | dev | ) |
Clear the ISO_PHY_CRC_ERR int mask.
dev | - The device structure. |
int ade9113_clear_iso_test_mmr_err_int | ( | struct ade9113_dev * | dev | ) |
Clear the ISO_TEST_MMR_ERR int mask.
dev | - The device structure. |
int ade9113_clear_reset_done_int | ( | struct ade9113_dev * | dev | ) |
Clear the RESET_DONE int mask.
dev | - The device structure. |
int ade9113_clear_spi_crc_err_int | ( | struct ade9113_dev * | dev | ) |
Clear the SPI_CRC_ERR int mask.
dev | - The device structure. |
int ade9113_clear_v1_wav_ovrng_int | ( | struct ade9113_dev * | dev | ) |
Clear the V1_WAV_OVRNG int mask.
dev | - The device structure. |
int ade9113_clear_v2_wav_ovrng_int | ( | struct ade9113_dev * | dev | ) |
Clear the V2_WAV_OVRNG int mask.
dev | - The device structure. |
int ade9113_control_interrupt | ( | struct ade9113_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_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 ade9113_convert_to_millivolts | ( | struct ade9113_dev * | dev, |
uint8_t | dev_no, | ||
enum ade9113_wav_e | ch, | ||
int32_t * | mv_val | ||
) |
Convert a 24-bit raw sample to millivolts.
dev | - The device structure. |
dev_no | - Device number (0 if in not in daisy-chain setup). |
ch | - Device channel. |
mv_val | - Value in millivolts. |
int ade9113_disable_adc_sync_done_int | ( | struct ade9113_dev * | dev | ) |
Disable ADC_SYNC_DONE interrupt.
dev | - The device structure. |
int ade9113_disable_com_up_int | ( | struct ade9113_dev * | dev | ) |
Disable COM_UP interrupt.
dev | - The device structure. |
int ade9113_disable_comflt_err_int | ( | struct ade9113_dev * | dev | ) |
Disable COMFLT_ERR interrupt.
dev | - The device structure. |
int ade9113_disable_crc_chg_int | ( | struct ade9113_dev * | dev | ) |
Disable CRC_CHG interrupt.
dev | - The device structure. |
int ade9113_disable_i_wav_ovrng_int | ( | struct ade9113_dev * | dev | ) |
Disable I_WAV_OVRNG interrupt.
dev | - The device structure. |
int ade9113_disable_iso_clk_stbl_err_int | ( | struct ade9113_dev * | dev | ) |
Disable ISO_CLK_STBL_ERR interrupt.
dev | - The device structure. |
int ade9113_disable_iso_dig_mod_i_ovf_int | ( | struct ade9113_dev * | dev | ) |
Disable ISO_DIG_MOD_I_OVF interrupt.
dev | - The device structure. |
int ade9113_disable_iso_dig_mod_v1_ovf_int | ( | struct ade9113_dev * | dev | ) |
Disable ISO_DIG_MOD_V1_OVF interrupt.
dev | - The device structure. |
int ade9113_disable_iso_dig_mod_v2_ovf_int | ( | struct ade9113_dev * | dev | ) |
Disable ISO_DIG_MOD_V2_OVF interrupt.
dev | - The device structure. |
int ade9113_disable_iso_efuse_mem_err_int | ( | struct ade9113_dev * | dev | ) |
Disable ISO_EFUSE_MEM_ERR interrupt.
dev | - The device structure. |
int ade9113_disable_iso_phy_crc_err_int | ( | struct ade9113_dev * | dev | ) |
Disable ISO_PHY_CRC_ERR interrupt.
dev | - The device structure. |
int ade9113_disable_iso_test_mmr_err_int | ( | struct ade9113_dev * | dev | ) |
Disable ISO_TEST_MMR_ERR interrupt.
dev | - The device structure. |
int ade9113_disable_spi_crc_err_int | ( | struct ade9113_dev * | dev | ) |
Disable SPI_CRC_ERR interrupt.
dev | - The device structure. |
int ade9113_disable_status1x_int | ( | struct ade9113_dev * | dev | ) |
Disable STATUS1X interrupt.
dev | - The device structure. |
int ade9113_disable_status2x_int | ( | struct ade9113_dev * | dev | ) |
Disable STATUS2X interrupt.
dev | - The device structure. |
int ade9113_disable_v1_wav_ovrng_int | ( | struct ade9113_dev * | dev | ) |
Disable V1_WAV_OVRNG interrupt.
dev | - The device structure. |
int ade9113_disable_v2_wav_ovrng_int | ( | struct ade9113_dev * | dev | ) |
Disable V2_WAV_OVRNG interrupt.
dev | - The device structure. |
int ade9113_disable_wa_dc_offset_mode | ( | struct ade9113_dev * | dev | ) |
Disable write access to DC_OFFSET_MODE register.
dev | - The device structure. |
int ade9113_drdy_int_disable | ( | struct ade9113_dev * | dev | ) |
DRDY inerrupt disable.
dev | - The device structure. |
int ade9113_drdy_int_enable | ( | struct ade9113_dev * | dev | ) |
DRDY inerrupt enable.
dev | - The device structure. |
int ade9113_efuse_refresh | ( | struct ade9113_dev * | dev | ) |
Refresh EFuse Memory.
dev | - The device structure. |
int ade9113_enable_adc_sync_done_int | ( | struct ade9113_dev * | dev | ) |
Enable ADC_SYNC_DONE interrupt.
dev | - The device structure. |
int ade9113_enable_com_up_int | ( | struct ade9113_dev * | dev | ) |
Enable COM_UP interrupt.
dev | - The device structure. |
int ade9113_enable_comflt_err_int | ( | struct ade9113_dev * | dev | ) |
Enable COMFLT_ERR interrupt.
dev | - The device structure. |
int ade9113_enable_crc_chg_int | ( | struct ade9113_dev * | dev | ) |
Enable CRC_CHG interrupt.
dev | - The device structure. |
int ade9113_enable_i_wav_ovrng_int | ( | struct ade9113_dev * | dev | ) |
Enable I_WAV_OVRNG interrupt.
dev | - The device structure. |
int ade9113_enable_iso_clk_stbl_err_int | ( | struct ade9113_dev * | dev | ) |
Enable ISO_CLK_STBL_ERR interrupt.
dev | - The device structure. |
int ade9113_enable_iso_dig_mod_i_ovf_int | ( | struct ade9113_dev * | dev | ) |
Enable ISO_DIG_MOD_I_OVF interrupt.
dev | - The device structure. |
int ade9113_enable_iso_dig_mod_v1_ovf_int | ( | struct ade9113_dev * | dev | ) |
Enable ISO_DIG_MOD_V1_OVF interrupt.
dev | - The device structure. |
int ade9113_enable_iso_dig_mod_v2_ovf_int | ( | struct ade9113_dev * | dev | ) |
Enable ISO_DIG_MOD_V2_OVF interrupt.
dev | - The device structure. |
int ade9113_enable_iso_efuse_mem_err_int | ( | struct ade9113_dev * | dev | ) |
Enable ISO_EFUSE_MEM_ERR interrupt.
dev | - The device structure. |
int ade9113_enable_iso_phy_crc_err_int | ( | struct ade9113_dev * | dev | ) |
Enable ISO_PHY_CRC_ERR interrupt.
dev | - The device structure. |
int ade9113_enable_iso_test_mmr_err_int | ( | struct ade9113_dev * | dev | ) |
Enable ISO_TEST_MMR_ERR interrupt.
dev | - The device structure. |
int ade9113_enable_spi_crc_err_int | ( | struct ade9113_dev * | dev | ) |
Enable SPI_CRC_ERR interrupt.
dev | - The device structure. |
int ade9113_enable_status1x_int | ( | struct ade9113_dev * | dev | ) |
Enable STATUS1X interrupt.
dev | - The device structure. |
int ade9113_enable_status2x_int | ( | struct ade9113_dev * | dev | ) |
Enable STATUS2X interrupt.
dev | - The device structure. |
int ade9113_enable_v1_wav_ovrng_int | ( | struct ade9113_dev * | dev | ) |
Enable V1_WAV_OVRNG interrupt.
dev | - The device structure. |
int ade9113_enable_v2_wav_ovrng_int | ( | struct ade9113_dev * | dev | ) |
Enable V2_WAV_OVRNG interrupt.
dev | - The device structure. |
int ade9113_enable_wa_dc_offset_mode | ( | struct ade9113_dev * | dev | ) |
Enable write access to DC_OFFSET_MODE register.
dev | - The device structure. |
int ade9113_force_crc_recalculation | ( | struct ade9113_dev * | dev | ) |
Force background register map CRC recalculation.
dev | - The device structure. |
int ade9113_get_adc_sync_done | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ADC_SYNC_DONE indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_com_up | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get COM_UP indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_comflt_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get COMFLT_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_crc | ( | struct ade9113_dev * | dev, |
uint16_t * | crc | ||
) |
Get register map CRC.
dev | - The device structure. |
crc | - CRC value. |
int ade9113_get_crc_chg | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get CRC_CHG indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_crc_done_flag | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get CRC_DONE indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_crc_en_state | ( | struct ade9113_dev * | dev, |
uint8_t * | crc_en_state | ||
) |
Get CRC enable on SPI write setting.
dev | - The device structure. |
crc_en_state | - Read CRC setting. |
int ade9113_get_efuse_mem_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get EFUSE_MEM_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_emi_hi_limit | ( | struct ade9113_dev * | dev, |
uint8_t * | limit | ||
) |
Get EMI HI limit.
dev | - The device structure. |
limit | - Read EMI HI limit. |
int ade9113_get_emi_hi_mask | ( | struct ade9113_dev * | dev, |
uint8_t * | msk | ||
) |
Get EMI HI mask.
dev | - The device structure. |
msk | - EMI HI mask. |
int ade9113_get_emi_lo_limit | ( | struct ade9113_dev * | dev, |
uint8_t * | limit | ||
) |
Get EMI LO limit.
dev | - The device structure. |
limit | - Read EMI LO limit. |
int ade9113_get_emi_lo_mask | ( | struct ade9113_dev * | dev, |
uint8_t * | msk | ||
) |
Get EMI LO mask.
dev | - The device structure. |
msk | - EMI LO mask. |
int ade9113_get_emi_mid_limit | ( | struct ade9113_dev * | dev, |
uint8_t * | limit | ||
) |
Get EMI MID limit.
dev | - The device structure. |
limit | - Read EMI MID limit. |
int ade9113_get_err_count | ( | struct ade9113_dev * | dev, |
uint8_t * | err_count | ||
) |
Get ECC or PHY Error Count on ISO to NONISO Communications.
dev | - The device structure. |
err_count | - Read erro count. |
int ade9113_get_i_wav_ovrng | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get I_WAV_OVRNG indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_int_status | ( | struct ade9113_dev * | dev, |
uint8_t | addr, | ||
uint8_t | msk, | ||
uint8_t * | status | ||
) |
Get interrupt indicator from STATUS register.
dev | - The device structure. |
addr | - Register address. |
msk | - Interrupt mask. |
status | - Status indicator. |
int ade9113_get_iso_clk_stbl_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_CLK_STBL_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_iso_dig_mod_i_ovf | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_DIG_MOD_I_OVF indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_iso_dig_mod_v1_ovf | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_DIG_MOD_V1_OVF indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_iso_dig_mod_v2_ovf | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_DIG_MOD_V2_OVF indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_iso_ecc_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_ECC_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_iso_efuse_mem_err_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_EFUSE_MEM_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_iso_phy_crc_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_PHY_CRC_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_iso_phy_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_PHY_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_iso_status_rd_ecc_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_STATUS_RD_ECC_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_iso_test_mmr_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get ISO_TEST_MMR_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_reset_done | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get RESET_DONE indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_silicon_revision | ( | struct ade9113_dev * | dev, |
uint8_t * | silicon_rev | ||
) |
Get SILICON_REVISION value.
dev | - The device structure. |
silicon_rev | - Read silicon revision value. |
int ade9113_get_spi_crc_err | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get SPI_CRC_ERR indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_status1x | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get STATUS1 indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_status2x | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get STATUS2 indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_statusx_val | ( | struct ade9113_dev * | dev, |
uint8_t | addr, | ||
uint8_t * | status | ||
) |
Get STATUSx register value.
dev | - The device structure. |
addr | - Register address. |
status | - 8-bit register value. |
int ade9113_get_stream_dbg_mode | ( | struct ade9113_dev * | dev, |
enum ade9113_stream_debug_e * | stream_dbg | ||
) |
Get STREAM_DBG mode.
dev | - The device structure. |
stream_dbg | - Read debug mode setting read. |
int ade9113_get_v1_wav_ovrng | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get V1_WAV_OVRNG indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_v2_wav_ovrng | ( | struct ade9113_dev * | dev, |
uint8_t * | status | ||
) |
Get V2_WAV_OVRNG indicator.
dev | - The device structure. |
status | - Status indicator. |
int ade9113_get_version_product | ( | struct ade9113_dev * | dev, |
uint8_t * | ver_product | ||
) |
Get VERSION_PRODUCT value.
dev | - The device structure. |
ver_product | - VErsion product value. |
int ade9113_get_wav | ( | struct ade9113_dev * | dev, |
enum ade9113_wav_e | selection, | ||
uint32_t * | val | ||
) |
Get wave value.
dev | - The device structure. |
selection | - Wave selection. |
val | - Read I_WAV value. |
int ade9113_hw_reset | ( | struct ade9113_dev * | dev | ) |
Reset the device using SW reset.
dev | - The device structure. |
int ade9113_init | ( | struct ade9113_dev ** | device, |
struct ade9113_init_param | init_param | ||
) |
Initialize the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int ade9113_invert_i_inputs | ( | struct ade9113_dev * | dev | ) |
Invert I channel inputs.
dev | - The device structure. |
int ade9113_invert_i_inputs_disable | ( | struct ade9113_dev * | dev | ) |
Disable invert I channel inputs.
dev | - The device structure. |
int ade9113_invert_v1_inputs | ( | struct ade9113_dev * | dev | ) |
Invert V1 channel inputs.
dev | - The device structure. |
int ade9113_invert_v1_inputs_disable | ( | struct ade9113_dev * | dev | ) |
Disable invert V1 channel inputs.
dev | - The device structure. |
int ade9113_invert_v2_inputs | ( | struct ade9113_dev * | dev | ) |
Invert V2 channel inputs.
dev | - The device structure. |
int ade9113_invert_v2_inputs_disable | ( | struct ade9113_dev * | dev | ) |
Disable invert V2 channel inputs.
dev | - The device structure. |
int ade9113_read | ( | struct ade9113_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data, | ||
enum ade9113_operation_e | op_mode | ||
) |
Read device register.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The data read from the register. |
op_mode | - Long/short write operation. |
int ade9113_read_dc | ( | struct ade9113_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data | ||
) |
Read device register in a daisy-chain setup.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The data read from the register. |
int ade9113_read_scratchpad | ( | struct ade9113_dev * | dev, |
uint8_t * | val | ||
) |
Get the value stired in the scratchpad register.
dev | - The device structure. |
val | - The read value. |
int ade9113_remove | ( | struct ade9113_dev * | dev | ) |
Remove the device and release resources.
dev | - The device structure. |
int ade9113_select_zero_crossing_channel | ( | struct ade9113_dev * | dev, |
enum ade9113_zx_channel_cfg_e | cfg | ||
) |
Select zero crossing channel.
dev | - The device structure. |
cfg | - Zero crossing channel selection. |
int ade9113_select_zero_crossing_edge | ( | struct ade9113_dev * | dev, |
enum ade9113_zx_edge_sel_e | sel | ||
) |
Select zero crossing edge.
dev | - The device structure. |
sel | - Zero crossing edge selection. |
int ade9113_set_crc_en_state | ( | struct ade9113_dev * | dev, |
uint8_t | crc_en_state | ||
) |
Set CRC enable on SPI write setting.
dev | - The device structure. |
crc_en_state | - Read CRC setting. |
int ade9113_set_data_increments_mode | ( | struct ade9113_dev * | dev | ) |
Set data increments mode of operation.
dev | - The device structure. |
int ade9113_set_dsp_config | ( | struct ade9113_dev * | dev, |
enum ade9113_datapath_config_e | config | ||
) |
Set digital signal processing configuration.
dev | - The device structure. |
config | - The ADE9113 DSP configuration. |
int ade9113_set_emi_config | ( | struct ade9113_dev * | dev, |
enum ade9113_emi_config_e | config | ||
) |
Select EMI frequency hopping.
dev | - The device structure. |
config | - EMI frequency hopping selection. |
int ade9113_set_emi_hi_mask | ( | struct ade9113_dev * | dev, |
uint8_t | msk | ||
) |
Set EMI HI mask.
dev | - The device structure. |
msk | - EMI HI mask set. |
int ade9113_set_emi_lo_mask | ( | struct ade9113_dev * | dev, |
uint8_t | msk | ||
) |
Set EMI LO mask.
dev | - The device structure. |
msk | - EMI LO mask set. |
int ade9113_set_lpf_bw_2_7 | ( | struct ade9113_dev * | dev | ) |
Set filter bandwidth to 2.7 kHz at 8ksps output data rate.
dev | - The device structure. |
int ade9113_set_lpf_bw_3_3 | ( | struct ade9113_dev * | dev | ) |
Set filter bandwidth to 3.3 kHz at 8ksps output data rate.
dev | - The device structure. |
int ade9113_set_normal_mode | ( | struct ade9113_dev * | dev | ) |
Set normal mode of operation.
dev | - The device structure. |
int ade9113_set_static_mode | ( | struct ade9113_dev * | dev | ) |
Set static mode of operation.
dev | - The device structure. |
int ade9113_set_stream_dbg_mode | ( | struct ade9113_dev * | dev, |
enum ade9113_stream_debug_e | stream_dbg | ||
) |
Set STREAM_DBG mode.
dev | - The device structure. |
stream_dbg | - Stream debug mode setting. |
int ade9113_sw_reset | ( | struct ade9113_dev * | dev | ) |
Reset the device using SW reset.
dev | - The device structure. |
int ade9113_wr_lock | ( | struct ade9113_dev * | dev | ) |
Lock device.
dev | - The device structure. |
int ade9113_wr_unlock | ( | struct ade9113_dev * | dev | ) |
Unlock device.
dev | - The device structure. |
int ade9113_write | ( | struct ade9113_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | reg_data, | ||
enum ade9113_operation_e | op_mode | ||
) |
Write device register.
dev- | The device structure. |
reg_addr | - The register address. |
reg_data | - The data to be written. |
op_mode | - Long/short write operation. |
int ade9113_write_dc | ( | struct ade9113_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data | ||
) |
Write device register in a daisy-chain setup.
dev- | The device structure. |
reg_addr | - The register address. |
reg_data | - The data to be written (array with data for first device on position 0). |
int ade9113_write_scratchpad | ( | struct ade9113_dev * | dev, |
uint8_t | val | ||
) |
Write value in the scratchpad register.
dev | - The device structure. |
val | - The value to be written. |
NO_OS_DECLARE_CRC16_TABLE | ( | ade9113_crc16 | ) |
NO_OS_DECLARE_CRC8_TABLE | ( | ade9113_crc8 | ) |