precision-converters-firmware
nanodac_console_app.h
Go to the documentation of this file.
1 
17 #ifndef NANODAC_CONSOLE_APP_H_
18 #define NANODAC_CONSOLE_APP_H_
19 
20 /******************************************************************************/
21 /***************************** Include Files **********************************/
22 /******************************************************************************/
23 
24 #include "adi_console_menu.h"
25 #include "app_config.h"
26 
27 /******************************************************************************/
28 /********************** Macros and Constants Definitions **********************/
29 /******************************************************************************/
30 
31 // Define the DAC channel menu selection. The following devices from nanodac
32 // family have only single channel and does not need menu to select DAC channel.
33 #if !(defined(DEV_AD5683) || defined(DEV_AD5683R) || defined(DEV_AD5682R) || \
34  defined(DEV_AD5681R) || defined(DEV_AD5693) || defined(DEV_AD5693R) || \
35  defined(DEV_AD5692R) || defined(DEV_AD5691R))
36 #define DISPLAY_DAC_CHANNEL_SELECT_MENU
37 // Define the number of DAC channels (for devices having more than 1 channel)
38 #if (defined(DEV_AD5687) || defined(DEV_AD5687R) || defined(DEV_AD5697R) || \
39  defined(DEV_AD5689) || defined(DEV_AD5689R))
40 #define DAC_CHANNEL_COUNT 2
41 #elif (defined(DEV_AD5686) || defined(DEV_AD5686R) || defined(DEV_AD5685R) || \
42  defined(DEV_AD5684) || defined(DEV_AD5684R) || \
43  defined(DEV_AD5696) || defined(DEV_AD5696R) || defined(DEV_AD5695R) || \
44  defined(DEV_AD5694) || defined(DEV_AD5694R))
45 #define DAC_CHANNEL_COUNT 4
46 #elif (defined(DEV_AD5676) || defined(DEV_AD5676R) || defined(DEV_AD5672R) || \
47  defined(DEV_AD5675R) || defined(DEV_AD5671R))
48 #define DAC_CHANNEL_COUNT 8
49 #elif (defined(DEV_AD5679) || defined(DEV_AD5679R) || defined(DEV_AD5673R) || \
50  defined(DEV_AD5674) || defined(DEV_AD5674R) || defined(DEV_AD5677R))
51 #define DAC_CHANNEL_COUNT 16
52 #endif
53 #endif
54 
55 // Define the LDAC masking menu. The following devices from nanodac
56 // family have only single channel and does not need menu to select LDAC masking.
57 #if !(defined(DEV_AD5683) || defined(DEV_AD5683R) || \
58  defined(DEV_AD5682R) || defined(DEV_AD5681R) || defined(DEV_AD5693) || \
59  defined(DEV_AD5693R) || defined(DEV_AD5692R) || defined(DEV_AD5691R))
60 #define DISPLAY_LDAC_MASK_SELECT_MENU
61 #endif
62 
63 // Define the Vref source selections. The following devices from nanodac
64 // family have only external Vref source.
65 #if (defined(DEV_AD5674) || defined(DEV_AD5676) || defined(DEV_AD5686) || \
66  defined(DEV_AD5684) || defined(DEV_AD5696) || defined(DEV_AD5694) || \
67  defined(DEV_AD5683) || defined(DEV_AD5693) || defined(DEV_AD5679) || \
68  defined(DEV_AD5687) || defined(DEV_AD5689))
69 #define EXT_VREF_SOURCE_ONLY
70 #endif
71 
72 // Define the gain source (software controlled or hardware controlled)
73 #if (defined(DEV_AD5683) || defined(DEV_AD5683R) || defined(DEV_AD5682R) || \
74  defined(DEV_AD5681R) || defined(DEV_AD5693) || defined(DEV_AD5693R) || \
75  defined(DEV_AD5692R) || defined(DEV_AD5691R))
76 #define SOFTWARE_CONTROLLED_GAIN
77 #else
78 #define HARDWARE_CONTROLLED_GAIN
79 #endif
80 
81 // Define the operating mode selections
82 #if (defined(DEV_AD5674) || defined(DEV_AD5674R) || defined(DEV_AD5673R) || \
83  defined(DEV_AD5679) || defined(DEV_AD5677R))
84 #define _1K_TO_GND_POWER_DOWN
85 #elif (defined(DEV_AD5676) || defined(DEV_AD5676R) || defined(DEV_AD5675R) || \
86  defined(DEV_AD5671R) || defined(DEV_AD5672R))
87 #define _1K_TO_GND_POWER_DOWN
88 #define THREE_STATE_POWER_DOWN
89 #else
90 #define _1K_TO_GND_POWER_DOWN
91 #define _100K_TO_GND_POWER_DOWN
92 #define THREE_STATE_POWER_DOWN
93 #endif
94 
95 // define the DAC resolution
96 #if (defined(DEV_AD5671R) || defined(DEV_AD5672R) || defined(DEV_AD5673R) || \
97  defined(DEV_AD5674) || defined(DEV_AD5674R) || defined(DEV_AD5684R) || \
98  defined(DEV_AD5687) || defined(DEV_AD5687R) || defined(DEV_AD5697R) || \
99  defined(DEV_AD5694) || defined(DEV_AD5694R) || defined(DEV_AD5681R) || \
100  defined(DEV_AD5691R))
101 #define TOTAL_OUTPUT_CODES ((1U << 12) - 1) // For 12-bit DAC (2^12 - 1)
102 #elif (defined(DEV_AD5685R) || defined(DEV_AD5695R) || defined(DEV_AD5682R) || \
103  defined(DEV_AD5692R))
104 #define TOTAL_OUTPUT_CODES ((1U << 14) - 1) // For 14-bit DAC (2^14 - 1)
105 #else
106 #define TOTAL_OUTPUT_CODES ((1U << 16) - 1) // For 16-bit DAC (2^16 - 1)
107 #endif
108 
109 /******************************************************************************/
110 /********************** Variables and User Defined Data Types *****************/
111 /******************************************************************************/
112 
114 
115 /******************************************************************************/
116 /************************ Public Declarations *********************************/
117 /******************************************************************************/
118 
119 int32_t nanodac_app_initialize(void);
120 
121 
122 #endif /* NANODAC_CONSOLE_APP_H_ */
: A simple console menu manager handler
Configuration file of nanodac firmware example program.
int32_t nanodac_app_initialize(void)
Definition: nanodac_console_app.c:124
console_menu nanodac_main_menu
Definition: nanodac_console_app.c:799
Definition: adi_console_menu.h:89