precision-converters-firmware
Loading...
Searching...
No Matches
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#include "ltc2672.h"
22#include "no_os_pwm.h"
23#include "version.h"
24#include "common_macros.h"
25
26/******************************************************************************/
27/********************** Macros and Constants Definition ***********************/
28/******************************************************************************/
29
30/* Macros for stringification */
31#define XSTR(s) #s
32#define STR(s) XSTR(s)
33
34#ifdef FIRMWARE_VERSION
35#define GET_FIRMWARE_VERSION (FIRMWARE_VERSION)
36#else
37#define GET_FIRMWARE_VERSION NULL
38#endif
39
40/******************************************************************************/
41
42/* Select the active platform (default is STM32) */
43#if !defined(ACTIVE_PLATFORM)
44#define ACTIVE_PLATFORM STM32_PLATFORM
45#endif
46
47/* Enable the UART/VirtualCOM port connection (default VCOM) */
48//#define USE_PHY_COM_PORT // Uncomment to select UART
49
50#if !defined(USE_PHY_COM_PORT)
51#define USE_VIRTUAL_COM_PORT
52#endif
53
54/* Support for Arduino interfaced board is enabled by default */
55//#define DC2903A // Uncomment to select Linduino interfaced board
56
57#if defined(DC2903A)
58//*** Note for user to select active device ***//
59/* Define the device type here
60 * (use only one define at time. Defining multiple devices gives compilation error)
61 * e.g. #define DEV_LTC2672_16 will select LTC2672_16 as the active device
62 * */
63// #define DEV_LTC2672_16
64
65#if defined(DEV_LTC2672_12)
66#define ACTIVE_DEVICE_NAME "ltc2672-12"
67#define DEVICE_NAME "DEV_LTC2672_12"
68#define ACTIVE_DEVICE_ID LTC2672_12
69#define DAC_RESOLUTION 12
70#define DAC_MAX_COUNT LTC2672_12BIT_RESO
71#elif defined(DEV_LTC2672_16)
72#define ACTIVE_DEVICE_NAME "ltc2672-16"
73#define DEVICE_NAME "DEV_LTC2672_16"
74#define ACTIVE_DEVICE_ID LTC2672_16
75#define DAC_RESOLUTION 16
76#define DAC_MAX_COUNT LTC2672_16BIT_RESO
77#else
78#warning No/Unsupported ADxxxxy symbol defined. LTC2672_16 defined
79#define DEV_LTC2672_16
80#define ACTIVE_DEVICE_NAME "ltc2672-16"
81#define DEVICE_NAME "DEV_LTC2672_16"
82#define ACTIVE_DEVICE_ID LTC2672_16
83#define DAC_RESOLUTION 16
84#define DAC_MAX_COUNT LTC2672_16BIT_RESO
85#endif
86#else // For Arduino interfaced board
87#define DAC_RESOLUTION 16
88#define DAC_MAX_COUNT LTC2672_16BIT_RESO
89#define DEVICE_LTC2662_16 "ltc2662-16"
90#define DEVICE_LTC2672_16 "ltc2672-16"
91#endif
92
93/* DAC Reference Voltage */
94#define DAC_VREF 1.25
95
96/* Full Scale Adjusted Resitor Value in kohm */
97#define DAC_FSADJ_RESISTOR 20
98
99#if (ACTIVE_PLATFORM == STM32_PLATFORM)
100#include "app_config_stm32.h"
101#define CONSOLE_STDIO_PORT_AVAILABLE
102#else
103#error "No/Invalid active platform selected"
104#endif
105
106#define HW_CARRIER_NAME TARGET_NAME
107
108#define HW_MEZZANINE_NAME "DC2903A-A"
109
110/****** Macros used to form a VCOM serial number ******/
111
112/* Baud rate for IIO application UART interface */
113#define IIO_UART_BAUD_RATE (230400)
114
115/* Used to form a VCOM serial number */
116#define FIRMWARE_NAME "ltc2672_iio"
117
118#if !defined(PLATFORM_NAME)
119#define PLATFORM_NAME HW_CARRIER_NAME
120#endif
121
122/* Below USB configurations (VID and PID) are owned and assigned by ADI.
123 * If intended to distribute software further, use the VID and PID owned by your
124 * organization */
125#define VIRTUAL_COM_PORT_VID 0x0456
126#define VIRTUAL_COM_PORT_PID 0xb66c
127/* Serial number string is formed as: application name + device (target) name + platform (host) name */
128#define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" STR(PLATFORM_NAME))
129
130/* Check if any serial port available for use as console stdio port */
131#if defined(USE_VIRTUAL_COM_PORT)
132/* If VCOM is selected, PHY com port will/should act as a console stdio port */
133#define CONSOLE_STDIO_PORT_AVAILABLE
134#endif
135
136/* PWM period and duty cycle */
137#define CONV_TRIGGER_PERIOD_NSEC (((float)(1.0 / SAMPLING_RATE) * 1000000) * 1000)
138#define CONV_TRIGGER_DUTY_CYCLE_NSEC (CONV_TRIGGER_PERIOD_NSEC / 2)
139
140/******************************************************************************/
141/************************ Public Declarations *********************************/
142/******************************************************************************/
143
144extern struct no_os_uart_desc *uart_iio_com_desc;
145extern struct no_os_uart_desc *uart_console_stdio_desc;
146extern struct no_os_eeprom_desc *eeprom_desc;
147extern struct no_os_gpio_desc *gpio_ldac_desc;
148extern struct no_os_gpio_desc *gpio_clear_desc;
149extern struct no_os_gpio_desc *gpio_toggle_desc;
150extern struct no_os_pwm_desc *toggle_pwm_desc;
151extern struct no_os_pwm_desc *ldac_pwm_desc;
152extern struct no_os_irq_ctrl_desc *trigger_irq_desc;
153extern struct no_os_gpio_init_param toggle_pwm_gpio_params;
154int32_t init_system(void);
155int32_t init_pwm(void);
156
157#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_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_pwm_desc * ldac_pwm_desc
Definition app_config.c:133
struct no_os_uart_desc * uart_console_stdio_desc
Definition app_config.c:100
The file contain common macros that needs to be followed same across all the projects.
struct no_os_gpio_desc * gpio_clear_desc
Definition app_config.c:129
struct no_os_gpio_desc * gpio_toggle_desc
Definition app_config.c:132
struct no_os_gpio_init_param toggle_pwm_gpio_params
Definition app_config.c:79
struct no_os_gpio_desc * gpio_ldac_desc
Definition app_config.c:126
struct no_os_pwm_desc * toggle_pwm_desc
Definition app_config.c:135
Version macros for ADI LTC2672.
Header file for STM32 platform configurations.