no-OS
Classes | Macros | Functions | Variables
common_data.h File Reference

Defines common data to be used by ADE7913 example project. More...

#include "ade7913.h"
#include "no_os_uart.h"
#include "no_os_pwm.h"
#include "no_os_delay.h"
#include "no_os_gpio.h"
#include "no_os_spi.h"
#include "no_os_print_log.h"
#include "no_os_units.h"
#include "no_os_util.h"
#include "no_os_error.h"
#include "maxim_uart.h"
#include "maxim_gpio.h"
#include "maxim_uart_stdio.h"
#include "maxim_pwm.h"
#include "maxim_spi.h"
#include "maxim_irq.h"
Include dependency graph for common_data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rms_adc_values
 

Macros

#define INITIAL   1024
 
#define SAMPLES   1024
 
#define V_MULT   (1000ul)
 
#define V_DIVIDER   (1001ul)
 

Functions

int interface_toggle_led (struct no_os_gpio_desc *gpio_led_desc)
 Toggle LED. More...
 
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. More...
 
int rms_adc_values_read_2 (struct ade7913_dev *dev, struct rms_adc_values *rms)
 Saves the current and voltage values of device 2 in rms_adc structure. More...
 
int rms_adc_values_read_3 (struct ade7913_dev *dev, struct rms_adc_values *rms)
 Saves the current and voltage values of device 3 in rms_adc structure. More...
 
int64_t rms_filter_v1 (int32_t sample)
 Compute v1 rms value. More...
 
int64_t rms_filter_v2 (int32_t sample)
 Compute v2 rms value. More...
 
int64_t rms_filter_i (int32_t sample)
 Compute i rms value. More...
 
int64_t rms_filter_v1_2 (int32_t sample)
 Compute v1_2 rms value for device 2. More...
 
int64_t rms_filter_v2_2 (int32_t sample)
 Compute v2_2 rms value for device 2. More...
 
int64_t rms_filter_i_2 (int32_t sample)
 Compute i_2 rms value for device 2. More...
 
int64_t rms_filter_v1_3 (int32_t sample)
 Compute v1_3 rms value for device 3. More...
 
int64_t rms_filter_v2_3 (int32_t sample)
 Compute v2_3 rms value for device 3. More...
 
int64_t rms_filter_i_3 (int32_t sample)
 Compute i_3 rms value for device 3. More...
 
int64_t supply_scale_v (int32_t val)
 Scale V value. More...
 

Variables

struct no_os_uart_init_param uart_ip
 
struct no_os_gpio_init_param gpio_led1_ip
 
struct no_os_spi_init_param ade7913_spi_ip0
 
struct no_os_spi_init_param ade7913_spi_ip1
 
struct no_os_spi_init_param ade7913_spi_ip2
 
struct no_os_gpio_init_param ade7913_gpio_rdy_ip
 

Detailed Description

Defines common data to be used by ADE7913 example project.

Author
REtz (radu..nosp@m.etz@.nosp@m.analo.nosp@m.g.co.nosp@m.m)

Copyright (c) 2024 Analog Devices, Inc.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Macro Definition Documentation

◆ INITIAL

#define INITIAL   1024

◆ SAMPLES

#define SAMPLES   1024

◆ V_DIVIDER

#define V_DIVIDER   (1001ul)

◆ V_MULT

#define V_MULT   (1000ul)

Function Documentation

◆ interface_toggle_led()

int interface_toggle_led ( struct no_os_gpio_desc gpio_led_desc)

Toggle LED.

Parameters
gpio_led_desc- LED descriptor
Returns
0 in case of success, error code otherwise

Toggle LED.

Parameters
gpio_led_desc- led descriptor
Returns
0 in case of success, negative error code otherwise.

◆ rms_adc_values_read()

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.

Parameters
dev- device structure
rms- structure holding the measurements values
Returns
0 in case of success, negative error code otherwise

◆ rms_adc_values_read_2()

int rms_adc_values_read_2 ( struct ade7913_dev dev,
struct rms_adc_values rms 
)

Saves the current and voltage values of device 2 in rms_adc structure.

Parameters
dev- device structure
rms- structure holding the measurements values
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ rms_adc_values_read_3()

int rms_adc_values_read_3 ( struct ade7913_dev dev,
struct rms_adc_values rms 
)

Saves the current and voltage values of device 3 in rms_adc structure.

Parameters
dev- device structure
rms- structure holding the measurements values
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ rms_filter_i()

int64_t rms_filter_i ( int32_t  sample)

Compute i rms value.

Parameters
sample- i sample
Returns
i rms value

Compute i rms value.

Parameters
sample- i sample dev 1
Returns
i rms value
Here is the caller graph for this function:

◆ rms_filter_i_2()

int64_t rms_filter_i_2 ( int32_t  sample)

Compute i_2 rms value for device 2.

Parameters
sample- i sample dev 2
Returns
i rms value
Here is the caller graph for this function:

◆ rms_filter_i_3()

int64_t rms_filter_i_3 ( int32_t  sample)

Compute i_3 rms value for device 3.

Parameters
sample- i sample dev 3
Returns
i rms value
Here is the caller graph for this function:

◆ rms_filter_v1()

int64_t rms_filter_v1 ( int32_t  sample)

Compute v1 rms value.

Parameters
sample- v1 sample
Returns
v1 rms value

Compute v1 rms value.

Parameters
sample- v1 sample dev 1
Returns
v1 rms value
Here is the caller graph for this function:

◆ rms_filter_v1_2()

int64_t rms_filter_v1_2 ( int32_t  sample)

Compute v1_2 rms value for device 2.

Parameters
sample- v1 sample dev 2
Returns
v1 rms value
Here is the caller graph for this function:

◆ rms_filter_v1_3()

int64_t rms_filter_v1_3 ( int32_t  sample)

Compute v1_3 rms value for device 3.

Parameters
sample- v1 sample dev 3
Returns
v1 rms value
Here is the caller graph for this function:

◆ rms_filter_v2()

int64_t rms_filter_v2 ( int32_t  sample)

Compute v2 rms value.

Parameters
sample- v2 sample
Returns
v2 rms value

Compute v2 rms value.

Parameters
sample- v2 sample dev 1
Returns
v2 rms value
Here is the caller graph for this function:

◆ rms_filter_v2_2()

int64_t rms_filter_v2_2 ( int32_t  sample)

Compute v2_2 rms value for device 2.

Parameters
sample- v2 sample dev 2
Returns
v2 rms value
Here is the caller graph for this function:

◆ rms_filter_v2_3()

int64_t rms_filter_v2_3 ( int32_t  sample)

Compute v2_3 rms value for device 3.

Parameters
sample- v2 sample dev 3
Returns
v2 rms value
Here is the caller graph for this function:

◆ supply_scale_v()

int64_t supply_scale_v ( int32_t  val)

Scale V value.

Parameters
val- value to be scaled
Returns
scaled value
Here is the caller graph for this function:

Variable Documentation

◆ ade7913_gpio_rdy_ip

struct no_os_gpio_init_param ade7913_gpio_rdy_ip

◆ ade7913_spi_ip0

struct no_os_spi_init_param ade7913_spi_ip0

◆ ade7913_spi_ip1

struct no_os_spi_init_param ade7913_spi_ip1

◆ ade7913_spi_ip2

struct no_os_spi_init_param ade7913_spi_ip2

◆ gpio_led1_ip

struct no_os_gpio_init_param gpio_led1_ip

◆ uart_ip

struct no_os_uart_init_param uart_ip