Example Program for EVAL-AD7606
Dependencies: platform_drivers
Diff: app/app_config.h
- Revision:
- 6:32de160dce43
- Parent:
- 1:819ac9aa5667
--- a/app/app_config.h Mon Oct 19 07:54:56 2020 +0000 +++ b/app/app_config.h Wed Jul 21 11:16:56 2021 +0100 @@ -1,9 +1,8 @@ /*************************************************************************//** * @file app_config.h - * @brief Configuration file for AD7606 device applications + * @brief Header file for application configurations (platform-agnostic) ****************************************************************************** -* Copyright (c) 2020 Analog Devices, Inc. -* +* Copyright (c) 2020-2021 Analog Devices, Inc. * All rights reserved. * * This software is proprietary to Analog Devices, Inc. and its licensors. @@ -14,8 +13,21 @@ #ifndef _APP_CONFIG_H_ #define _APP_CONFIG_H_ +/* List of supported platforms*/ +#define MBED_PLATFORM 1 + +/* Select the active platform */ +#define ACTIVE_PLATFORM MBED_PLATFORM + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ + #include <stdint.h> -#include <PinNames.h> + +/******************************************************************************/ +/********************** Macros and Constants Definition ***********************/ +/******************************************************************************/ // **** Note for User: ACTIVE_DEVICE selection ****// /* Define the device type here from the list of below device type defines @@ -28,39 +40,38 @@ #if defined(DEV_AD7605_4) #define ACTIVE_DEVICE ID_AD7605_4 -#define ACTIVE_DEVICE_NAME "AD7605-4-phy" +#define ACTIVE_DEVICE_NAME "ad7605-4" #elif defined(DEV_AD7606_4) #define ACTIVE_DEVICE ID_AD7606_4 -#define ACTIVE_DEVICE_NAME "AD7606-4-phy" +#define ACTIVE_DEVICE_NAME "ad7606-4" #elif defined(DEV_AD7606_6) #define ACTIVE_DEVICE ID_AD7606_6 -#define ACTIVE_DEVICE_NAME "AD7606-6-phy" +#define ACTIVE_DEVICE_NAME "ad7606-6" #elif defined(DEV_AD7606_8) #define ACTIVE_DEVICE ID_AD7606_8 -#define ACTIVE_DEVICE_NAME "AD7606-8-phy" +#define ACTIVE_DEVICE_NAME "ad7606-8" #elif defined(DEV_AD7606B) #define ACTIVE_DEVICE ID_AD7606B -#define ACTIVE_DEVICE_NAME "AD7606B-phy" +#define ACTIVE_DEVICE_NAME "ad7606b" #elif defined(DEV_AD7606C_16) #define ACTIVE_DEVICE ID_AD7606C_16 -#define ACTIVE_DEVICE_NAME "AD7606C-16-phy" +#define ACTIVE_DEVICE_NAME "ad7606c-16" #elif defined(DEV_AD7606C_18) #define ACTIVE_DEVICE ID_AD7606C_18 -#define ACTIVE_DEVICE_NAME "AD7606C-18-phy" +#define ACTIVE_DEVICE_NAME "ad7606c-18" #elif defined(DEV_AD7608) #define ACTIVE_DEVICE ID_AD7608 -#define ACTIVE_DEVICE_NAME "AD7608-phy" +#define ACTIVE_DEVICE_NAME "ad7608" #elif defined(DEV_AD7609) #define ACTIVE_DEVICE ID_AD7609 -#define ACTIVE_DEVICE_NAME "AD7609-phy" +#define ACTIVE_DEVICE_NAME "ad7609" #else #warning No/Unsupported ADxxxxy symbol defined. AD7606B defined #define DEV_AD7606B #define ACTIVE_DEVICE ID_AD7606B -#define ACTIVE_DEVICE_NAME "AD7606B-phy" +#define ACTIVE_DEVICE_NAME "ad7606b" #endif - #if defined(DEV_AD7605_4) #define AD7606X_ADC_CHANNELS 4 #define AD7606X_ADC_RESOLUTION 16 @@ -94,31 +105,64 @@ #define AD7606X_ADC_RESOLUTION 16 #endif +/* Macros for stringification */ +#define XSTR(s) STR(s) +#define STR(s) #s + +/****** Macros used to form a VCOM serial number ******/ +#if !defined(DEVICE_NAME) +#define DEVICE_NAME "DEV_AD760B" +#endif + +#if !defined(PLATFORM_NAME) +#define PLATFORM_NAME "SDP_K1" +#endif +/******/ + +#if (ACTIVE_PLATFORM == MBED_PLATFORM) +#include "app_config_mbed.h" + +/* Used to form a VCOM serial number */ +#define FIRMWARE_NAME "ad7606_mbed_iio_application" + +/* Redefine the init params structure mapping w.r.t. platform */ +#define ext_int_extra_init_params mbed_ext_int_extra_init_params +#define uart_extra_init_params mbed_uart_extra_init_params +#define spi_extra_init_params mbed_spi_extra_init_params +#else +#error "No/Invalid active platform selected" +#endif + /* ADC max count (full scale value) for unipolar inputs */ #define ADC_MAX_COUNT_UNIPOLAR (uint32_t)((1 << AD7606X_ADC_RESOLUTION) - 1) /* ADC max count (full scale value) for bipolar inputs */ #define ADC_MAX_COUNT_BIPOLAR (uint32_t)(1 << (AD7606X_ADC_RESOLUTION-1)) -// Pin mapping of AD7606 w.r.t Arduino (reference: PinNames.h) -#define SPI_SS D10 -#define SPI_MOSI D11 -#define SPI_MISO D12 -#define SPI_SCK D13 +/* Enable the VirtualCOM port connection/interface. By default serial comminunication + * is physical UART */ +//#define USE_VIRTUAL_COM_PORT -#define UART_TX USBTX -#define UART_RX USBRX +#if defined(USE_VIRTUAL_COM_PORT) +/* Below USB configurations (VID and PID) are owned and assigned by ADI. + * If intended to distribute software further, use the VID and PID owned by your + * organization */ +#define VIRTUAL_COM_PORT_VID 0x0456 +#define VIRTUAL_COM_PORT_PID 0xb66c +/* Serial number string is formed as: application name + device (target) name + platform (host) name */ +#define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" PLATFORM_NAME) +#endif -#define OSR0_PIN D2 -#define OSR1_PIN D3 -#define OSR2_PIN D4 -#define RESET_PIN D5 -#define CONVST_PIN D6 -#define BUSY_PIN D7 -#define RANGE_PIN D8 -#define STDBY_PIN D9 +/* Baud rate for IIO application UART interface */ +#define IIO_UART_BAUD_RATE (230400) + +/******************************************************************************/ +/********************** Public/Extern Declarations ****************************/ +/******************************************************************************/ -#define LED_GREEN LED3 +extern struct uart_init_param uart_init_params; +extern struct gpio_desc *led_gpio_desc; +int32_t init_system(void); -#endif //_APP_CONFIG_H_ +#endif /* _APP_CONFIG_H_ */