no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
common_data.h
Go to the documentation of this file.
1/***************************************************************************/
33#ifndef __COMMON_DATA_H__
34#define __COMMON_DATA_H__
35
36#include "ade7978.h"
37#include "no_os_uart.h"
38#include "no_os_pwm.h"
39#include "no_os_delay.h"
40#include "no_os_gpio.h"
41#include "no_os_spi.h"
42#include "no_os_print_log.h"
43#include "no_os_units.h"
44#include "no_os_util.h"
45#include "no_os_error.h"
46#include "maxim_uart.h"
47#include "maxim_gpio.h"
48#include "maxim_uart_stdio.h"
49#include "maxim_pwm.h"
50#include "maxim_spi.h"
51#include "maxim_irq.h"
52
53/* Hardware dependent definitions */
54
55/* Current sesing using a shunt */
56/* Value of shunt in mohms */
57#define ADE7978_SHUNT_RES 1
58
59/* Assuming a voltage divider with Rlow 1k and Rup 990k */
60#define ADE7978_UP_RES 990000
61#define ADE7978_DOWN_RES 1000
62#define ADE7978_VOLTAGE_TR_FCN ((ADE7978_DOWN_RES + ADE7978_UP_RES) / ADE7978_DOWN_RES)
63
69 /* I rms value */
70 float i_rms;
71 /* V1 rms value */
72 float v1_rms;
73 /* V2 rms value */
74 float v2_rms;
75 /* Temperature °C value */
77 /* I ADC rms value */
78 int32_t i_rms_adc;
79 /* V1 ADC rms value */
80 int32_t v1_rms_adc;
81 /* V2 ADC rms value */
82 int32_t v2_rms_adc;
83 /* Temperature ADC value */
84 int32_t temperature;
85};
86
87/* Saves the current and voltage values of device 1 in rms_adc structure */
88int rms_adc_values_read(struct ade7978_dev *dev, struct measurements *value,
89 enum ade7978_phase phase);
90
91#endif /* __COMMON_DATA_H__ */
Header file of ADE7978 Driver.
ade7978_phase
ADE7978 available phases.
Definition ade7978.h:663
int rms_adc_values_read(struct ade7913_dev *dev, struct rms_adc_values *rms)
Saves the current and voltage values of device 1 in rms_adc structure.
Definition common_data.c:68
Header file of Delay functions.
Error codes definition.
Header file of GPIO Interface.
Print messages helpers.
Header file of PWM Interface.
Header file of SPI Interface.
Header file of UART interface.
Header file of Units.
Header file of utility functions.
ADE7978 Device structure.
Definition ade7978.h:686
measurements structure.
Definition common_data.h:68
float i_rms
Definition common_data.h:70
int32_t i_rms_adc
Definition common_data.h:78
int32_t temperature
Definition common_data.h:84
float v1_rms
Definition common_data.h:72
float v2_rms
Definition common_data.h:74
int32_t v2_rms_adc
Definition common_data.h:82
int32_t v1_rms_adc
Definition common_data.h:80
float temperature_c
Definition common_data.h:76