no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
iio_pqm.h
Go to the documentation of this file.
1/*******************************************************************************
2 * @file iio_pqm.h
3 * @brief IIO pqm interfacing header file
4 * @author Robert Budai (robert.budai@analog.com)
5 ********************************************************************************
6 * Copyright (c) 2024 Analog Devices, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 *
18 * 3. Neither the name of Analog Devices, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived from this
20 * software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25 * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *******************************************************************************/
33#ifndef __IIO_PQM_H__
34#define __IIO_PQM_H__
35
36#include "common_data.h"
37#include "pqlib_afe.h"
38#include "pqlib_convert.h"
39#include "pqlib_example.h"
40#include "status.h"
41#include <inttypes.h>
42
43// Device specific attributes
44#define ATTR_U2 0
45#define ATTR_U0 1
46#define SNEG_VOLTAGE 2
47#define SPOS_VOLTAGE 3
48#define SZRO_VOLTAGE 4
49#define ATTR_I2 5
50#define ATTR_I0 6
51#define SNEG_CURRENT 7
52#define SPOS_CURRENT 8
53#define SZRO_CURRENT 9
54#define NOMINAL_VOLTAGE 10
55#define VOLTAGE_SCALE 11
56#define CURRENT_SCALE 12
57#define I_CONSEL_ENABLE 13
58#define DIP_THRESHOLD 14
59#define DIP_HYSTERESIS 15
60#define SWELL_THRESHOLD 16
61#define SWELL_HYSTERESIS 17
62#define INTERP_THRESHOLD 18
63#define INTERP_HYSTERESIS 19
64#define RVC_THRESHOLD 20
65#define RVC_HYSTERESIS 21
66#define MSV_CARRIER_FREQUENCY 22
67#define MSV_RECORDING_LENGTH 23
68#define MSV_THRESHOLD 24
69#define SAMPLING_FREQUENCY 25
70#define V_CONSEL 26
71#define V_CONSEL_AVAILABLE 27
72#define FLICKER_MODEL 28
73#define FLICKER_MODEL_AVAILABLE 29
74#define NOMINAL_FREQUENCY 30
75#define NOMINAL_FREQUENCY_AVAILABLE 31
76#define PROCESS_DATA 32
77#define FW_VERSION_NR 33
78
79// Channel specific attributes
80#define CHAN_RMS 0
81#define CHAN_ANGLE 1
82#define CHAN_HARMONICS 2
83#define CHAN_INTER_HARMONICS 3
84#define CHAN_SCALE 4
85#define CHAN_OFFSET 5
86#define CHAN_THD 6
87#define CHAN_RAW 7
88#define CHAN_VOLTAGE_UNDER_DEV 8
89#define CHAN_VOLTAGE_OVER_DEV 9
90#define CHAN_VOLTAGE_PINST 10
91#define CHAN_VOLTAGE_PST 11
92#define CHAN_VOLTAGE_PLT 12
93#define CHAN_EVENT_COUNT 13
94#define CHAN_EVENT_START_TIME 14
95#define CHAN_EVENT_END_TIME 15
96#define CHAN_EVENT_DURATION_IN_CYCL 16
97#define CHAN_EVENT_MIN_MAG 17
98#define CHAN_EVENT_MAX_MAG 18
99#define CHAN_EVENT_DELTA_U_MAX 19
100#define CHAN_EVENT_DELTA_U_SS 20
101#define CHAN_VOLTAGE_MAGNITUDE1012 21
102#define CHAN_VOLTAGE_MAX_MAGNITUDE 22
103
104#define RESAMPLED_WAVEFORM_FULL_SCALE 18196
105
106extern struct iio_device pqm_iio_descriptor;
107extern volatile bool configChanged;
108extern volatile bool processData;
109
110#endif
volatile bool processData
Definition iio_pqm.c:81
volatile bool configChanged
Definition iio_pqm.c:80
struct iio_device pqm_iio_descriptor
Definition iio_pqm.c:1045
Structure holding channels and attributes of a device.
Definition iio_types.h:238