no-OS
ade7913.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __ADE7913_H__
34 #define __ADE7913_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdbool.h>
40 #include <stdint.h>
41 #include <string.h>
42 #include "no_os_util.h"
43 #include "no_os_spi.h"
44 #include "no_os_gpio.h"
45 #include "no_os_irq.h"
46 
47 /******************************************************************************/
48 /********************** Macros and Constants Definitions **********************/
49 /******************************************************************************/
50 
51 /* SPI commands */
52 #define ADE7913_SPI_READ NO_OS_BIT(2)
53 
54 /* ENABLE and DISABLE */
55 #define ENABLE 1u
56 #define DISABLE 0u
57 
58 /* ADE7913 Register Map */
59 #define ADE7913_REG_IWV 0x00
60 #define ADE7913_REG_V1WV 0x01
61 #define ADE7913_REG_V2WV 0x02
62 #define ADE7913_REG_ADC_CRC 0x04
63 #define ADE7913_REG_CTRL_CRC 0x05
64 #define ADE7913_REG_CNT_SNAPSHOT 0x07
65 #define ADE7913_REG_CONFIG 0x08
66 #define ADE7913_REG_STATUS0 0x09
67 #define ADE7913_REG_LOCK 0x0A
68 #define ADE7913_REG_SYNC_SNAP 0x0B
69 #define ADE7913_REG_COUNTER0 0x0C
70 #define ADE7913_REG_COUNTER1 0x0D
71 #define ADE7913_REG_EMI_CTRL 0x0E
72 #define ADE7913_REG_STATUS1 0x0F
73 #define ADE7913_REG_TEMPOS 0x08
74 
75 /* ADE7913_REG_CNT_SNAPSHOT Bit Definition */
76 #define ADE7913_CNT_VAL_MSK NO_OS_GENMASK(11, 0)
77 
78 /* ADE7913_REG_CONFIG Bit Definition */
79 #define ADE7913_CLKOUT_EN_MSK NO_OS_BIT(0)
80 #define ADE7913_PWRDWN_EN_MSK NO_OS_BIT(2)
81 #define ADE7913_TEMP_EN_MSK NO_OS_BIT(3)
82 #define ADE7913_ADC_FREQ_MSK NO_OS_GENMASK(5, 4)
83 #define ADE7913_SWRST_MSK NO_OS_BIT(6)
84 #define ADE7913_BW_MSK NO_OS_BIT(7)
85 
86 /* ADE7913_REG_STATUS0 Bit Definition */
87 #define ADE7913_RESET_ON_MSK NO_OS_BIT(0)
88 #define ADE7913_CRC_STAT_MSK NO_OS_BIT(1)
89 #define ADE7913_IC_PROT_MSK NO_OS_BIT(2)
90 
91 /* ADE7913_REG_LOCK Bit Definition */
92 #define ADE7913_LOCK_KEY_MSK NO_OS_GENMASK(5, 4)
93 
94 /* ADE7913_REG_SYNC_SNAP Bit Definition */
95 #define ADE7913_SYNC_MSK NO_OS_BIT(0)
96 #define ADE7913_SNAP_MSK NO_OS_BIT(1)
97 
98 /* ADE7913_REG_EMI_CTRL Bit Definition */
99 #define ADE7913_SLOT0_MSK NO_OS_BIT(0)
100 #define ADE7913_SLOT1_MSK NO_OS_BIT(1)
101 #define ADE7913_SLOT2_MSK NO_OS_BIT(2)
102 #define ADE7913_SLOT3_MSK NO_OS_BIT(3)
103 #define ADE7913_SLOT4_MSK NO_OS_BIT(4)
104 #define ADE7913_SLOT5_MSK NO_OS_BIT(5)
105 #define ADE7913_SLOT6_MSK NO_OS_BIT(6)
106 #define ADE7913_SLOT7_MSK NO_OS_BIT(7)
107 
108 /* ADE7913_REG_STATUS1 Bit Definition */
109 #define ADE7913_VERSION_MSK NO_OS_GENMASK(2, 0)
110 #define ADE7913_ADC_NA_MSK NO_OS_BIT(6)
111 
112 /* Configuration Register Write Lock */
113 #define ADE7913_LOCK_KEY 0XCA
114 #define ADE7913_UNLOCK_KEY 0X9C
115 
116 /* Version Product */
117 #define ADE7913_3_CHANNEL_ADE7913 3U
118 #define ADE7913_2_CHANNEL_ADE7912 2U
119 
120 /* Nominal reference voltage */
121 #define ADE7913_VREF_V (788)
122 #define ADE7913_VREF_I (49)
123 
124 /******************************************************************************/
125 /*************************** Types Declarations *******************************/
126 /******************************************************************************/
127 
133  /* 125 us period */
135  /* 250 us period */
137  /* 500 us period */
139  /* 1 ms period */
141 };
142 
148  /* Number of devices */
149  uint8_t no_devs;
150  /* burst mode */
151  uint8_t burst_mode;
152  /* Device 1 communication descriptor */
154  /* Device 2 communication descriptor */
156  /* Device 3 communication descriptor */
158 };
159 
164 struct ade7913_dev {
173  /* Version product */
174  uint8_t *ver_product;
175  /* I_WAV */
176  int32_t *i_wav;
177  /* V1_WAV */
178  int32_t *v1_wav;
179  /* V2_WAV */
180  int32_t *v2_wav;
181  /* I_WAV multiple devices */
182  int32_t *i_wav_m;
183  /* V1_WAV multiple devices */
184  int32_t *v1_wav_m;
185  /* V2_WAV multiple devices */
186  int32_t *v2_wav_m;
187  /* ADC_CRC */
188  uint16_t *adc_crc;
189  /* Status 0 */
190  uint8_t *status0;
191  /* CNT_SNAPSHOT */
192  uint16_t *cnt_snapshot;
193  /* number of devices */
194  uint8_t no_devs;
195  /* burst mode */
196  uint8_t burst_mode;
199 };
200 
201 /******************************************************************************/
202 /************************ Functions Declarations ******************************/
203 /******************************************************************************/
204 
205 // Read device register.
206 int ade7913_read(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data);
207 
208 // Read multiple devices
209 int ade7913_read_waveforms(struct ade7913_dev *dev, uint8_t reg_addr,
210  uint8_t *reg_data);
211 
212 // Write device register.
213 int ade7913_write(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t reg_data);
214 
215 // Write broadcast.
216 int ade7913_write_broadcast(struct ade7913_dev *dev, uint8_t reg_addr,
217  uint8_t *reg_data);
218 
219 // Update specific register bits.
220 static int ade7913_update_bits(struct ade7913_dev *dev, uint8_t reg_addr,
221  uint8_t mask, uint8_t reg_data);
222 
223 // Initialize the device.
224 int ade7913_init(struct ade7913_dev **device,
226 
227 // Remove the device and release resources.
228 int ade7913_remove(struct ade7913_dev *dev);
229 
230 // Reset the device using SW reset.
231 int ade7913_sw_reset(struct ade7913_dev *dev);
232 
233 // Lock device.
234 int ade7913_wr_lock(struct ade7913_dev *dev);
235 
236 // Unlock device.
237 int ade7913_wr_unlock(struct ade7913_dev *dev);
238 
239 // Get synchronization counter value.
240 int ade7913_get_sync_cnt_val(struct ade7913_dev *dev, uint16_t *counter);
241 
242 // Set clkout enable.
243 int ade7913_set_clkout_en(struct ade7913_dev *dev,
244  uint8_t clkout_en);
245 
246 // Power down enable.
247 int ade7913_pwrdwn(struct ade7913_dev *dev,
248  uint8_t pwrdwn);
249 
250 // Temperature enable.
251 int ade7913_temp_en(struct ade7913_dev *dev,
252  uint8_t temp_en);
253 
254 // Sync enable.
255 int ade7913_sync_en(struct ade7913_dev *dev);
256 
257 // Set ADC frequency
258 int ade7913_adc_freq(struct ade7913_dev *dev,
259  enum ade7913_adc_freq_e frequency);
260 
261 // Digital lpf bandwith select.
262 int ade7913_lfp_bw(struct ade7913_dev *dev, uint8_t bw);
263 
264 // CRC of config registers status
265 int ade7913_crc_status(struct ade7913_dev *dev, uint8_t *status);
266 
267 // IC config regs protection status.
268 int ade7913_ic_prot_status(struct ade7913_dev *dev, uint8_t *status);
269 
270 // Set EMI CTRL register.
271 int ade7913_emi_ctrl(struct ade7913_dev *dev,
272  uint8_t emi_ctrl);
273 
274 // ADC not accesed during one period status.
275 int ade7913_adc_na_status(struct ade7913_dev *dev, uint8_t *status);
276 
277 // Cnt snapshot.
278 int ade7913_cnt_snapshot_val(struct ade7913_dev *dev, uint16_t *val);
279 
280 // Get version product value.
282  uint8_t *ver_product);
283 
284 #endif // __ADE7913_H__
ADE7913_REG_ADC_CRC
#define ADE7913_REG_ADC_CRC
Definition: ade7913.h:62
ade7913_ic_prot_status
int ade7913_ic_prot_status(struct ade7913_dev *dev, uint8_t *status)
IC config regs protection status.
Definition: ade7913.c:828
no_os_sign_extend16
int16_t no_os_sign_extend16(uint16_t value, int index)
timeout
uint32_t timeout
Definition: ad413x.c:49
no_os_alloc.h
ade7913_init
int ade7913_init(struct ade7913_dev **device, struct ade7913_init_param init_param)
Initialize the device.
Definition: ade7913.c:342
ADE7913_BW_MSK
#define ADE7913_BW_MSK
Definition: ade7913.h:84
ADE7913_REG_SYNC_SNAP
#define ADE7913_REG_SYNC_SNAP
Definition: ade7913.h:68
ade7913_dev::v1_wav
int32_t * v1_wav
Definition: ade7913.h:178
no_os_i2c_write
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
ADE7816_CONFIG_REG
#define ADE7816_CONFIG_REG
Definition: ade7816.h:157
ade7913_read_waveforms
int ade7913_read_waveforms(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Read multiple devices.
Definition: ade7913.c:143
ade7913_dev::adc_crc
uint16_t * adc_crc
Definition: ade7913.h:188
ade7816.h
Header file of ADE7816 Driver.
ADE7816_FIRST_BYTE_MASK
#define ADE7816_FIRST_BYTE_MASK
Definition: ade7816.h:177
NO_OS_GENMASK
#define NO_OS_GENMASK(h, l)
Definition: no_os_util.h:82
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
ade7913_adc_na_status
int ade7913_adc_na_status(struct ade7913_dev *dev, uint8_t *status)
ADC not accesed during one period status.
Definition: ade7913.c:872
ade9153a_read
int ade9153a_read(struct ade9153a_dev *dev, uint16_t reg_addr, uint32_t *reg_data)
Read device register.
Definition: ade9153a.c:365
ade7913_cnt_snapshot_val
int ade7913_cnt_snapshot_val(struct ade7913_dev *dev, uint16_t *val)
Cnt snapshot.
Definition: ade7913.c:899
ADE7913_IC_PROT_MSK
#define ADE7913_IC_PROT_MSK
Definition: ade7913.h:89
no_os_spi.h
Header file of SPI Interface.
ade7913_dev::spi_desc2
struct no_os_spi_desc * spi_desc2
Definition: ade7913.h:172
no_os_irq.h
Header file of IRQ interface.
ade7913_pwrdwn
int ade7913_pwrdwn(struct ade7913_dev *dev, uint8_t pwrdwn)
Power down enable.
Definition: ade7913.c:700
ADE7816_LSB_REG_MASK
#define ADE7816_LSB_REG_MASK
Definition: ade7816.h:171
ade7816_desc::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ade7816.h:328
ade7913_init_param::burst_mode
uint8_t burst_mode
Definition: ade7913.h:151
no_os_units.h
Header file of Units.
ADE7913_REG_STATUS0
#define ADE7913_REG_STATUS0
Definition: ade7913.h:66
ade7816_desc::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: ade7816.h:329
ade7913_cnt_snapshot_val
int ade7913_cnt_snapshot_val(struct ade7913_dev *dev, uint16_t *val)
Cnt snapshot.
Definition: ade7913.c:899
ade7913_init
int ade7913_init(struct ade7913_dev **device, struct ade7913_init_param init_param)
Initialize the device.
Definition: ade7913.c:342
ade7913_init_param::spi_init1
struct no_os_spi_init_param * spi_init1
Definition: ade7913.h:155
ADE7816_ZSPE_MASK
#define ADE7816_ZSPE_MASK
Definition: ade7816.h:183
no_os_delay.h
Header file of Delay functions.
ade7913_wr_lock
int ade7913_wr_lock(struct ade7913_dev *dev)
Lock device.
Definition: ade7913.c:629
ADE7913_REG_STATUS1
#define ADE7913_REG_STATUS1
Definition: ade7913.h:72
ade7913_emi_ctrl
int ade7913_emi_ctrl(struct ade7913_dev *dev, uint8_t emi_ctrl)
Set EMI CTRL register.
Definition: ade7913.c:855
ade7816_desc
Definition: ade7816.h:327
ADE7913_2_CHANNEL_ADE7912
#define ADE7913_2_CHANNEL_ADE7912
Definition: ade7913.h:118
ade7913_dev::v2_wav_m
int32_t * v2_wav_m
Definition: ade7913.h:186
ENABLE
#define ENABLE
Definition: ad77681.h:339
device
Definition: ad9361_util.h:69
no_os_print_log.h
Print messages helpers.
ADE7913_REG_COUNTER1
#define ADE7913_REG_COUNTER1
Definition: ade7913.h:70
ade7913_read
int ade7913_read(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Read device register.
Definition: ade7913.c:60
ADE7816_MSB_REG_MASK
#define ADE7816_MSB_REG_MASK
Definition: ade7816.h:172
ADE7816_THIRD_BYTE_MASK
#define ADE7816_THIRD_BYTE_MASK
Definition: ade7816.h:175
ADE7913_REG_COUNTER0
#define ADE7913_REG_COUNTER0
Definition: ade7913.h:69
ade7913_temp_en
int ade7913_temp_en(struct ade7913_dev *dev, uint8_t temp_en)
Temperature enable.
Definition: ade7913.c:716
ADE7816_CONFIG2_REG
#define ADE7816_CONFIG2_REG
Definition: ade7816.h:168
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
ade7913_dev
ADE7913 Device structure.
Definition: ade7913.h:164
ade7913_init_param::spi_init0
struct no_os_spi_init_param * spi_init0
Definition: ade7913.h:153
ade7913_sw_reset
int ade7913_sw_reset(struct ade7913_dev *dev)
Reset the device using SW reset.
Definition: ade7913.c:593
ADE7913_REG_CONFIG
#define ADE7913_REG_CONFIG
Definition: ade7913.h:65
ADE7816_FVAROS_REG
#define ADE7816_FVAROS_REG
Definition: ade7816.h:87
ade7913_dev::status0
uint8_t * status0
Definition: ade7913.h:190
ADE7816_VGAIN_REG
#define ADE7816_VGAIN_REG
Definition: ade7816.h:47
ade7913_remove
int ade7913_remove(struct ade7913_dev *dev)
Remove the device and release resources.
Definition: ade7913.c:562
ADE7816_MMODE_REG
#define ADE7816_MMODE_REG
Definition: ade7816.h:159
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
ADE7913_REG_V2WV
#define ADE7913_REG_V2WV
Definition: ade7913.h:61
ade7913_dev::i_wav_m
int32_t * i_wav_m
Definition: ade7913.h:182
ade7913_remove
int ade7913_remove(struct ade7913_dev *dev)
Remove the device and release resources.
Definition: ade7913.c:562
ADE7913_ADC_FREQ_8KHZ
@ ADE7913_ADC_FREQ_8KHZ
Definition: ade7913.h:134
no_os_error.h
Error codes definition.
ADE7816_SECOND_BYTE_MASK
#define ADE7816_SECOND_BYTE_MASK
Definition: ade7816.h:176
ADE7913_SYNC_MSK
#define ADE7913_SYNC_MSK
Definition: ade7913.h:95
ade7913_read_waveforms
int ade7913_read_waveforms(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Read multiple devices.
Definition: ade7913.c:143
ade7913_crc_status
int ade7913_crc_status(struct ade7913_dev *dev, uint8_t *status)
CRC of config registers status.
Definition: ade7913.c:801
ade7913_wr_unlock
int ade7913_wr_unlock(struct ade7913_dev *dev)
Unlock device.
Definition: ade7913.c:642
ade7913_dev::v1_wav_m
int32_t * v1_wav_m
Definition: ade7913.h:184
ade7816_i2c_reg_read
int ade7816_i2c_reg_read(struct ade7816_desc *desc, uint16_t reg, uint32_t *val)
ADE7816 I2C Read Register function.
Definition: ade7816_i2c.c:48
no_os_crc16.h
Header file of CRC-16 computation.
ade7913_dev::burst_mode
uint8_t burst_mode
Definition: ade7913.h:196
ade7913_dev::irq_ctrl
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: ade7913.h:198
ade7913_init_param
ADE7913 Device initialization parameters.
Definition: ade7913.h:147
ade7913_write
int ade7913_write(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Write device register.
Definition: ade7913.c:230
no_os_get_unaligned_be24
uint32_t no_os_get_unaligned_be24(uint8_t *buf)
ade7913_get_version_product
int ade7913_get_version_product(struct ade7913_dev *dev, uint8_t *ver_product)
Get version product value.
Definition: ade7913.c:924
ade7913_ic_prot_status
int ade7913_ic_prot_status(struct ade7913_dev *dev, uint8_t *status)
IC config regs protection status.
Definition: ade7913.c:828
ade7913_dev::spi_desc0
struct no_os_spi_desc * spi_desc0
Definition: ade7913.h:168
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
ade7913_dev::v2_wav
int32_t * v2_wav
Definition: ade7913.h:180
ade7913_init_param::no_devs
uint8_t no_devs
Definition: ade7913.h:149
ade7913.h
Header file of ADE7913 Driver.
ADE7913_REG_CNT_SNAPSHOT
#define ADE7913_REG_CNT_SNAPSHOT
Definition: ade7913.h:64
ade7913_sync_en
int ade7913_sync_en(struct ade7913_dev *dev)
Sync enable.
Definition: ade7913.c:731
ade7913_set_clkout_en
int ade7913_set_clkout_en(struct ade7913_dev *dev, uint8_t clkout_en)
Set clkout enable.
Definition: ade7913.c:684
ade7913_sw_reset
int ade7913_sw_reset(struct ade7913_dev *dev)
Reset the device using SW reset.
Definition: ade7913.c:593
ade7913_write
int ade7913_write(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Write device register.
Definition: ade7913.c:230
ade7913_adc_freq
int ade7913_adc_freq(struct ade7913_dev *dev, enum ade7913_adc_freq_e frequency)
Set ADC frequency.
Definition: ade7913.c:746
ADE7913_REG_EMI_CTRL
#define ADE7913_REG_EMI_CTRL
Definition: ade7913.h:71
ade7913_get_version_product
int ade7913_get_version_product(struct ade7913_dev *dev, uint8_t *ver_product)
Get version product value.
Definition: ade7913.c:924
ade7913_init_param::spi_init2
struct no_os_spi_init_param * spi_init2
Definition: ade7913.h:157
no_os_i2c_read
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:190
ADE7913_LOCK_KEY
#define ADE7913_LOCK_KEY
Definition: ade7913.h:113
ADE7913_ADC_FREQ_4KHZ
@ ADE7913_ADC_FREQ_4KHZ
Definition: ade7913.h:136
ade7913_dev::i_wav
int32_t * i_wav
Definition: ade7913.h:176
no_os_i2c.h
Header file of I2C Interface.
ade7913_lfp_bw
int ade7913_lfp_bw(struct ade7913_dev *dev, uint8_t bw)
Digital lpf bandwith select.
Definition: ade7913.c:786
ADE7913_PWRDWN_EN_MSK
#define ADE7913_PWRDWN_EN_MSK
Definition: ade7913.h:80
ADE7816_CHSTATUS_REG
#define ADE7816_CHSTATUS_REG
Definition: ade7816.h:143
ADE7913_REG_V1WV
#define ADE7913_REG_V1WV
Definition: ade7913.h:60
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
ADE7913_UNLOCK_KEY
#define ADE7913_UNLOCK_KEY
Definition: ade7913.h:114
ade7913_adc_freq_e
ade7913_adc_freq_e
ADE7913 ADC output frequency.
Definition: ade7913.h:132
ade7913_get_sync_cnt_val
int ade7913_get_sync_cnt_val(struct ade7913_dev *dev, uint16_t *counter)
Get synchronization counter value.
Definition: ade7913.c:656
ADE7913_ADC_FREQ_MSK
#define ADE7913_ADC_FREQ_MSK
Definition: ade7913.h:82
ade7913_wr_lock
int ade7913_wr_lock(struct ade7913_dev *dev)
Lock device.
Definition: ade7913.c:629
ADE7913_VERSION_MSK
#define ADE7913_VERSION_MSK
Definition: ade7913.h:109
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
ade7816_i2c_reg_write
int ade7816_i2c_reg_write(struct ade7816_desc *desc, uint16_t reg, uint32_t val)
ADE7816 I2C Write Register function.
Definition: ade7816_i2c.c:98
no_os_get_unaligned_le16
uint16_t no_os_get_unaligned_le16(uint8_t *buf)
ade7816_spi_reg_write
int ade7816_spi_reg_write(struct ade7816_desc *desc, uint16_t reg, uint32_t val)
ADE7816 SPI Write Register function.
Definition: ade7816_spi.c:109
ade7913_sync_en
int ade7913_sync_en(struct ade7913_dev *dev)
Sync enable.
Definition: ade7913.c:731
ade7913_set_clkout_en
int ade7913_set_clkout_en(struct ade7913_dev *dev, uint8_t clkout_en)
Set clkout enable.
Definition: ade7913.c:684
ADE7816_FOURTH_BYTE_MASK
#define ADE7816_FOURTH_BYTE_MASK
Definition: ade7816.h:174
ade7913_write_broadcast
int ade7913_write_broadcast(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Write broadcast.
Definition: ade7913.c:259
ade7913_read
int ade7913_read(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Read device register.
Definition: ade7913.c:60
no_os_get_unaligned_be32
uint32_t no_os_get_unaligned_be32(uint8_t *buf)
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ade7913_temp_en
int ade7913_temp_en(struct ade7913_dev *dev, uint8_t temp_en)
Temperature enable.
Definition: ade7913.c:716
ade7913_dev::no_devs
uint8_t no_devs
Definition: ade7913.h:194
ADE7913_ADC_FREQ_2KHZ
@ ADE7913_ADC_FREQ_2KHZ
Definition: ade7913.h:138
ADE7913_CNT_VAL_MSK
#define ADE7913_CNT_VAL_MSK
Definition: ade7913.h:76
ade7913_pwrdwn
int ade7913_pwrdwn(struct ade7913_dev *dev, uint8_t pwrdwn)
Power down enable.
Definition: ade7913.c:700
ade7913_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ade7913.h:166
ADE7913_TEMP_EN_MSK
#define ADE7913_TEMP_EN_MSK
Definition: ade7913.h:81
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
ade7913_get_sync_cnt_val
int ade7913_get_sync_cnt_val(struct ade7913_dev *dev, uint16_t *counter)
Get synchronization counter value.
Definition: ade7913.c:656
no_os_gpio.h
Header file of GPIO Interface.
ADE7913_REG_IWV
#define ADE7913_REG_IWV
Definition: ade7913.h:59
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
no_os_get_unaligned_be16
uint16_t no_os_get_unaligned_be16(uint8_t *buf)
ADE7913_REG_LOCK
#define ADE7913_REG_LOCK
Definition: ade7913.h:67
ADE7913_3_CHANNEL_ADE7913
#define ADE7913_3_CHANNEL_ADE7913
Definition: ade7913.h:117
ADE7913_SPI_READ
#define ADE7913_SPI_READ
Definition: ade7913.h:52
ade7913_dev::spi_desc1
struct no_os_spi_desc * spi_desc1
Definition: ade7913.h:170
no_os_util.h
Header file of utility functions.
ade7913_write_broadcast
int ade7913_write_broadcast(struct ade7913_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Write broadcast.
Definition: ade7913.c:259
no_os_find_first_set_bit
uint32_t no_os_find_first_set_bit(uint32_t word)
no_os_sign_extend32
int32_t no_os_sign_extend32(uint32_t value, int index)
ade7913_dev::cnt_snapshot
uint16_t * cnt_snapshot
Definition: ade7913.h:192
ade7913_emi_ctrl
int ade7913_emi_ctrl(struct ade7913_dev *dev, uint8_t emi_ctrl)
Set EMI CTRL register.
Definition: ade7913.c:855
ADE7913_ADC_NA_MSK
#define ADE7913_ADC_NA_MSK
Definition: ade7913.h:110
ade7913_crc_status
int ade7913_crc_status(struct ade7913_dev *dev, uint8_t *status)
CRC of config registers status.
Definition: ade7913.c:801
ADE7816_VARNOLOAD_REG
#define ADE7816_VARNOLOAD_REG
Definition: ade7816.h:94
no_os_irq_ctrl_desc
Definition: no_os_irq.h:123
ade7913_wr_unlock
int ade7913_wr_unlock(struct ade7913_dev *dev)
Unlock device.
Definition: ade7913.c:642
ADE7913_CRC_STAT_MSK
#define ADE7913_CRC_STAT_MSK
Definition: ade7913.h:88
ade7913_adc_freq
int ade7913_adc_freq(struct ade7913_dev *dev, enum ade7913_adc_freq_e frequency)
Set ADC frequency.
Definition: ade7913.c:746
no_os_test_bit
int no_os_test_bit(int pos, const volatile void *addr)
Definition: no_os_util.h:132
ADE7913_CLKOUT_EN_MSK
#define ADE7913_CLKOUT_EN_MSK
Definition: ade7913.h:79
no_os_crc8.h
Header file of CRC-8 computation.
errno.h
Error macro definition for ARM Compiler.
ade7913_adc_na_status
int ade7913_adc_na_status(struct ade7913_dev *dev, uint8_t *status)
ADC not accesed during one period status.
Definition: ade7913.c:872
ade7816_spi_reg_read
int ade7816_spi_reg_read(struct ade7816_desc *desc, uint16_t reg, uint32_t *val)
ADE7816 SPI Read Register function.
Definition: ade7816_spi.c:48
ade7913_lfp_bw
int ade7913_lfp_bw(struct ade7913_dev *dev, uint8_t bw)
Digital lpf bandwith select.
Definition: ade7913.c:786
ade7913_dev::ver_product
uint8_t * ver_product
Definition: ade7913.h:174
ADE7913_SWRST_MSK
#define ADE7913_SWRST_MSK
Definition: ade7913.h:83
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
ADE7913_ADC_FREQ_1KHZ
@ ADE7913_ADC_FREQ_1KHZ
Definition: ade7913.h:140