precision-converters-firmware
Loading...
Searching...
No Matches
app_config.h
Go to the documentation of this file.
1/*************************************************************************/
14#ifndef APP_CONFIG_H
15#define APP_CONFIG_H
16
17/******************************************************************************/
18/***************************** Include Files **********************************/
19/******************************************************************************/
20
21#include <stdint.h>
22#include "common_macros.h"
23
24/******************************************************************************/
25/********************** Macros and Constants Definition ***********************/
26/******************************************************************************/
27
28/* Macros for stringification */
29#define XSTR(s) #s
30#define STR(s) XSTR(s)
31
32/* Enable the UART/VirtualCOM port connection (default VCOM) */
33//#define USE_PHY_COM_PORT // Uncomment to select UART
34
35#if !defined(USE_PHY_COM_PORT)
36#define USE_VIRTUAL_COM_PORT
37#endif
38
39/* Select the active platform */
40#if !defined(ACTIVE_PLATFORM)
41#define ACTIVE_PLATFORM STM32_PLATFORM
42#endif
43
44#if (ACTIVE_PLATFORM == STM32_PLATFORM)
45#include "app_config_stm32.h"
46#else
47#error "No/Invalid active platform selected"
48#endif
49
50// **** Note for User: ACTIVE_DEVICE selection **** //
51/* Define the device type here from the list of below device type defines
52 * (one at a time. Defining more than one device can result into compile error).
53 * e.g. #define DEV_AD4692 -> This will make AD4692 as an ACTIVE_DEVICE.
54 * The ACTIVE_DEVICE is default set to AD4692 if device type is not defined.
55 * */
56
57#define DEV_AD4692
58
59#if defined(DEV_AD4692)
60#define ACTIVE_DEVICE_NAME "ad4692"
61#define NO_OF_CHANNELS 16
62#define HW_MEZZANINE_NAME "EVAL-AD4692-ARDZ"
63#else
64#warning No/Unsupported ADxxxxy symbol defined. AD4692 defined
65#define DEV_AD4692
66#define ACTIVE_DEVICE_NAME "ad4692"
67#define NO_OF_CHANNELS 16
68#define HW_MEZZANINE_NAME "EVAL-AD4692-ARDZ"
69#endif
70
71#define AD4692_AS_SLOT_REG(n) (0x100 + (n))
72#define ADC_RESOLUTION 16
73
74/****** Macros used to form a VCOM serial number ******/
75#if !defined(DEVICE_NAME)
76#define DEVICE_NAME "DEV_AD4692"
77#endif
78
79/* Used to form a VCOM serial number */
80#define FIRMWARE_NAME "ad4692_iio"
81
82#if !defined(PLATFORM_NAME)
83#define PLATFORM_NAME HW_CARRIER_NAME
84#endif
85
86/* Baud rate for IIO application UART interface */
87#define IIO_UART_BAUD_RATE (230400)
88
89/* PHY com port will/should act as a console stdio port */
90#if defined(USE_VIRTUAL_COM_PORT)
91#define CONSOLE_STDIO_PORT_AVAILABLE
92#endif
93
94/* Enable/Disable the use of SDRAM for ADC data capture buffer */
95#define USE_SDRAM // Uncomment to use SDRAM as data buffer
96
97/* Bytes per sample
98 * Note: This is applicable to 16 bit data read in manual mode */
99#define BYTES_PER_SAMPLE sizeof(uint16_t)
100
101/* Number of data storage bits (needed for IIO client to plot ADC data) */
102#define CHN_STORAGE_BITS (BYTES_PER_SAMPLE * 8)
103
104#define CONV_TRIGGER_PERIOD_NSEC(x) (((float)(1.0 / x) * 1000000) * 1000)
105#define CONV_TRIGGER_DUTY_CYCLE_NSEC(x) (CONV_TRIGGER_PERIOD_NSEC(x) / 10)
106
107/* Reference voltage in uV */
108#define AD4692_VREF 4096000
109
110/* Number of shifts to be performed to generate the 5 bit command */
111#define AD4692_SHIFT_N 3
112
113/* CNV on time in nanoseconds */
114#define CNV_ON_TIME 50
115
116/* Number of cycles of offset in case of Manual Mode */
117#define N_CYCLE_OFFSET 2
118
119/* Number of IIO devices */
120#define NUM_OF_IIO_DEVICES 2
121
122/******************************************************************************/
123/********************** Variables and User Defined Data Types *****************/
124/******************************************************************************/
125
126/******************************************************************************/
127/************************ Public Declarations *********************************/
128/******************************************************************************/
129
130extern struct no_os_uart_desc *uart_iio_com_desc;
131extern struct no_os_uart_desc *uart_console_stdio_desc;
132extern struct no_os_irq_ctrl_desc *trigger_irq_desc;
133extern struct no_os_gpio_desc *cnv_gpio_desc;
134extern struct no_os_eeprom_desc* eeprom_desc;
135extern struct no_os_pwm_desc *tx_trigger_desc;
136extern struct no_os_pwm_desc *spi_burst_pwm_desc;
137extern struct no_os_pwm_init_param pwm_spi_burst_init;
138extern struct no_os_irq_init_param trigger_gpio_irq_params;
139
140int32_t init_system(void);
141int init_gpio(void);
142int init_pwm(void);
143void ad4692_data_capture_callback(void *ctx);
144int32_t init_interrupt(void);
145
146#endif // APP_CONFIG_H
struct no_os_irq_ctrl_desc * trigger_irq_desc
Definition app_config.c:103
int32_t init_system(void)
Initialize the system peripherals.
Definition app_config.c:185
struct no_os_eeprom_desc * eeprom_desc
Definition app_config.c:170
struct no_os_pwm_desc * tx_trigger_desc
Definition app_config.c:143
struct no_os_uart_desc * uart_iio_com_desc
Definition app_config.c:158
int32_t init_pwm(void)
Initialize the PWM interface.
Definition app_config.c:259
struct no_os_uart_desc * uart_console_stdio_desc
Definition app_config.c:100
struct no_os_irq_init_param trigger_gpio_irq_params
Definition app_config.c:78
int32_t init_interrupt(void)
Initialize the IRQ contoller.
Definition app_config.c:199
struct no_os_gpio_desc * cnv_gpio_desc
Definition app_config.c:150
struct no_os_pwm_desc * spi_burst_pwm_desc
Definition app_config.c:186
struct no_os_pwm_init_param pwm_spi_burst_init
Definition app_config.c:132
void ad4692_data_capture_callback(void *ctx)
Interrupt Service Routine to monitor end of conversion event.
Definition ad4692_iio.c:1691
int init_gpio(void)
Initialize the GPIO peripheral.
Definition app_config.c:231
The file contain common macros that needs to be followed same across all the projects.
Header file for STM32 platform configurations.