precision-converters-firmware
Loading...
Searching...
No Matches
app_config.h
Go to the documentation of this file.
1/***************************************************************************/
11#ifndef APP_CONFIG_H_
12#define APP_CONFIG_H_
13
14/******************************************************************************/
15/***************************** Include Files **********************************/
16/******************************************************************************/
17#include <stdint.h>
18#include "common_macros.h"
19#include "no_os_pwm.h"
20
21/******************************************************************************/
22/********************** Macros and Constants Definitions **********************/
23/******************************************************************************/
24/* List of data capture modes */
25#define SPI_INTERRUPT 1
26#define SPI_DMA 2
27
28/* Macros for stringification */
29#define XSTR(s) #s
30#define STR(s) XSTR(s)
31
32/******************************************************************************/
33/* Resolution of the dac */
34#define AD552XR_DAC_RESOLUTION 16
35
36/* Enable the UART/VirtualCOM port connection (default VCOM) */
37//#define USE_PHY_COM_PORT // Uncomment to select UART
38
39#if !defined(USE_PHY_COM_PORT)
40#define USE_VIRTUAL_COM_PORT
41#endif
42/* Select the active platform */
43#if !defined(ACTIVE_PLATFORM)
44#define ACTIVE_PLATFORM STM32_PLATFORM
45#endif
46
47#if (ACTIVE_PLATFORM != STM32_PLATFORM)
48#error "No/Invalid active platform selected"
49#endif /* ACTIVE_PLATFORM */
50
51/* Select the Interface mode. Default is SPI DMA */
52#if !defined(INTERFACE_MODE)
53#define INTERFACE_MODE SPI_DMA
54#endif
55
56/* AD552XR Max Sample Rate is 1MSPS */
57#define AD552XR_MAX_SAMPLE_RATE (1E6)
58
59#if (INTERFACE_MODE == SPI_INTERRUPT)
60/* In Release mode, the observed sampling frequency is 50KSPS,
61 * whereas in Debug mode, it is limited to 10KSPS */
62#if defined (DEBUG)
63#define AD552XR_IIO_SAMPLE_RATE (10E3)
64#else
65#define AD552XR_IIO_SAMPLE_RATE (50E3)
66#endif
67#elif (INTERFACE_MODE == SPI_DMA)
68// Not available, calculated based on SPI frequency
69#endif
70
71/* Redefine the init params structure mapping w.r.t. platform */
72#if (ACTIVE_PLATFORM == STM32_PLATFORM)
73#include "app_config_stm32.h"
74#define spi_extra_init_params stm32_spi_extra_init_params
75#define spi_ops stm32_spi_ops
76#define i2c_extra_init_params stm32_i2c_extra_init_params
77#define i2c_ops stm32_i2c_ops
78#define vcom_ops stm32_usb_uart_ops
79#define vcom_extra_init_params stm32_vcom_extra_init_params
80#define uart_extra_init_params stm32_uart_extra_init_params
81#define uart_ops stm32_uart_ops
82#define gpio_output_extra_init_params stm32_gpio_output_extra_init_params
83#define gpio_input_extra_init_params stm32_gpio_input_extra_init_params
84#define gpio_ldac_tgp_pwm_extra_init_params stm32_gpio_ldac_tgp_pwm_extra_init_params
85#define gpio_cs_pwm_extra_init_params stm32_gpio_cs_pwm_extra_init_params
86#define gpio_ops stm32_gpio_ops
87#define pwm_ops stm32_pwm_ops
88#define irq_ops stm32_irq_ops
89#define dma_ops stm32_dma_ops
90#define pwm_tgp_extra_init_params stm32_pwm_tgp_extra_init_params
91#define pwm_tgp_trigger_mode_extra_init_params stm32_pwm_tgp_trigger_mode_extra_init_params
92#define pwm_dac_update_extra_init_params stm32_pwm_dac_update_extra_init_params
93#define pwm_dma_trigger_extra_init_params stm32_pwm_dma_trigger_extra_init_params
94#endif
95
96/* Check if any serial port available for use as console stdio port */
97#if defined(USE_VIRTUAL_COM_PORT)
98/* If PHY com is selected, VCOM or alternate PHY com port can act as a console stdio port */
99/* If VCOM is selected, PHY com port will/should act as a console stdio port */
100#define CONSOLE_STDIO_PORT_AVAILABLE
101#endif
102
103/* Baud rate for IIO application UART interface */
104#define IIO_UART_BAUD_RATE (230400)
105
106/* Number of IIO devices for the application */
107#define AD552XR_IIO_NUM_DEVICES 4
108
109/* Enable/Disable the use of SDRAM for ADC data capture buffer */
110/* (Use following macros to use SDRAM for data buffer) */
111//#define USE_SDRAM
112
113/* Convert Hz into ns and vice-versa */
114#define HZ_NS_CONVERT(x) (uint32_t)((1.0 / x) * 1E9)
115
116/* Note: LDAC duty cycle is always 50% */
117#define LDAC_DUTY_CYCLE_NSEC(x) (x * 0.5)
118
119/******************************************************************************/
120/********************** Variables and User Defined Data Types *****************/
121/******************************************************************************/
122extern struct no_os_spi_init_param spi_init_params;
123extern struct no_os_i2c_init_param i2c_init_params;
124extern struct no_os_gpio_init_param gpio_clear_n_init_params;
125extern struct no_os_gpio_init_param gpio_reset_n_init_params;
126extern struct no_os_gpio_init_param gpio_alarm_n_init_params;
127extern struct no_os_gpio_init_param gpio_md_addr0_init_params;
128extern struct no_os_gpio_init_param gpio_md_addr1_init_params;
129extern struct no_os_gpio_init_param gpio_ldac_tgpx_init_params[NUM_TGPx];
130extern struct no_os_uart_init_param uart_iio_comm_init_params;
131extern struct no_os_uart_init_param uart_console_stdio_init_params;
132extern struct no_os_uart_desc *uart_iio_comm_desc;
133extern struct no_os_uart_desc *uart_console_stdio_desc;
134extern struct no_os_eeprom_desc *eeprom_desc;
135#if (INTERFACE_MODE == SPI_INTERRUPT)
136extern struct no_os_irq_init_param irq_iio_trigger_init_params;
137#endif
138
139/******************************************************************************/
140/************************ Public Declarations *********************************/
141/******************************************************************************/
142int32_t set_timer_prescaler(struct no_os_pwm_desc *desc, uint32_t prescaler);
143
144#endif /* APP_CONFIG_H_ */
struct no_os_eeprom_desc * eeprom_desc
Definition app_config.c:172
struct no_os_spi_init_param spi_init_params
Definition ad3530r_user_config.c:48
struct no_os_uart_desc * uart_console_stdio_desc
Definition app_config.c:100
struct no_os_uart_desc * uart_iio_comm_desc
Definition app_config.c:198
int32_t set_timer_prescaler(struct no_os_pwm_desc *desc, uint32_t prescaler)
Set prescaler for timer.
Definition app_config.c:447
struct no_os_uart_init_param uart_console_stdio_init_params
Definition app_config.c:72
struct no_os_gpio_init_param gpio_clear_n_init_params
Definition app_config.c:95
struct no_os_gpio_init_param gpio_md_addr1_init_params
Definition app_config.c:127
struct no_os_gpio_init_param gpio_ldac_tgpx_init_params[NUM_TGPx]
Definition app_config.c:138
struct no_os_gpio_init_param gpio_alarm_n_init_params
Definition app_config.c:111
struct no_os_uart_init_param uart_iio_comm_init_params
Definition app_config.c:28
struct no_os_irq_init_param irq_iio_trigger_init_params
Definition app_config.c:171
struct no_os_gpio_init_param gpio_reset_n_init_params
Definition app_config.c:103
struct no_os_i2c_init_param i2c_init_params
Definition app_config.c:43
struct no_os_gpio_init_param gpio_md_addr0_init_params
Definition app_config.c:119
#define NUM_TGPx
Definition app_config_stm32.h:73
The file contain common macros that needs to be followed same across all the projects.
Header file for STM32 platform configurations.