precision-converters-firmware
Loading...
Searching...
No Matches
app_config.h
Go to the documentation of this file.
1/*************************************************************************/
33#ifndef APP_CONFIG_H
34#define APP_CONFIG_H
35
36/******************************************************************************/
37/***************************** Include Files **********************************/
38/******************************************************************************/
39#include <stdint.h>
40#include "common_macros.h"
41#include "common.h"
42#include "no_os_spi.h"
43#include "no_os_i2c.h"
44#include "no_os_gpio.h"
45#include "no_os_uart.h"
46#include "dpot.h"
47
48/******************************************************************************/
49/********************** Macros and Constants Definition ***********************/
50/******************************************************************************/
51/* Macros for stringification */
52#define XSTR(s) #s
53#define STR(s) XSTR(s)
54
55/******************************************************************************/
56
57// **** Note for User: Board Device selection ****//
58/* Comment out the define you don't want a separate Board device in the IIO context.
59 * */
60#define DPOT_ADD_BOARD_DEVICE
61
62/* Select the active platform (default is STM32) */
63#if !defined(ACTIVE_PLATFORM)
64#define ACTIVE_PLATFORM STM32_PLATFORM
65#endif
66
67#if !defined(USE_PHY_COM_PORT)
68#define USE_VIRTUAL_COM_PORT
69#endif
70
71#if (ACTIVE_PLATFORM == STM32_PLATFORM)
72#include "app_config_stm32.h"
73#else
74#error "No/Invalid active platform selected"
75#endif
76
77/* HW ID of the digipots motherboard */
78#define HW_MEZZANINE_NAME "EVAL-MB-LV-ARDZ"
79
80/****** Macros used to form a VCOM serial number ******/
81#define FIRMWARE_NAME "digipots_iio"
82#if !defined(PLATFORM_NAME)
83#define PLATFORM_NAME HW_CARRIER_NAME
84#endif
85
86#define MAX_CHNS_LINGAIN 8
87#define MAX_CHNS_POTENTIOMETER 4
88#define MAX_CHNS 12
89
90/* Baud rate for IIO application UART interface */
91#define IIO_UART_BAUD_RATE (230400)
92
93/* Check if any serial port available for use as console stdio port */
94#if defined(USE_VIRTUAL_COM_PORT)
95/* If PHY com is selected, VCOM or alternate PHY com port can act as a console stdio port */
96/* If VCOM is selected, PHY com port will/should act as a console stdio port */
97#define CONSOLE_STDIO_PORT_AVAILABLE
98#endif
99
100/* Enable/Disable the use of SDRAM for DAC data streaming buffer */
101//#define USE_SDRAM // Uncomment to use SDRAM for data buffer
102
103/******************************************************************************/
104/********************** Board Defaults ****************************************/
105/******************************************************************************/
106
107#define DEFAULT_ACTIVE_DEVICE 0XFF
108#define DEFAULT_DEVICE_NAME "ad5244"
109#define DEFAULT_DEVICE_I2C_ADDR 0x2C
110#define DEFAULT_NUM_CHNS_POT 4
111#define DEFAULT_NUM_CHNS_LINGAIN 8
112#define DEFAULT_OPERATING_MODE DPOT_POTENTIOMETER_MODE
113#define DEFAULT_INTERFACE_TYPE AD_SPI_INTERFACE
114
115/******************************************************************************/
116/********************** Variables and User Defined Data Types *****************/
117/******************************************************************************/
118/******/
119
120#define MAX_DEVICE_NAME_LEN 10
121
126typedef struct dpot_device_info {
127 char device_name[8];
130 /* Number of input channels */
132 /* Resolution (number of wiper positions = 2^res) */
136
142 /* Interface to be used by the device */
144 /* Device Name */
146 /* Active device ID */
148 /* I2C slave address. Used only when Interface type is I2C */
150 /* Number of channels in Pot mode */
152 /* Number of channels in linear gain mode */
154 /* To select the Operating mode.*/
157
158/******************************************************************************/
159/************************ Public Declarations *********************************/
160/******************************************************************************/
161extern struct no_os_uart_desc *uart_iio_com_desc;
162extern struct no_os_spi_init_param spi_mode2_init_params;
163extern struct no_os_spi_init_param spi_mode0_init_params;
164extern struct no_os_i2c_init_param i2c_init_params;
165extern struct no_os_eeprom_desc *eeprom_desc;
166
169extern const struct dpot_ops ad5144_dpot_ops;
170extern const struct dpot_ops ad5141_dpot_ops;
171extern const struct dpot_ops ad5142_dpot_ops;
172extern const struct dpot_ops ad5143_dpot_ops;
173extern const struct dpot_ops ad5259_dpot_ops;
174extern const struct dpot_ops ad5161_dpot_ops;
175extern const struct dpot_ops ad5246_dpot_ops;
176extern const struct dpot_ops ad5242_dpot_ops;
177extern const struct dpot_ops ad5171_dpot_ops;
178extern const struct dpot_ops ad5165_dpot_ops;
179extern const struct dpot_ops ad5228_dpot_ops;
180
181extern struct ad5144_dpot_init_param ad5144_init_params;
182extern struct ad5141_dpot_init_param ad5141_init_params;
183extern struct ad5142_dpot_init_param ad5142_init_params;
184extern struct ad5143_dpot_init_param ad5143_init_params;
185extern struct ad5259_dpot_init_param ad5259_init_params;
186extern struct ad516x_dpot_init_param ad5161_init_params;
187extern struct ad5246_dpot_init_param ad5246_init_params;
188extern struct ad5242_dpot_init_param ad5242_init_params;
189extern struct ad5171_dpot_init_param ad5171_init_params;
190extern struct ad516x_dpot_init_param ad5165_init_params;
191extern struct ad5228_dpot_init_param ad5228_init_params;
192int32_t init_system(void);
194#endif // APP_CONFIG_H
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
The file contain common macros that needs to be followed same across all the projects.
struct ad5246_dpot_init_param ad5246_init_params
Definition ad524x_user_config.c:54
#define MAX_DEVICE_NAME_LEN
Definition app_config.h:120
struct no_os_spi_init_param spi_mode2_init_params
Definition app_config.c:50
const struct dpot_ops ad5259_dpot_ops
struct active_dpot_device_info active_dpot_device
char * active_virtual_com_serial_num
active_dpot_device oactive_dev
Definition app_config.c:141
const struct dpot_ops ad5144_dpot_ops
struct ad5171_dpot_init_param ad5171_init_params
Definition ad517x_user_config.c:47
struct no_os_spi_init_param spi_mode0_init_params
Definition app_config.c:60
const struct dpot_ops ad5242_dpot_ops
const struct dpot_ops ad5161_dpot_ops
struct ad5141_dpot_init_param ad5141_init_params
Definition ad514x_user_config.c:48
struct ad5259_dpot_init_param ad5259_init_params
Definition ad525x_user_config.c:45
struct ad5228_dpot_init_param ad5228_init_params
const struct dpot_ops ad5171_dpot_ops
struct ad516x_dpot_init_param ad5165_init_params
Definition ad516x_user_config.c:56
struct ad5144_dpot_init_param ad5144_init_params
Definition ad514x_user_config.c:97
dpot_device_info dpot_info[]
Definition dpot_info_table.c:45
struct ad516x_dpot_init_param ad5161_init_params
Definition ad516x_user_config.c:44
const struct dpot_ops ad5246_dpot_ops
struct ad5143_dpot_init_param ad5143_init_params
Definition ad514x_user_config.c:126
const struct dpot_ops ad5143_dpot_ops
const struct dpot_ops ad5141_dpot_ops
const struct dpot_ops ad5165_dpot_ops
struct ad5242_dpot_init_param ad5242_init_params
Definition ad524x_user_config.c:45
const struct dpot_ops ad5228_dpot_ops
struct ad5142_dpot_init_param ad5142_init_params
Definition ad514x_user_config.c:72
const struct dpot_ops ad5142_dpot_ops
struct no_os_i2c_init_param i2c_init_params
Definition app_config.c:70
dpot_operating_mode
Digital potentiometer operating mode.
Definition dpot.h:107
dpot_dev_id
Digital potentiometer device IDs.
Definition dpot.h:44
dpot_intf_type
digital potentiometer interface type.
Definition dpot.h:73
Header file for STM32 platform configurations.
Active device information for the initial configuration.
Definition app_config.h:141
uint8_t device_i2c_addr
Definition app_config.h:149
uint8_t max_chns_pot
Definition app_config.h:151
enum dpot_intf_type intf_type
Definition app_config.h:143
uint8_t max_chns_linGain
Definition app_config.h:153
enum dpot_dev_id active_device
Definition app_config.h:147
char active_device_name[MAX_DEVICE_NAME_LEN]
Definition app_config.h:145
enum dpot_operating_mode mode
Definition app_config.h:155
Definition app_config.h:126
struct dpot_init_param dpot_init_params
Definition app_config.h:134
uint8_t num_of_channels
Definition app_config.h:131
char device_name[8]
Definition app_config.h:127
uint8_t device_i2c_addr
Definition app_config.h:129
uint8_t nSupportedInterface
Definition app_config.h:133
uint8_t max_position
Definition app_config.h:128
Digital potentiometer init parameters.
Definition dpot.h:158
Digital potentiometer common APIs.
Definition dpot.h:189