precision-converters-firmware
Loading...
Searching...
No Matches
app_config.h
Go to the documentation of this file.
1/***************************************************************************//*
2 * @file app_config.h
3 * @brief Header File for the application configuration for AD7124 IIO app.
4******************************************************************************
5 * Copyright (c) 2023-25 Analog Devices, Inc.
6 * All rights reserved.
7 *
8 * This software is proprietary to Analog Devices, Inc. and its licensors.
9 * By using this software you agree to the terms of the associated
10 * Analog Devices Software License Agreement.
11******************************************************************************/
12
13#ifndef _APP_CONFIG_H_
14#define _APP_CONFIG_H_
15
16/*****************************************************************************/
17/***************************** Include Files *********************************/
18/*****************************************************************************/
19
20#include <stdint.h>
21#include "common_macros.h"
22
23/*****************************************************************************/
24/********************** Macros and Constants Definition **********************/
25/*****************************************************************************/
26
27/* Select the active platform */
28#if !defined(ACTIVE_PLATFORM)
29#define ACTIVE_PLATFORM STM32_PLATFORM
30#endif
31
32/* List of data capture modes */
33#define CONTINUOUS_DATA_CAPTURE 0
34#define BURST_DATA_CAPTURE 1
35
36/* Macros for stringification */
37#define XSTR(s) #s
38#define STR(s) XSTR(s)
39
40/* List of supported IIO clients
41 * - Local client is supported only on DISCO-F769NI (mbed & stm32 platform).
42 * - DISCO-F769NI only supports local client.
43 * - NUCLEO-H563ZI (stm32 platform) supports only remote client.
44 * - SDP-K1 (mbed platform) supports only remote client.
45 */
46#define IIO_CLIENT_REMOTE 1 // Remote (PC) IIO client
47#define IIO_CLIENT_LOCAL 2 // Local (display) IIO client
48
49/* Select active IIO client */
50#if !defined(ACTIVE_IIO_CLIENT)
51#define ACTIVE_IIO_CLIENT IIO_CLIENT_REMOTE
52#endif
53
54/* Enable/Disable the use of SDRAM for ADC data capture buffer */
55//#define USE_SDRAM // Uncomment to use SDRAM for data buffer
56
57/* Enable the UART/VirtualCOM port connection (default VCOM) */
58//#define USE_PHY_COM_PORT // Uncomment to select UART
59
60#if !defined(USE_PHY_COM_PORT)
61#define USE_VIRTUAL_COM_PORT
62#endif
63
64// **** Note for User on selection of Active Device ****//
65/* Define the device type here from the list of below device type defines
66 * (one at a time. Defining more than one device can result into compile error).
67 * e.g. #define DEV_AD7142_4= -> This will make AD7124-4 as an active device.
68 * The active device is default set to AD7124-4 if device type is not defined.
69 * */
70//#define DEV_AD7124_4
71
72#if defined(DEV_AD7124_4)
73#define DEVICE_NAME "DEV_AD7124_4"
74#define ACTIVE_DEVICE_NAME "ad7124-4"
75#define NUM_OF_CHANNELS 8
76#define HW_MEZZANINE_NAME "EVAL-AD7124-4ASDZ"
77
78#elif defined(DEV_AD7124_8)
79#define DEVICE_NAME "DEV_AD7124_8"
80#define ACTIVE_DEVICE_NAME "ad7124-8"
81#define NUM_OF_CHANNELS 16
82#define HW_MEZZANINE_NAME "EVAL-AD7124-8ASDZ"
83
84#else
85#warning No/Unsupported ADxxxx symbol defined. AD7124_4 defined
86#define DEV_AD7124_4
87#define DEVICE_NAME "DEV_AD7124_4"
88#define ACTIVE_DEVICE_NAME "ad7124-4"
89#define NUM_OF_CHANNELS 8
90#define HW_MEZZANINE_NAME "EVAL-AD7124-4ASDZ"
91#endif
92
93/* List of Input modes */
94#define PSUEDO_DIFFERENTIAL_MODE 0
95#define DIFFERENTIAL_MODE 1
96
97/* Select Input Mode -
98 * AD7124-4 can be operated with 4 differential and 7 pseudo differential channels
99 * AD7124-8 can be operated with 8 differential and 15 psuedo differential channels
100 * */
101#if !defined(INPUT_MODE)
102#define INPUT_MODE PSEUDO_DIFFERENTIAL_MODE
103#endif
104
105/* ADC resolution for active device */
106#define ADC_RESOLUTION 24
107
108/* ADC max count (full scale value) for unipolar inputs */
109#define ADC_MAX_COUNT_UNIPOLAR (int32_t)((1 << ADC_RESOLUTION) - 1)
110
111/* ADC max count (full scale value) for bipolar inputs */
112#define ADC_MAX_COUNT_BIPOLAR (int32_t)(1 << (ADC_RESOLUTION-1))
113
114/* Redefine the init params structure mapping w.r.t. platform */
115#if (ACTIVE_PLATFORM == STM32_PLATFORM)
116#include "app_config_stm32.h"
117/* Redefine the init params structure mapping wrt platform */
118#define spi_extra_init_params stm32_spi_extra_init_params
119#define uart_extra_init_params stm32_uart_extra_init_params
120#define gpio_platform_ops stm32_gpio_ops
121#define spi_platform_ops stm32_spi_ops
122#define uart_ops stm32_uart_ops
123#define i2c_ops stm32_i2c_ops
124#define i2c_extra_init_params stm32_i2c_extra_init_params
125#define irq_platform_ops stm32_gpio_irq_ops
126#define ext_int_extra_init_params stm32_trigger_gpio_irq_init_params
127#define IRQ_INT_ID RDY_PIN
128#define ticker_int_extra_init_params 0 //(Unused)
129#define trigger_gpio_handle 0
130#else
131#error "No/Invalid active platform selected"
132#endif
133//#endif
134
135#if !defined(PLATFORM_NAME)
136#define PLATFORM_NAME HW_CARRIER_NAME
137#endif
138
139/* Baud Rate for IIO Application */
140#define IIO_UART_BAUD_RATE (230400)
141
142/* Check if any serial port available for use as console stdio port */
143#if defined(USE_VIRTUAL_COM_PORT)
144/* If VCOM is selected, PHY com port will/should act as a console stdio port */
145#define CONSOLE_STDIO_PORT_AVAILABLE
146#endif
147
148/* Select the ADC data capture mode (default is CC mode) */
149#if !defined(DATA_CAPTURE_MODE)
150#define DATA_CAPTURE_MODE CONTINUOUS_DATA_CAPTURE
151#endif
152
153#define LVGL_TICK_TIME_US 5000
154#define LVGL_TICK_TIME_MS (LVGL_TICK_TIME_US / 1000)
155
156/******************************************************************************/
157/********************** Public Declarations ***********************************/
158/******************************************************************************/
159
160int init_system(void);
161extern struct no_os_uart_desc *uart_desc;
162extern struct no_os_eeprom_desc *eeprom_desc;
163extern struct no_os_gpio_desc *csb_gpio;
164extern struct no_os_gpio_desc *rdy_gpio;
165extern struct no_os_irq_ctrl_desc *trigger_irq_desc;
166void data_capture_callback(void *ctx);
167void ticker_callback(void* ctx);
168void lvgl_tick_callback(void* ctx);
169
170#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_uart_desc * uart_desc
Definition app_config.c:97
struct no_os_eeprom_desc * eeprom_desc
Definition app_config.c:170
void ticker_callback(void *ctx)
This is an ISR (Interrupt Service Routine) for Ticker object.
Definition ad4170_iio.c:3334
struct no_os_gpio_desc * csb_gpio
Definition app_config.c:51
void lvgl_tick_callback(void *ctx)
Definition app_config.c:164
void data_capture_callback(void *ctx)
Interrupt Service Routine to monitor data ready event.
Definition ad405x_iio.c:1023
struct no_os_gpio_desc * rdy_gpio
Definition app_config.c:54
The file contain common macros that needs to be followed same across all the projects.
Header file for STM32 platform configurations.