precision-converters-firmware
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
app_config.h
Go to the documentation of this file.
1/*************************************************************************/
13#ifndef APP_CONFIG_H_
14#define APP_CONFIG_H_
15
16/******************************************************************************/
17/***************************** Include Files **********************************/
18/******************************************************************************/
19
20#include <stdint.h>
21
22/******************************************************************************/
23/********************** Macros and Constants Definition ***********************/
24/******************************************************************************/
25
26/* List of supported platforms */
27#define MBED_PLATFORM 1
28
29/* List of supported data capture modes */
30#define BURST_DATA_CAPTURE 0
31#define CONTINUOUS_DATA_CAPTURE 1
32
33/* Macros for stringification */
34#define XSTR(s) #s
35#define STR(s) XSTR(s)
36
37/******************************************************************************/
38
39/* Name of active device */
40#define ACTIVE_DEVICE_NAME "ad7380-2"
41
42/* Select the active platform (default is Mbed) */
43#if !defined(ACTIVE_PLATFORM)
44#define ACTIVE_PLATFORM MBED_PLATFORM
45#endif
46
47/* Select the ADC data capture mode (default is CC mode) */
48#if !defined(DATA_CAPTURE_MODE)
49#define DATA_CAPTURE_MODE CONTINUOUS_DATA_CAPTURE
50#endif
51
52/* Enable the UART/VirtualCOM port connection (default VCOM) */
53//#define USE_PHY_COM_PORT // Uncomment to select UART
54
55#if !defined(USE_PHY_COM_PORT)
56#define USE_VIRTUAL_COM_PORT
57#endif
58
59#if (ACTIVE_PLATFORM == MBED_PLATFORM)
60#include "app_config_mbed.h"
61
62#define HW_CARRIER_NAME TARGET_NAME
63
64/* Redefine the init params structure mapping w.r.t. platform */
65#define pwm_extra_init_params mbed_pwm_extra_init_params
66#define uart_extra_init_params mbed_uart_extra_init_params
67#define vcom_extra_init_params mbed_vcom_extra_init_params
68#define spi_extra_init_params mbed_spi_extra_init_params
69#define i2c_extra_init_params mbed_i2c_extra_init_params
70#define trigger_gpio_extra_init_params mbed_trigger_gpio_extra_init_params
71#define trigger_gpio_irq_extra_params mbed_trigger_gpio_irq_init_params
72#define trigger_gpio_ops mbed_gpio_ops
73#define spi_ops mbed_spi_ops
74#define i2c_ops mbed_i2c_ops
75#define uart_ops mbed_uart_ops
76#define vcom_ops mbed_virtual_com_ops
77#define trigger_gpio_irq_ops mbed_gpio_irq_ops
78#define trigger_gpio_handle 0 // Unused macro
79#define UART_MODULE 0 // Unused macro
80#define SPI_MODULE 0 // Unused macro
81#define TRIGGER_GPIO_PORT 0 // Unused macro
82#define TRIGGER_GPIO_PIN PWM_TRIGGER
83#define TRIGGER_INT_ID GPIO_IRQ_ID1
84#else
85#error "No/Invalid active platform selected"
86#endif
87
88/* ADC resolution for active device */
89#define ADC_RESOLUTION 16
90
91/* Number of ADC channels */
92#define ADC_CHANNELS 2
93
94/* ADC reference voltage (Range: 2.5 to 3.3v) */
95#define ADC_REF_VOLTAGE 3.3
96
97/* ADC max count (full scale value) for unipolar inputs */
98#define ADC_MAX_COUNT_UNIPOLAR (uint32_t)((1 << ADC_RESOLUTION) - 1)
99
100/* ADC max count (full scale value) for bipolar inputs */
101#define ADC_MAX_COUNT_BIPOLAR (uint32_t)(1 << (ADC_RESOLUTION-1))
102
103/* Baud rate for IIO application UART interface */
104#define IIO_UART_BAUD_RATE (230400)
105
106/****** Macros used to form a VCOM serial number ******/
107#define DEVICE_NAME "DEV_AD7380_2"
108
109/* Used to form a VCOM serial number */
110#define FIRMWARE_NAME "ad738x_iio"
111
112#if !defined(PLATFORM_NAME)
113#define PLATFORM_NAME HW_CARRIER_NAME
114#endif
115
116/* Below USB configurations (VID and PID) are owned and assigned by ADI.
117 * If intended to distribute software further, use the VID and PID owned by your
118 * organization */
119#define VIRTUAL_COM_PORT_VID 0x0456
120#define VIRTUAL_COM_PORT_PID 0xb66c
121/* Serial number string is formed as: application name + device (target) name + platform (host) name */
122#define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" STR(PLATFORM_NAME))
123
124/* Check if any serial port available for use as console stdio port */
125#if defined(USE_PHY_COM_PORT)
126/* If PHY com is selected, VCOM or alternate PHY com port can act as a console stdio port */
127#if (ACTIVE_PLATFORM == MBED_PLATFORM)
128#define CONSOLE_STDIO_PORT_AVAILABLE
129#endif
130#else
131/* If VCOM is selected, PHY com port will/should act as a console stdio port */
132#define CONSOLE_STDIO_PORT_AVAILABLE
133#endif
134
135/* Enable/Disable the use of SDRAM for ADC data capture buffer */
136//#define USE_SDRAM // Uncomment to use SDRAM for data buffer
137
138/******************************************************************************/
139/************************ Public Declarations *********************************/
140/******************************************************************************/
141
142extern struct no_os_uart_desc *uart_iio_com_desc;
143extern struct no_os_uart_desc *uart_console_stdio_desc;
144extern struct no_os_irq_ctrl_desc *trigger_irq_desc;
145extern struct no_os_spi_init_param spi_init_params;
146
147int32_t init_system(void);
148int32_t init_pwm_trigger(void);
149
150#endif // APP_CONFIG_H_
int32_t init_pwm_trigger(void)
Initialize the PWM trigger contoller.
Definition app_config.c:161
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_spi_init_param spi_init_params
Definition ad3530r_user_config.c:48
struct no_os_uart_desc * uart_iio_com_desc
Definition app_config.c:164
struct no_os_uart_desc * uart_console_stdio_desc
Definition app_config.c:100
Header file for Mbed platform configurations.