Pratyush Mallick
/
nano_dac
this is testing
app/nanodac_console_app.h@0:e8a1ba50c46b, 2021-01-14 (annotated)
- Committer:
- pmallick
- Date:
- Thu Jan 14 19:12:57 2021 +0530
- Revision:
- 0:e8a1ba50c46b
this is testing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pmallick | 0:e8a1ba50c46b | 1 | /*! |
pmallick | 0:e8a1ba50c46b | 2 | ***************************************************************************** |
pmallick | 0:e8a1ba50c46b | 3 | @file: nanodac_console_app.h |
pmallick | 0:e8a1ba50c46b | 4 | |
pmallick | 0:e8a1ba50c46b | 5 | @brief: defines the console menu structure for the nanodac example code |
pmallick | 0:e8a1ba50c46b | 6 | |
pmallick | 0:e8a1ba50c46b | 7 | @details: |
pmallick | 0:e8a1ba50c46b | 8 | ----------------------------------------------------------------------------- |
pmallick | 0:e8a1ba50c46b | 9 | Copyright (c) 2020 Analog Devices, Inc. |
pmallick | 0:e8a1ba50c46b | 10 | All rights reserved. |
pmallick | 0:e8a1ba50c46b | 11 | |
pmallick | 0:e8a1ba50c46b | 12 | This software is proprietary to Analog Devices, Inc. and its licensors. |
pmallick | 0:e8a1ba50c46b | 13 | By using this software you agree to the terms of the associated |
pmallick | 0:e8a1ba50c46b | 14 | Analog Devices Software License Agreement. |
pmallick | 0:e8a1ba50c46b | 15 | *****************************************************************************/ |
pmallick | 0:e8a1ba50c46b | 16 | |
pmallick | 0:e8a1ba50c46b | 17 | #ifndef NANODAC_CONSOLE_APP_H_ |
pmallick | 0:e8a1ba50c46b | 18 | #define NANODAC_CONSOLE_APP_H_ |
pmallick | 0:e8a1ba50c46b | 19 | |
pmallick | 0:e8a1ba50c46b | 20 | /******************************************************************************/ |
pmallick | 0:e8a1ba50c46b | 21 | /***************************** Include Files **********************************/ |
pmallick | 0:e8a1ba50c46b | 22 | /******************************************************************************/ |
pmallick | 0:e8a1ba50c46b | 23 | |
pmallick | 0:e8a1ba50c46b | 24 | #include "adi_console_menu.h" |
pmallick | 0:e8a1ba50c46b | 25 | #include "app_config.h" |
pmallick | 0:e8a1ba50c46b | 26 | |
pmallick | 0:e8a1ba50c46b | 27 | /******************************************************************************/ |
pmallick | 0:e8a1ba50c46b | 28 | /********************** Macros and Constants Definitions **********************/ |
pmallick | 0:e8a1ba50c46b | 29 | /******************************************************************************/ |
pmallick | 0:e8a1ba50c46b | 30 | |
pmallick | 0:e8a1ba50c46b | 31 | // Define the DAC channel menu selection. The following devices from nanodac |
pmallick | 0:e8a1ba50c46b | 32 | // family have only single channel and does not need menu to select DAC channel. |
pmallick | 0:e8a1ba50c46b | 33 | #if !(defined(DEV_AD5683) || defined(DEV_AD5683R) || defined(DEV_AD5682R) || \ |
pmallick | 0:e8a1ba50c46b | 34 | defined(DEV_AD5681R) || defined(DEV_AD5693) || defined(DEV_AD5693R) || \ |
pmallick | 0:e8a1ba50c46b | 35 | defined(DEV_AD5692R) || defined(DEV_AD5691R)) |
pmallick | 0:e8a1ba50c46b | 36 | #define DISPLAY_DAC_CHANNEL_SELECT_MENU |
pmallick | 0:e8a1ba50c46b | 37 | // Define the number of DAC channels (for devices having more than 1 channel) |
pmallick | 0:e8a1ba50c46b | 38 | #if (defined(DEV_AD5687) || defined(DEV_AD5687R) || defined(DEV_AD5697R) || \ |
pmallick | 0:e8a1ba50c46b | 39 | defined(DEV_AD5689) || defined(DEV_AD5689R)) |
pmallick | 0:e8a1ba50c46b | 40 | #define DAC_CHANNEL_COUNT 2 |
pmallick | 0:e8a1ba50c46b | 41 | #elif (defined(DEV_AD5686) || defined(DEV_AD5686R) || defined(DEV_AD5685R) || \ |
pmallick | 0:e8a1ba50c46b | 42 | defined(DEV_AD5684) || defined(DEV_AD5684R) || \ |
pmallick | 0:e8a1ba50c46b | 43 | defined(DEV_AD5696) || defined(DEV_AD5696R) || defined(DEV_AD5695R) || \ |
pmallick | 0:e8a1ba50c46b | 44 | defined(DEV_AD5694) || defined(DEV_AD5694R)) |
pmallick | 0:e8a1ba50c46b | 45 | #define DAC_CHANNEL_COUNT 4 |
pmallick | 0:e8a1ba50c46b | 46 | #elif (defined(DEV_AD5676) || defined(DEV_AD5676R) || defined(DEV_AD5672R) || \ |
pmallick | 0:e8a1ba50c46b | 47 | defined(DEV_AD5675R) || defined(DEV_AD5671R)) |
pmallick | 0:e8a1ba50c46b | 48 | #define DAC_CHANNEL_COUNT 8 |
pmallick | 0:e8a1ba50c46b | 49 | #elif (defined(DEV_AD5679) || defined(DEV_AD5679R) || defined(DEV_AD5673R) || \ |
pmallick | 0:e8a1ba50c46b | 50 | defined(DEV_AD5674) || defined(DEV_AD5674R) || defined(DEV_AD5677R)) |
pmallick | 0:e8a1ba50c46b | 51 | #define DAC_CHANNEL_COUNT 16 |
pmallick | 0:e8a1ba50c46b | 52 | #endif |
pmallick | 0:e8a1ba50c46b | 53 | #endif |
pmallick | 0:e8a1ba50c46b | 54 | |
pmallick | 0:e8a1ba50c46b | 55 | // Define the LDAC masking menu. The following devices from nanodac |
pmallick | 0:e8a1ba50c46b | 56 | // family have only single channel and does not need menu to select LDAC masking. |
pmallick | 0:e8a1ba50c46b | 57 | #if !(defined(DEV_AD5683) || defined(DEV_AD5683R) || \ |
pmallick | 0:e8a1ba50c46b | 58 | defined(DEV_AD5682R) || defined(DEV_AD5681R) || defined(DEV_AD5693) || \ |
pmallick | 0:e8a1ba50c46b | 59 | defined(DEV_AD5693R) || defined(DEV_AD5692R) || defined(DEV_AD5691R)) |
pmallick | 0:e8a1ba50c46b | 60 | #define DISPLAY_LDAC_MASK_SELECT_MENU |
pmallick | 0:e8a1ba50c46b | 61 | #endif |
pmallick | 0:e8a1ba50c46b | 62 | |
pmallick | 0:e8a1ba50c46b | 63 | // Define the Vref source selections. The following devices from nanodac |
pmallick | 0:e8a1ba50c46b | 64 | // family have only external Vref source. |
pmallick | 0:e8a1ba50c46b | 65 | #if (defined(DEV_AD5674) || defined(DEV_AD5676) || defined(DEV_AD5686) || \ |
pmallick | 0:e8a1ba50c46b | 66 | defined(DEV_AD5684) || defined(DEV_AD5696) || defined(DEV_AD5694) || \ |
pmallick | 0:e8a1ba50c46b | 67 | defined(DEV_AD5683) || defined(DEV_AD5693) || defined(DEV_AD5679) || \ |
pmallick | 0:e8a1ba50c46b | 68 | defined(DEV_AD5687) || defined(DEV_AD5689)) |
pmallick | 0:e8a1ba50c46b | 69 | #define EXT_VREF_SOURCE_ONLY |
pmallick | 0:e8a1ba50c46b | 70 | #endif |
pmallick | 0:e8a1ba50c46b | 71 | |
pmallick | 0:e8a1ba50c46b | 72 | // Define the gain source (software controlled or hardware controlled) |
pmallick | 0:e8a1ba50c46b | 73 | #if (defined(DEV_AD5683) || defined(DEV_AD5683R) || defined(DEV_AD5682R) || \ |
pmallick | 0:e8a1ba50c46b | 74 | defined(DEV_AD5681R) || defined(DEV_AD5693) || defined(DEV_AD5693R) || \ |
pmallick | 0:e8a1ba50c46b | 75 | defined(DEV_AD5692R) || defined(DEV_AD5691R)) |
pmallick | 0:e8a1ba50c46b | 76 | #define SOFTWARE_CONTROLLED_GAIN |
pmallick | 0:e8a1ba50c46b | 77 | #else |
pmallick | 0:e8a1ba50c46b | 78 | #define HARDWARE_CONTROLLED_GAIN |
pmallick | 0:e8a1ba50c46b | 79 | #endif |
pmallick | 0:e8a1ba50c46b | 80 | |
pmallick | 0:e8a1ba50c46b | 81 | // Define the operating mode selections |
pmallick | 0:e8a1ba50c46b | 82 | #if (defined(DEV_AD5674) || defined(DEV_AD5674R) || defined(DEV_AD5673R) || \ |
pmallick | 0:e8a1ba50c46b | 83 | defined(DEV_AD5679) || defined(DEV_AD5677R)) |
pmallick | 0:e8a1ba50c46b | 84 | #define _1K_TO_GND_POWER_DOWN |
pmallick | 0:e8a1ba50c46b | 85 | #elif (defined(DEV_AD5676) || defined(DEV_AD5676R) || defined(DEV_AD5675R) || \ |
pmallick | 0:e8a1ba50c46b | 86 | defined(DEV_AD5671R) || defined(DEV_AD5672R)) |
pmallick | 0:e8a1ba50c46b | 87 | #define _1K_TO_GND_POWER_DOWN |
pmallick | 0:e8a1ba50c46b | 88 | #define THREE_STATE_POWER_DOWN |
pmallick | 0:e8a1ba50c46b | 89 | #else |
pmallick | 0:e8a1ba50c46b | 90 | #define _1K_TO_GND_POWER_DOWN |
pmallick | 0:e8a1ba50c46b | 91 | #define _100K_TO_GND_POWER_DOWN |
pmallick | 0:e8a1ba50c46b | 92 | #define THREE_STATE_POWER_DOWN |
pmallick | 0:e8a1ba50c46b | 93 | #endif |
pmallick | 0:e8a1ba50c46b | 94 | |
pmallick | 0:e8a1ba50c46b | 95 | // define the DAC resolution |
pmallick | 0:e8a1ba50c46b | 96 | #if (defined(DEV_AD5671R) || defined(DEV_AD5672R) || defined(DEV_AD5673R) || \ |
pmallick | 0:e8a1ba50c46b | 97 | defined(DEV_AD5674) || defined(DEV_AD5674R) || defined(DEV_AD5684R) || \ |
pmallick | 0:e8a1ba50c46b | 98 | defined(DEV_AD5687) || defined(DEV_AD5687R) || defined(DEV_AD5697R) || \ |
pmallick | 0:e8a1ba50c46b | 99 | defined(DEV_AD5694) || defined(DEV_AD5694R) || defined(DEV_AD5681R) || \ |
pmallick | 0:e8a1ba50c46b | 100 | defined(DEV_AD5691R)) |
pmallick | 0:e8a1ba50c46b | 101 | #define TOTAL_OUTPUT_CODES ((1U << 12) - 1) // For 12-bit DAC (2^12 - 1) |
pmallick | 0:e8a1ba50c46b | 102 | #elif (defined(DEV_AD5685R) || defined(DEV_AD5695R) || defined(DEV_AD5682R) || \ |
pmallick | 0:e8a1ba50c46b | 103 | defined(DEV_AD5692R)) |
pmallick | 0:e8a1ba50c46b | 104 | #define TOTAL_OUTPUT_CODES ((1U << 14) - 1) // For 14-bit DAC (2^14 - 1) |
pmallick | 0:e8a1ba50c46b | 105 | #else |
pmallick | 0:e8a1ba50c46b | 106 | #define TOTAL_OUTPUT_CODES ((1U << 16) - 1) // For 16-bit DAC (2^16 - 1) |
pmallick | 0:e8a1ba50c46b | 107 | #endif |
pmallick | 0:e8a1ba50c46b | 108 | |
pmallick | 0:e8a1ba50c46b | 109 | /******************************************************************************/ |
pmallick | 0:e8a1ba50c46b | 110 | /********************** Variables and User Defined Data Types *****************/ |
pmallick | 0:e8a1ba50c46b | 111 | /******************************************************************************/ |
pmallick | 0:e8a1ba50c46b | 112 | |
pmallick | 0:e8a1ba50c46b | 113 | extern console_menu nanodac_main_menu; |
pmallick | 0:e8a1ba50c46b | 114 | |
pmallick | 0:e8a1ba50c46b | 115 | /******************************************************************************/ |
pmallick | 0:e8a1ba50c46b | 116 | /************************ Public Declarations *********************************/ |
pmallick | 0:e8a1ba50c46b | 117 | /******************************************************************************/ |
pmallick | 0:e8a1ba50c46b | 118 | |
pmallick | 0:e8a1ba50c46b | 119 | int32_t nanodac_app_initialize(void); |
pmallick | 0:e8a1ba50c46b | 120 | |
pmallick | 0:e8a1ba50c46b | 121 | |
pmallick | 0:e8a1ba50c46b | 122 | #endif /* NANODAC_CONSOLE_APP_H_ */ |