Header file of ADE7816 Driver. More...
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "no_os_util.h"
#include "no_os_spi.h"
#include "no_os_gpio.h"
#include "no_os_irq.h"
#include "no_os_error.h"
#include "no_os_i2c.h"
Go to the source code of this file.
Classes | |
struct | ade7816_init_param |
struct | ade7816_desc |
Typedefs | |
typedef int(* | ade7816_reg_read) (struct ade7816_desc *desc, uint16_t reg, uint32_t *val) |
typedef int(* | ade7816_reg_write) (struct ade7816_desc *desc, uint16_t reg, uint32_t val) |
Functions | |
int | ade7816_spi_reg_read (struct ade7816_desc *desc, uint16_t reg, uint32_t *val) |
ADE7816 SPI Read Register function. | |
int | ade7816_spi_reg_write (struct ade7816_desc *desc, uint16_t reg, uint32_t val) |
ADE7816 SPI Write Register function. | |
int | ade7816_i2c_reg_read (struct ade7816_desc *desc, uint16_t reg, uint32_t *val) |
ADE7816 I2C Read Register function. | |
int | ade7816_i2c_reg_write (struct ade7816_desc *desc, uint16_t reg, uint32_t val) |
ADE7816 I2C Write Register function. | |
int | ade7816_read_reg (struct ade7816_desc *desc, uint16_t reg, uint32_t *val) |
Register read wrapper function. | |
int | ade7816_write_reg (struct ade7816_desc *desc, uint16_t reg, uint32_t val) |
Register write wrapper function. | |
int | ade7816_reg_update (struct ade7816_desc *desc, uint16_t reg, uint32_t mask, uint32_t val) |
Register update function. | |
int | ade7816_sw_reset (struct ade7816_desc *desc) |
ADE7816 software reset function. | |
int | ade7816_hw_reset (struct ade7816_desc *desc) |
ADE7816 hardware reset function. | |
int | ade7816_set_comm (struct ade7816_desc *desc, enum ade7816_comm_type type) |
ADE7816 set communication function. | |
int | ade7816_read_active_energy (struct ade7816_desc *desc, enum ade7816_channel chan, int32_t *val) |
ADE7816 read active energy function. | |
int | ade7816_set_active_thr (struct ade7816_desc *desc, uint16_t freq) |
ADE7816 set active energy threshold value function. | |
int | ade7816_get_active_thr (struct ade7816_desc *desc, uint16_t *freq) |
ADE7816 get active energy threshold value function. | |
int | ade7816_read_reactive_energy (struct ade7816_desc *desc, enum ade7816_channel chan, int32_t *val) |
ADE7816 read reactive energy value function. | |
int | ade7816_set_reactive_thr (struct ade7816_desc *desc, uint16_t freq) |
ADE7816 set reactive energy threshold value function. | |
int | ade7816_get_reactive_thr (struct ade7816_desc *desc, uint16_t *freq) |
ADE7816 get reactive energy threshold value function. | |
int | ade7816_set_lcycle_mode (struct ade7816_desc *desc, bool enable, uint16_t cycles, bool lenergy) |
ADE7816 set line cycle mode function. | |
int | ade7816_read_rms (struct ade7816_desc *desc, enum ade7816_channel chan, uint32_t *rms) |
ADE7816 read root mean square measurement value function. | |
int | ade7816_set_no_load (struct ade7816_desc *desc, uint16_t voltage, uint16_t current, bool enable) |
ADE7816 set no load condition function. | |
int | ade7816_set_gain (struct ade7816_desc *desc, enum ade7816_channel chan, int16_t scale, enum ade7816_gain_type gain) |
ADE7816 set gain value for channel function. | |
int | ade7816_get_gain (struct ade7816_desc *desc, enum ade7816_channel chan, int16_t *scale, enum ade7816_gain_type gain) |
ADE7816 get gain value for channel function. | |
int | ade7816_set_offset (struct ade7816_desc *desc, enum ade7816_channel chan, int16_t scale, enum ade7816_gain_type gain) |
ADE7816 set offset value for channel function. | |
int | ade7816_get_offset (struct ade7816_desc *desc, enum ade7816_channel chan, int16_t *scale, enum ade7816_gain_type gain) |
ADE7816 get offset value for channel function. | |
int | ade7816_set_phase (struct ade7816_desc *desc, enum ade7816_channel chan, enum ade7816_pcf_coeff pcf_coeff) |
ADE7816 set phase calibration coefficient function. | |
int | ade7816_calib_rms (struct ade7816_desc *desc, enum ade7816_channel chan, int32_t rms) |
ADE7816 root mean square measurement calibration function. | |
int | ade7816_group_sel (struct ade7816_desc *desc, enum ade7816_channel chan) |
ADE7816 group selection for channels function. | |
int | ade7816_zx_detect (struct ade7816_desc *desc, enum ade7816_channel chan) |
ADE7816 zero-crossing detection for channel function. | |
int | ade7816_zx_timeout (struct ade7816_desc *desc, uint32_t timeout_us) |
ADE7816 zero-crossing detection timeout value function. | |
int | ade7816_peak_detect (struct ade7816_desc *desc, enum ade7816_channel chan, enum ade7816_mmode_sel mmode, uint8_t no_of_cycles) |
ADE7816 set peak detection for channel function. | |
int | ade7816_power_dir (struct ade7816_desc *desc, enum ade7816_channel chan) |
ADE7816 set power direction for channel function. | |
int | ade7816_read_dir (struct ade7816_desc *desc, enum ade7816_channel chan, bool *sign) |
ADE7816 get power direction for channel function. | |
int | ade7816_angle_meas (struct ade7816_desc *desc, enum ade7816_channel chan, enum ade7816_angle_sel sel) |
ADE7816 angle measurement function. | |
int | ade7816_read_period (struct ade7816_desc *desc, uint32_t *period_us) |
ADE7816 read period value function. | |
int | ade7816_set_interrupt (struct ade7816_desc *desc, enum ade7816_status_int status_int, bool enable) |
ADE7816 set interrupts function. | |
int | ade7816_get_interrupt (struct ade7816_desc *desc, enum ade7816_status_int status_int, bool *enable) |
ADE7816 get interrupts function. | |
int | ade7816_rms_to_micro (struct ade7816_desc *desc, enum ade7816_channel chan, uint32_t rms, uint32_t *micro) |
ADE7816 root mean square measurement value conversion to microunits function. | |
int | ade7816_init (struct ade7816_desc **desc, struct ade7816_init_param *init_param) |
Initialize and configure the ADE7816 device. | |
int | ade7816_remove (struct ade7816_desc *desc) |
Free the resources allocated during init. | |
Header file of ADE7816 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.
#define ADE7816_ACCMODE_REG 0xE701 |
#define ADE7816_ANGLE0_REG 0xE601 |
#define ADE7816_ANGLE1_REG 0xE602 |
#define ADE7816_ANGLE2_REG 0xE603 |
#define ADE7816_ANGLESEL_MASK NO_OS_GENMASK(10, 9) |
#define ADE7816_APNOLOAD_REG 0x43AF |
#define ADE7816_AVARGAIN_REG 0x439D |
#define ADE7816_AVARHR_REG 0xE406 |
#define ADE7816_AVAROS_REG 0x439E |
#define ADE7816_AWATTHR_REG 0xE400 |
#define ADE7816_AWATTOS_REG 0x4392 |
#define ADE7816_AWGAIN_REG 0x4391 |
#define ADE7816_BVARGAIN_REG 0x439F |
#define ADE7816_BVARHR_REG 0xE407 |
#define ADE7816_BVAROS_REG 0x43A0 |
#define ADE7816_BWATTHR_REG 0xE401 |
#define ADE7816_BWATTOS_REG 0x4394 |
#define ADE7816_BWGAIN_REG 0x4393 |
#define ADE7816_CHANNEL_SEL_MASK NO_OS_BIT(14) |
#define ADE7816_CHECKSUM_REG 0xE51F |
#define ADE7816_CHECKSUM_VAL 0x33666787 |
#define ADE7816_CHNOLOAD_REG 0xE608 |
#define ADE7816_CHSIGN_REG 0xE617 |
#define ADE7816_CHSTATUS_REG 0xE600 |
#define ADE7816_COMPMODE_REG 0xE60E |
#define ADE7816_CONFIG2_REG 0xEC01 |
#define ADE7816_CONFIG_REG 0xE618 |
#define ADE7816_CVARGAIN_REG 0x43A1 |
#define ADE7816_CVARHR_REG 0xE408 |
#define ADE7816_CVAROS_REG 0x43A2 |
#define ADE7816_CWATTHR_REG 0xE402 |
#define ADE7816_CWATTOS_REG 0x4396 |
#define ADE7816_CWGAIN_REG 0x4395 |
#define ADE7816_DICOEFF_REG 0x4388 |
#define ADE7816_DREADY_MASK NO_OS_BIT(17) |
#define ADE7816_DVARGAIN_REG 0x43A3 |
#define ADE7816_DVARHR_REG 0xE409 |
#define ADE7816_DVAROS_REG 0x43A4 |
#define ADE7816_DWATTHR_REG 0xE403 |
#define ADE7816_DWATTOS_REG 0x4398 |
#define ADE7816_DWGAIN_REG 0x4397 |
#define ADE7816_EVARGAIN_REG 0x43A5 |
#define ADE7816_EVARHR_REG 0xE40A |
#define ADE7816_EVAROS_REG 0x43A6 |
#define ADE7816_EWATTHR_REG 0xE404 |
#define ADE7816_EWATTOS_REG 0x439A |
#define ADE7816_EWGAIN_REG 0x4399 |
#define ADE7816_FIRST_BYTE_MASK NO_OS_GENMASK(7, 0) |
#define ADE7816_FOURTH_BYTE_MASK NO_OS_GENMASK(31, 24) |
#define ADE7816_FVARGAIN_REG 0x43A7 |
#define ADE7816_FVARHR_REG 0xE40B |
#define ADE7816_FVAROS_REG 0x43A8 |
#define ADE7816_FWATTHR_REG 0xE405 |
#define ADE7816_FWATTOS_REG 0x439C |
#define ADE7816_FWGAIN_REG 0x439B |
#define ADE7816_GAIN_REG 0xE60F |
#define ADE7816_HPFDIS_REG 0x4389 |
#define ADE7816_HSDC_CFG_REG 0xE706 |
#define ADE7816_HWRST_DELAY 10 |
#define ADE7816_I2C_LOCK_MASK NO_OS_BIT(1) |
#define ADE7816_IAGAIN_REG 0x4381 |
#define ADE7816_IARMS_REG 0x43C1 |
#define ADE7816_IARMSOS_REG 0x438B |
#define ADE7816_IAVW_IDVW_REG 0xE50C |
#define ADE7816_IBGAIN_REG 0x4382 |
#define ADE7816_IBRMS_REG 0x43C2 |
#define ADE7816_IBRMSOS_REG 0x438C |
#define ADE7816_IBVW_IEVW_REG 0xE50D |
#define ADE7816_ICGAIN_REG 0x4383 |
#define ADE7816_ICRMS_REG 0x43C3 |
#define ADE7816_ICRMSOS_REG 0x438D |
#define ADE7816_ICVW_IFVW_REG 0xE50E |
#define ADE7816_IDGAIN_REG 0x4384 |
#define ADE7816_IDRMS_REG 0x43C4 |
#define ADE7816_IDRMSOS_REG 0x438E |
#define ADE7816_IEGAIN_REG 0x4385 |
#define ADE7816_IERMS_REG 0x43C5 |
#define ADE7816_IERMSOS_REG 0x438F |
#define ADE7816_IFGAIN_REG 0x4386 |
#define ADE7816_IFRMS_REG 0x43C6 |
#define ADE7816_IFRMSOS_REG 0x4390 |
#define ADE7816_INIT_DELAY 40 |
#define ADE7816_INT_MASK | ( | x | ) |
#define ADE7816_IPEAK_REG 0xE500 |
#define ADE7816_LCYCMODE_REG 0xE702 |
#define ADE7816_LENERGY_MASK NO_OS_BIT(5) |
#define ADE7816_LINECYC_REG 0xE60C |
#define ADE7816_LINECYC_VAL | ( | enable | ) |
#define ADE7816_LMASK NO_OS_GENMASK(1, 0) |
#define ADE7816_LSB_REG_MASK NO_OS_GENMASK(7, 0) |
#define ADE7816_MASK0_REG 0xE50A |
#define ADE7816_MASK1_REG 0xE50B |
#define ADE7816_MMODE_MASK NO_OS_GENMASK(4, 2) |
#define ADE7816_MMODE_REG 0xE700 |
#define ADE7816_MSB_REG_MASK NO_OS_GENMASK(15, 8) |
#define ADE7816_OIVL_REG 0xE507 |
#define ADE7816_OVLVL_REG 0xE508 |
#define ADE7816_PCF_A_COEFF_REG 0x43B1 |
#define ADE7816_PCF_B_COEFF_REG 0x43B3 |
#define ADE7816_PCF_C_COEFF_REG 0x43B4 |
#define ADE7816_PCF_D_COEFF_REG 0x43B5 |
#define ADE7816_PCF_E_COEFF_REG 0x43B6 |
#define ADE7816_PCF_F_COEFF_REG 0x43B7 |
#define ADE7816_PEAKCYC_REG 0xE703 |
#define ADE7816_PERIOD_REG 0xE607 |
#define ADE7816_REVSEL_MASK NO_OS_GENMASK(7, 6) |
#define ADE7816_RSTREAD_MASK NO_OS_BIT(6) |
#define ADE7816_RUN_REG 0xE228 |
#define ADE7816_SAGCYC_REG 0xE704 |
#define ADE7816_SAGLVL_REG 0xE509 |
#define ADE7816_SECOND_BYTE_MASK NO_OS_GENMASK(15, 8) |
#define ADE7816_SIGN_MASK | ( | x | ) |
#define ADE7816_STATUS0_REG 0xE502 |
#define ADE7816_STATUS1_REG 0xE503 |
#define ADE7816_SWRST_MASK NO_OS_BIT(7) |
#define ADE7816_THIRD_BYTE_MASK NO_OS_GENMASK(23, 16) |
#define ADE7816_THR_LSB_MASK NO_OS_GENMASK(23, 0) |
#define ADE7816_THR_MSB_MASK NO_OS_GENMASK(31, 24) |
#define ADE7816_VARNOLOAD_REG 0x43B0 |
#define ADE7816_VARTHR0_REG 0x43AE |
#define ADE7816_VARTHR1_REG 0x43AD |
#define ADE7816_VERSION_REG 0xE707 |
#define ADE7816_VGAIN_REG 0x4380 |
#define ADE7816_VPEAK_REG 0xE501 |
#define ADE7816_VRMS_REG 0x43C0 |
#define ADE7816_VRMSOS_REG 0x438A |
#define ADE7816_VWV_REG 0xE510 |
#define ADE7816_WTHR0_REG 0x43AC |
#define ADE7816_WTHR1_REG 0x43AB |
#define ADE7816_ZSPE_MASK NO_OS_GENMASK(27, 0) |
#define ADE7816_ZX_SEL_MASK NO_OS_BIT(3) |
#define ADE7816_ZXTOUT_REG 0xE60D |
typedef int(* ade7816_reg_read) (struct ade7816_desc *desc, uint16_t reg, uint32_t *val) |
typedef int(* ade7816_reg_write) (struct ade7816_desc *desc, uint16_t reg, uint32_t val) |
enum ade7816_active_irq |
enum ade7816_angle_sel |
enum ade7816_channel |
enum ade7816_comm_type |
enum ade7816_gain_type |
enum ade7816_mmode_sel |
enum ade7816_pcf_coeff |
enum ade7816_status_int |
int ade7816_angle_meas | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
enum ade7816_angle_sel | sel ) |
ADE7816 angle measurement function.
ADE7816 angle measurement function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
sel | - Angle selection value. |
int ade7816_calib_rms | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
int32_t | rms ) |
ADE7816 root mean square measurement calibration function.
ADE7816 root mean square measurement calibration function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
rms | - Expected root mean square measurement value. |
int ade7816_get_active_thr | ( | struct ade7816_desc * | desc, |
uint16_t * | freq ) |
ADE7816 get active energy threshold value function.
ADE7816 get active energy threshold value function.
desc | - ADE7816 device descriptor. |
freq | - Update rate frequency. |
int ade7816_get_gain | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
int16_t * | scale, | ||
enum ade7816_gain_type | gain ) |
ADE7816 get gain value for channel function.
ADE7816 get gain value for channel function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
scale | - Scale percentage of full-scale (100.00% = 10000) |
gain | - Gain type. |
int ade7816_get_interrupt | ( | struct ade7816_desc * | desc, |
enum ade7816_status_int | status_int, | ||
bool * | enable ) |
ADE7816 get interrupts function.
ADE7816 get interrupts function.
desc- | ADE7816 device descriptor. |
status_int | - Interrupt selection value. |
enable | - False = Disable True = Enable |
int ade7816_get_offset | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
int16_t * | scale, | ||
enum ade7816_gain_type | gain ) |
ADE7816 get offset value for channel function.
ADE7816 get offset value for channel function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
scale | - Scale percentage value (100.00% = 10000) |
gain | - Gain type. |
int ade7816_get_reactive_thr | ( | struct ade7816_desc * | desc, |
uint16_t * | freq ) |
ADE7816 get reactive energy threshold value function.
ADE7816 get reactive energy threshold value function.
desc | - ADE7816 device descriptor. |
freq | - Update rate frequency. |
int ade7816_group_sel | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan ) |
ADE7816 group selection for channels function.
ADE7816 group selection for channels function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
int ade7816_hw_reset | ( | struct ade7816_desc * | desc | ) |
ADE7816 hardware reset function.
ADE7816 hardware reset function.
desc | - ADE7816 device descriptor |
int ade7816_i2c_reg_read | ( | struct ade7816_desc * | desc, |
uint16_t | reg, | ||
uint32_t * | val ) |
ADE7816 I2C Read Register function.
ADE7816 I2C Read Register function.
desc | - ADE7816 device descriptor. |
reg | - Register Address value. |
val | - Register Value to be read. |
int ade7816_i2c_reg_write | ( | struct ade7816_desc * | desc, |
uint16_t | reg, | ||
uint32_t | val ) |
ADE7816 I2C Write Register function.
ADE7816 I2C Write Register function.
desc | - ADE7816 device descriptor |
reg | - Register Address value. |
val | - Register Value to be written. |
int ade7816_init | ( | struct ade7816_desc ** | desc, |
struct ade7816_init_param * | init_param ) |
Initialize and configure the ADE7816 device.
Initialize and configure the ADE7816 device.
desc | - device descriptor for the ADE7816 that will be initialized. |
init_param | - initialization parameter for the device. |
int ade7816_peak_detect | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
enum ade7816_mmode_sel | mmode, | ||
uint8_t | no_of_cycles ) |
ADE7816 set peak detection for channel function.
ADE7816 set peak detection for channel function.
desc- | ADE7816 device descriptor. |
chan | - Channel number. |
mmode | - Measurement mode selection value. |
no_of_cycles | - Set the line cycles number over which peak measurements are performed. |
int ade7816_power_dir | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan ) |
ADE7816 set power direction for channel function.
ADE7816 set power direction for channel function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
int ade7816_read_active_energy | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
int32_t * | val ) |
ADE7816 read active energy function.
ADE7816 read active energy function.
desc | - ADE7816 device descriptor |
chan | - Channel number. |
val | - Active energy value. |
int ade7816_read_dir | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
bool * | sign ) |
ADE7816 get power direction for channel function.
ADE7816 get power direction for channel function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
sign | - Power direction sign. |
int ade7816_read_period | ( | struct ade7816_desc * | desc, |
uint32_t * | period_us ) |
ADE7816 read period value function.
ADE7816 read period value function.
desc | - ADE7816 device descriptor. |
period_us | - Period value in microseconds. |
int ade7816_read_reactive_energy | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
int32_t * | val ) |
ADE7816 read reactive energy value function.
ADE7816 read reactive energy value function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
val | - Reactive energy value. |
int ade7816_read_reg | ( | struct ade7816_desc * | desc, |
uint16_t | reg, | ||
uint32_t * | val ) |
Register read wrapper function.
Register read wrapper function.
desc | - ADE7816 device descriptor. |
reg | - Register Address value. |
val | - Register Value to be read. |
int ade7816_read_rms | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
uint32_t * | rms ) |
ADE7816 read root mean square measurement value function.
ADE7816 read root mean square measurement value function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
rms | - RMS value. |
int ade7816_reg_update | ( | struct ade7816_desc * | desc, |
uint16_t | reg, | ||
uint32_t | mask, | ||
uint32_t | val ) |
Register update function.
Register update function.
desc | - ADE7816 device descriptor. |
reg | - address of the register. |
mask | - bit mask of the field to be updated. |
val | - value of the masked field. Should be bit shifted by using no_os_field_prep(mask, val). |
int ade7816_remove | ( | struct ade7816_desc * | desc | ) |
Free the resources allocated during init.
Free the resources allocated during init.
desc | - device descriptor for the ADE7816 that will be initialized. |
int ade7816_rms_to_micro | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
uint32_t | rms, | ||
uint32_t * | micro ) |
ADE7816 root mean square measurement value conversion to microunits function.
ADE7816 root mean square measurement value conversion to microunits function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
rms | - RMS value. |
micro | - RMs value in microunits. |
int ade7816_set_active_thr | ( | struct ade7816_desc * | desc, |
uint16_t | freq ) |
ADE7816 set active energy threshold value function.
ADE7816 set active energy threshold value function.
desc | - ADE7816 device descriptor. |
freq | - Update rate frequency. |
int ade7816_set_comm | ( | struct ade7816_desc * | desc, |
enum ade7816_comm_type | type ) |
ADE7816 set communication function.
ADE7816 set communication function.
desc | - ADE7816 device descriptor |
type | - Communication type. |
int ade7816_set_gain | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
int16_t | scale, | ||
enum ade7816_gain_type | gain ) |
ADE7816 set gain value for channel function.
ADE7816 set gain value for channel function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
scale | - Scale percentage of full-scale (100.00% = 10000) |
gain | - Gain type. |
int ade7816_set_interrupt | ( | struct ade7816_desc * | desc, |
enum ade7816_status_int | status_int, | ||
bool | enable ) |
ADE7816 set interrupts function.
ADE7816 set interrupts function.
desc- | ADE7816 device descriptor. |
status_int | - Interrupt selection value. |
enable | - False = Disable True = Enable |
int ade7816_set_lcycle_mode | ( | struct ade7816_desc * | desc, |
bool | enable, | ||
uint16_t | cycles, | ||
bool | lenergy ) |
ADE7816 set line cycle mode function.
ADE7816 set line cycle mode function.
desc | - ADE7816 device descriptor. |
enable | - False = Disable True = Enable |
cycles | - Cycle lines number. |
lenergy | - Set lenergy bit. |
int ade7816_set_no_load | ( | struct ade7816_desc * | desc, |
uint16_t | voltage, | ||
uint16_t | current, | ||
bool | enable ) |
ADE7816 set no load condition function.
ADE7816 set no load condition function.
desc | - ADE7816 device descriptor. |
voltage | - Voltage percent of the full-scale (100.00% = 10000). |
current | - Current percent of the full-scale (100.00% = 10000). |
enable | - False = Disable True = Enable |
int ade7816_set_offset | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
int16_t | scale, | ||
enum ade7816_gain_type | gain ) |
ADE7816 set offset value for channel function.
ADE7816 set offset value for channel function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
scale | - Scale percentage value (100.00% = 10000) |
gain | - Gain type. |
int ade7816_set_phase | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan, | ||
enum ade7816_pcf_coeff | pcf_coeff ) |
ADE7816 set phase calibration coefficient function.
ADE7816 set phase calibration coefficient function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
pcf_coeff | - Phase coefficient value. |
int ade7816_set_reactive_thr | ( | struct ade7816_desc * | desc, |
uint16_t | freq ) |
ADE7816 set reactive energy threshold value function.
ADE7816 set reactive energy threshold value function.
desc | - ADE7816 device descriptor. |
freq | - Update rate frequency. |
int ade7816_spi_reg_read | ( | struct ade7816_desc * | desc, |
uint16_t | reg, | ||
uint32_t * | val ) |
ADE7816 SPI Read Register function.
ADE7816 SPI Read Register function.
desc | - ADE7816 device descriptor. |
reg | - Register Address value. |
val | - Register Value to be read. |
int ade7816_spi_reg_write | ( | struct ade7816_desc * | desc, |
uint16_t | reg, | ||
uint32_t | val ) |
ADE7816 SPI Write Register function.
ADE7816 SPI Write Register function.
desc | - ADE7816 device descriptor |
reg | - Register Address value. |
val | - Register Value to be written. |
int ade7816_sw_reset | ( | struct ade7816_desc * | desc | ) |
ADE7816 software reset function.
ADE7816 software reset function.
desc | - ADE7816 device descriptor. |
int ade7816_write_reg | ( | struct ade7816_desc * | desc, |
uint16_t | reg, | ||
uint32_t | val ) |
Register write wrapper function.
Register write wrapper function.
desc | - ADE7816 device descriptor |
reg | - Register Address value. |
val | - Register Value to be written. |
int ade7816_zx_detect | ( | struct ade7816_desc * | desc, |
enum ade7816_channel | chan ) |
ADE7816 zero-crossing detection for channel function.
ADE7816 zero-crossing detection for channel function.
desc | - ADE7816 device descriptor. |
chan | - Channel number. |
int ade7816_zx_timeout | ( | struct ade7816_desc * | desc, |
uint32_t | timeout_us ) |
ADE7816 zero-crossing detection timeout value function.
ADE7816 zero-crossing detection timeout value function.
desc | - ADE7816 device descriptor. |
timeout_us | - Timeout value in microseconds. |