Implementation of ADE7913 Driver. More...
#include <stdlib.h>
#include <errno.h>
#include <math.h>
#include "ade7913.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 | |
int | ade7913_read (struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data) |
Read device register. | |
int | ade7913_read_waveforms (struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data) |
Read multiple devices. | |
int | ade7913_write (struct ade7913_dev *dev, uint8_t reg_addr, uint8_t reg_data) |
Write device register. | |
int | ade7913_write_broadcast (struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data) |
Write broadcast. | |
int | ade7913_init (struct ade7913_dev **device, struct ade7913_init_param init_param) |
Initialize the device. | |
int | ade7913_remove (struct ade7913_dev *dev) |
Remove the device and release resources. | |
int | ade7913_sw_reset (struct ade7913_dev *dev) |
Reset the device using SW reset. | |
int | ade7913_wr_lock (struct ade7913_dev *dev) |
Lock device. | |
int | ade7913_wr_unlock (struct ade7913_dev *dev) |
Unlock device. | |
int | ade7913_get_sync_cnt_val (struct ade7913_dev *dev, uint16_t *counter) |
Get synchronization counter value. | |
int | ade7913_set_clkout_en (struct ade7913_dev *dev, uint8_t clkout_en) |
Set clkout enable. | |
int | ade7913_pwrdwn (struct ade7913_dev *dev, uint8_t pwrdwn) |
Power down enable. | |
int | ade7913_temp_en (struct ade7913_dev *dev, uint8_t temp_en) |
Temperature enable. | |
int | ade7913_sync_en (struct ade7913_dev *dev) |
Sync enable. | |
int | ade7913_adc_freq (struct ade7913_dev *dev, enum ade7913_adc_freq_e frequency) |
Set ADC frequency. | |
int | ade7913_lfp_bw (struct ade7913_dev *dev, uint8_t bw) |
Digital lpf bandwith select. | |
int | ade7913_crc_status (struct ade7913_dev *dev, uint8_t *status) |
CRC of config registers status. | |
int | ade7913_ic_prot_status (struct ade7913_dev *dev, uint8_t *status) |
IC config regs protection status. | |
int | ade7913_emi_ctrl (struct ade7913_dev *dev, uint8_t emi_ctrl) |
Set EMI CTRL register. | |
int | ade7913_adc_na_status (struct ade7913_dev *dev, uint8_t *status) |
ADC not accesed during one period status. | |
int | ade7913_cnt_snapshot_val (struct ade7913_dev *dev, uint16_t *val) |
Cnt snapshot. | |
int | ade7913_get_version_product (struct ade7913_dev *dev, uint8_t *ver_product) |
Get version product value. | |
Implementation of ADE7913 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 ade7913_adc_freq | ( | struct ade7913_dev * | dev, |
enum ade7913_adc_freq_e | frequency ) |
Set ADC frequency.
dev | - The device structure. |
frequency | - output frequency |
int ade7913_adc_na_status | ( | struct ade7913_dev * | dev, |
uint8_t * | status ) |
ADC not accesed during one period status.
dev | - The device structure. |
status | - status indicator |
int ade7913_cnt_snapshot_val | ( | struct ade7913_dev * | dev, |
uint16_t * | val ) |
Cnt snapshot.
dev | - The device structure. |
val | - snapshot value of counter. |
int ade7913_crc_status | ( | struct ade7913_dev * | dev, |
uint8_t * | status ) |
CRC of config registers status.
dev | - The device structure. |
status | - status indicator |
int ade7913_emi_ctrl | ( | struct ade7913_dev * | dev, |
uint8_t | emi_ctrl ) |
Set EMI CTRL register.
dev | - The device structure. |
emi_ctrl | - output frequency |
int ade7913_get_sync_cnt_val | ( | struct ade7913_dev * | dev, |
uint16_t * | counter ) |
Get synchronization counter value.
dev | - The device structure. |
counter | - Counter value. |
int ade7913_get_version_product | ( | struct ade7913_dev * | dev, |
uint8_t * | ver_product ) |
Get version product value.
dev | - The device structure. |
ver_product | - VErsion product value. |
int ade7913_ic_prot_status | ( | struct ade7913_dev * | dev, |
uint8_t * | status ) |
IC config regs protection status.
dev | - The device structure. |
status | - status indicator |
int ade7913_init | ( | struct ade7913_dev ** | device, |
struct ade7913_init_param | init_param ) |
Initialize the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int ade7913_lfp_bw | ( | struct ade7913_dev * | dev, |
uint8_t | bw ) |
Digital lpf bandwith select.
dev | - The device structure. |
bw | - 0 - BW = 3.3kHz, 1 - BW = 2kHz (for CLKIN 4.096 MHz and ADC freq 8kHz). |
int ade7913_pwrdwn | ( | struct ade7913_dev * | dev, |
uint8_t | pwrdwn ) |
Power down enable.
dev | - The device structure. |
pwrdwn | - 0 - dc-dc is functional, 1 - dc-dc is turned off. |
int ade7913_read | ( | struct ade7913_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data ) |
Read device register.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The data read from the register. |
int ade7913_read_waveforms | ( | struct ade7913_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data ) |
Read multiple devices.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The data read from the register. |
int ade7913_remove | ( | struct ade7913_dev * | dev | ) |
Remove the device and release resources.
dev | - The device structure. |
int ade7913_set_clkout_en | ( | struct ade7913_dev * | dev, |
uint8_t | clkout_en ) |
Set clkout enable.
dev | - The device structure. |
clkout_en | - 0 - dready functionality enabled 1 - clkout functionality enabled. |
int ade7913_sw_reset | ( | struct ade7913_dev * | dev | ) |
Reset the device using SW reset.
dev | - The device structure. |
int ade7913_sync_en | ( | struct ade7913_dev * | dev | ) |
Sync enable.
dev | - The device structure. |
int ade7913_temp_en | ( | struct ade7913_dev * | dev, |
uint8_t | temp_en ) |
Temperature enable.
dev | - The device structure. |
temp_en | - 0 - voltage V2P V2M measured, 1 - internal temperature sensor measured . |
int ade7913_wr_lock | ( | struct ade7913_dev * | dev | ) |
Lock device.
dev | - The device structure. |
int ade7913_wr_unlock | ( | struct ade7913_dev * | dev | ) |
Unlock device.
dev | - The device structure. |
int ade7913_write | ( | struct ade7913_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | reg_data ) |
Write device register.
dev- | The device structure. |
reg_addr | - The register address. |
reg_data | - The data to be written. |
int ade7913_write_broadcast | ( | struct ade7913_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data ) |
Write broadcast.
dev- | The device structure. |
reg_addr | - The register address. |
reg_data | - The data to be written. |