Forked repository for pushing changes to EVAL-AD4696

Dependencies:   platform_drivers

Committer:
pmallick
Date:
Thu Sep 30 11:01:05 2021 +0530
Revision:
1:8792acb5a039
AD4696 IIO Application- Initial Revision

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pmallick 1:8792acb5a039 1 /*************************************************************************//**
pmallick 1:8792acb5a039 2 * @file app_config.h
pmallick 1:8792acb5a039 3 * @brief Configuration file for AD4696 device applications
pmallick 1:8792acb5a039 4 ******************************************************************************
pmallick 1:8792acb5a039 5 * Copyright (c) 2021 Analog Devices, Inc.
pmallick 1:8792acb5a039 6 *
pmallick 1:8792acb5a039 7 * All rights reserved.
pmallick 1:8792acb5a039 8 *
pmallick 1:8792acb5a039 9 * This software is proprietary to Analog Devices, Inc. and its licensors.
pmallick 1:8792acb5a039 10 * By using this software you agree to the terms of the associated
pmallick 1:8792acb5a039 11 * Analog Devices Software License Agreement.
pmallick 1:8792acb5a039 12 *****************************************************************************/
pmallick 1:8792acb5a039 13
pmallick 1:8792acb5a039 14 #ifndef APP_CONFIG_H
pmallick 1:8792acb5a039 15 #define APP_CONFIG_H
pmallick 1:8792acb5a039 16
pmallick 1:8792acb5a039 17 /******************************************************************************/
pmallick 1:8792acb5a039 18 /***************************** Include Files **********************************/
pmallick 1:8792acb5a039 19 /******************************************************************************/
pmallick 1:8792acb5a039 20
pmallick 1:8792acb5a039 21 #include <stdint.h>
pmallick 1:8792acb5a039 22
pmallick 1:8792acb5a039 23 /******************************************************************************/
pmallick 1:8792acb5a039 24 /********************** Macros and Constants Definition ***********************/
pmallick 1:8792acb5a039 25 /******************************************************************************/
pmallick 1:8792acb5a039 26
pmallick 1:8792acb5a039 27 /* List of supported platforms*/
pmallick 1:8792acb5a039 28 #define MBED_PLATFORM 1
pmallick 1:8792acb5a039 29
pmallick 1:8792acb5a039 30 /* Select the active platform */
pmallick 1:8792acb5a039 31 #define ACTIVE_PLATFORM MBED_PLATFORM
pmallick 1:8792acb5a039 32
pmallick 1:8792acb5a039 33 #if (ACTIVE_PLATFORM == MBED_PLATFORM)
pmallick 1:8792acb5a039 34 #include "app_config_mbed.h"
pmallick 1:8792acb5a039 35
pmallick 1:8792acb5a039 36 /* Used to form a VCOM serial number */
pmallick 1:8792acb5a039 37 #define FIRMWARE_NAME "ad4696_mbed_iio_application"
pmallick 1:8792acb5a039 38
pmallick 1:8792acb5a039 39 /* Redefine the init params structure mapping w.r.t. platform */
pmallick 1:8792acb5a039 40 #define bsy_gpio_extra_init_params mbed_gpio_bsy_extra_init_params
pmallick 1:8792acb5a039 41 #define ext_int_extra_init_params mbed_ext_int_extra_init_params
pmallick 1:8792acb5a039 42 #define uart_extra_init_params mbed_uart_extra_init_params
pmallick 1:8792acb5a039 43 #define spi_extra_init_params mbed_spi_extra_init_params
pmallick 1:8792acb5a039 44 #else
pmallick 1:8792acb5a039 45 #error "No/Invalid active platform selected"
pmallick 1:8792acb5a039 46 #endif
pmallick 1:8792acb5a039 47
pmallick 1:8792acb5a039 48 // **** Note for User: ACTIVE_DEVICE selection **** //
pmallick 1:8792acb5a039 49 /* Define the device type here from the list of below device type defines
pmallick 1:8792acb5a039 50 * (one at a time. Defining more than one device can result into compile error).
pmallick 1:8792acb5a039 51 * e.g. #define DEV_AD4696 -> This will make AD4696 as an ACTIVE_DEVICE.
pmallick 1:8792acb5a039 52 * The ACTIVE_DEVICE is default set to AD4696 if device type is not defined.
pmallick 1:8792acb5a039 53 * */
pmallick 1:8792acb5a039 54
pmallick 1:8792acb5a039 55 //#define DEV_AD4696
pmallick 1:8792acb5a039 56
pmallick 1:8792acb5a039 57 #if defined(DEV_AD4696)
pmallick 1:8792acb5a039 58 #define ACTIVE_DEVICE ID_AD4696
pmallick 1:8792acb5a039 59 #define ACTIVE_DEVICE_NAME "AD4696"
pmallick 1:8792acb5a039 60 #elif defined(DEV_AD4695)
pmallick 1:8792acb5a039 61 #define ACTIVE_DEVICE ID_AD4695
pmallick 1:8792acb5a039 62 #define ACTIVE_DEVICE_NAME "AD4695"
pmallick 1:8792acb5a039 63 #else
pmallick 1:8792acb5a039 64 #warning No/Unsupported ADxxxxy symbol defined. AD4696 defined
pmallick 1:8792acb5a039 65 #define DEV_AD4696
pmallick 1:8792acb5a039 66 #define ACTIVE_DEVICE ID_AD4696
pmallick 1:8792acb5a039 67 #define ACTIVE_DEVICE_NAME "AD4696"
pmallick 1:8792acb5a039 68 #endif
pmallick 1:8792acb5a039 69
pmallick 1:8792acb5a039 70 #if defined(DEV_AD4696)
pmallick 1:8792acb5a039 71 #define NO_OF_CHANNELS 16
pmallick 1:8792acb5a039 72 #define ADC_RESOLUTION 16
pmallick 1:8792acb5a039 73 #elif defined(DEV_AD4695)
pmallick 1:8792acb5a039 74 #define NO_OF_CHANNELS 16
pmallick 1:8792acb5a039 75 #define ADC_RESOLUTION 16
pmallick 1:8792acb5a039 76 #else
pmallick 1:8792acb5a039 77 /* Default config for AD4696 */
pmallick 1:8792acb5a039 78 #define NO_OF_CHANNELS 16
pmallick 1:8792acb5a039 79 #define ADC_RESOLUTION 16
pmallick 1:8792acb5a039 80 #endif
pmallick 1:8792acb5a039 81
pmallick 1:8792acb5a039 82 // **** Note for User: Polarity Mode selection **** //
pmallick 1:8792acb5a039 83 /* Since the pin pairing option is same for all the channels in
pmallick 1:8792acb5a039 84 * standard sequencer mode, hence polarity mode for all the
pmallick 1:8792acb5a039 85 * channels is also kept same to avoid stale ADC output codes.
pmallick 1:8792acb5a039 86 * Make sure to change the JP6 jumper position on the Eval board to A
pmallick 1:8792acb5a039 87 * to use the PSEUDO_BIPOLAR_MODE.
pmallick 1:8792acb5a039 88 *
pmallick 1:8792acb5a039 89 * Select Pseudo bipolar mode (default is unipolar mode) for all the channels.
pmallick 1:8792acb5a039 90 * e.g. #define PSEUDO_BIPOLAR_MODE -> This will enable the PSEUDO_BIPOLAR_MODE
pmallick 1:8792acb5a039 91 * for all the channels.
pmallick 1:8792acb5a039 92 * */
pmallick 1:8792acb5a039 93
pmallick 1:8792acb5a039 94 //#define PSEUDO_BIPOLAR_MODE
pmallick 1:8792acb5a039 95
pmallick 1:8792acb5a039 96 /* Pins to be used an interrupt to trigger callback function */
pmallick 1:8792acb5a039 97 #define EXT_TRIGGER_PIN CONVST_PIN
pmallick 1:8792acb5a039 98
pmallick 1:8792acb5a039 99 /* ADC max count (full scale value) for unipolar inputs */
pmallick 1:8792acb5a039 100 #define ADC_MAX_COUNT_UNIPOLAR (uint32_t)((1 << ADC_RESOLUTION) - 1)
pmallick 1:8792acb5a039 101
pmallick 1:8792acb5a039 102 /* ADC max count (full scale value) for bipolar inputs */
pmallick 1:8792acb5a039 103 #define ADC_MAX_COUNT_BIPOLAR (uint32_t)(1 << (ADC_RESOLUTION-1))
pmallick 1:8792acb5a039 104
pmallick 1:8792acb5a039 105 /* Baud rate for IIO application UART interface */
pmallick 1:8792acb5a039 106 #define IIO_UART_BAUD_RATE (230400)
pmallick 1:8792acb5a039 107
pmallick 1:8792acb5a039 108 /****** Macros used to form a VCOM serial number ******/
pmallick 1:8792acb5a039 109 #if !defined(DEVICE_NAME)
pmallick 1:8792acb5a039 110 #define DEVICE_NAME "DEV_AD4696"
pmallick 1:8792acb5a039 111 #endif
pmallick 1:8792acb5a039 112
pmallick 1:8792acb5a039 113 #if !defined(PLATFORM_NAME)
pmallick 1:8792acb5a039 114 #define PLATFORM_NAME "SDP_K1"
pmallick 1:8792acb5a039 115 #endif
pmallick 1:8792acb5a039 116 /******/
pmallick 1:8792acb5a039 117
pmallick 1:8792acb5a039 118 /* Enable the VirtualCOM port connection/interface. By default serial communication
pmallick 1:8792acb5a039 119 * is physical UART */
pmallick 1:8792acb5a039 120 //#define USE_VIRTUAL_COM_PORT
pmallick 1:8792acb5a039 121
pmallick 1:8792acb5a039 122 #if defined(USE_VIRTUAL_COM_PORT)
pmallick 1:8792acb5a039 123 /* Below USB configurations (VID and PID) are owned and assigned by ADI.
pmallick 1:8792acb5a039 124 * If intended to distribute software further, use the VID and PID owned by your
pmallick 1:8792acb5a039 125 * organization */
pmallick 1:8792acb5a039 126 #define VIRTUAL_COM_PORT_VID 0x0456
pmallick 1:8792acb5a039 127 #define VIRTUAL_COM_PORT_PID 0xb66c
pmallick 1:8792acb5a039 128 /* Serial number string is formed as: application name + device (target) name + platform (host) name */
pmallick 1:8792acb5a039 129 #define VIRTUAL_COM_SERIAL_NUM (FIRMWARE_NAME "_" DEVICE_NAME "_" PLATFORM_NAME)
pmallick 1:8792acb5a039 130 #endif
pmallick 1:8792acb5a039 131
pmallick 1:8792acb5a039 132 /******************************************************************************/
pmallick 1:8792acb5a039 133 /********************** Variables and User Defined Data Types *****************/
pmallick 1:8792acb5a039 134 /******************************************************************************/
pmallick 1:8792acb5a039 135
pmallick 1:8792acb5a039 136 /******************************************************************************/
pmallick 1:8792acb5a039 137 /************************ Public Declarations *********************************/
pmallick 1:8792acb5a039 138 /******************************************************************************/
pmallick 1:8792acb5a039 139
pmallick 1:8792acb5a039 140 /* UART init parameters structure */
pmallick 1:8792acb5a039 141 extern struct uart_init_param uart_init_params;
pmallick 1:8792acb5a039 142
pmallick 1:8792acb5a039 143 /* PWM descriptor */
pmallick 1:8792acb5a039 144 extern struct pwm_desc *pwm_desc;
pmallick 1:8792acb5a039 145
pmallick 1:8792acb5a039 146 /* Initializing system peripherals */
pmallick 1:8792acb5a039 147 int32_t init_system(void);
pmallick 1:8792acb5a039 148
pmallick 1:8792acb5a039 149 #endif //APP_CONFIG_H