Example program for EVAL-AD9106 and EVAL-AD9102

Dependencies:   AD910x

Committer:
scabatan
Date:
Fri Mar 26 12:22:13 2021 +0000
Revision:
6:b0e941764bb7
Parent:
4:abab08222795
Child:
7:2ff94dbecc75
Few improvements on main.cpp and added comments in config.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
scabatan 1:b9d129e45c30 1 /* Copyright (c) 2021 Analog Devices, Inc. All rights reserved.
Kjansen45 0:3c9cc352dbfc 2
Kjansen45 0:3c9cc352dbfc 3 Redistribution and use in source and binary forms, with or without modification,
Kjansen45 0:3c9cc352dbfc 4 are permitted provided that the following conditions are met:
Kjansen45 0:3c9cc352dbfc 5 - Redistributions of source code must retain the above copyright notice,
Kjansen45 0:3c9cc352dbfc 6 this list of conditions and the following disclaimer.
Kjansen45 0:3c9cc352dbfc 7 - Redistributions in binary form must reproduce the above copyright notice,
Kjansen45 0:3c9cc352dbfc 8 this list of conditions and the following disclaimer in the documentation
Kjansen45 0:3c9cc352dbfc 9 and/or other materials provided with the distribution.
Kjansen45 0:3c9cc352dbfc 10 - Modified versions of the software must be conspicuously marked as such.
Kjansen45 0:3c9cc352dbfc 11 - This software is licensed solely and exclusively for use with processors/products
Kjansen45 0:3c9cc352dbfc 12 manufactured by or for Analog Devices, Inc.
Kjansen45 0:3c9cc352dbfc 13 - This software may not be combined or merged with other code in any manner
Kjansen45 0:3c9cc352dbfc 14 that would cause the software to become subject to terms and conditions which
Kjansen45 0:3c9cc352dbfc 15 differ from those listed here.
Kjansen45 0:3c9cc352dbfc 16 - Neither the name of Analog Devices, Inc. nor the names of its contributors
Kjansen45 0:3c9cc352dbfc 17 may be used to endorse or promote products derived from this software without
Kjansen45 0:3c9cc352dbfc 18 specific prior written permission.
scabatan 1:b9d129e45c30 19 - The use of this software may or may not infringe the patent rights of one or
Kjansen45 0:3c9cc352dbfc 20 more patent holders. This license does not release you from the requirement
Kjansen45 0:3c9cc352dbfc 21 that you obtain separate licenses from these patent holders to use this software.
scabatan 1:b9d129e45c30 22
Kjansen45 0:3c9cc352dbfc 23 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND
Kjansen45 0:3c9cc352dbfc 24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
Kjansen45 0:3c9cc352dbfc 25 TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
Kjansen45 0:3c9cc352dbfc 26 NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
Kjansen45 0:3c9cc352dbfc 27 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES
Kjansen45 0:3c9cc352dbfc 28 (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL
Kjansen45 0:3c9cc352dbfc 29 PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
Kjansen45 0:3c9cc352dbfc 30 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Kjansen45 0:3c9cc352dbfc 31 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
Kjansen45 0:3c9cc352dbfc 32 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
Kjansen45 0:3c9cc352dbfc 33 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kjansen45 0:3c9cc352dbfc 34
scabatan 1:b9d129e45c30 35 <Insert license number here.>
Kjansen45 0:3c9cc352dbfc 36
Kjansen45 0:3c9cc352dbfc 37 */
Kjansen45 0:3c9cc352dbfc 38
scabatan 1:b9d129e45c30 39 /*** Libraries ***/
scabatan 1:b9d129e45c30 40 #include "mbed.h"
scabatan 1:b9d129e45c30 41 #include "platform/mbed_thread.h"
scabatan 1:b9d129e45c30 42 #include "config.h"
scabatan 1:b9d129e45c30 43 #include "ad910x.h"
Kjansen45 0:3c9cc352dbfc 44
scabatan 1:b9d129e45c30 45 /*** Defines for UART Protocol ***/
scabatan 4:abab08222795 46 #define BAUD_RATE 115200
scabatan 1:b9d129e45c30 47
scabatan 1:b9d129e45c30 48 AD910x device( PA_15 );
scabatan 1:b9d129e45c30 49 DigitalOut en_cvddx( PG_7, 0 ); ///< DigitalOut instance for enable pin of on-board oscillator supply
scabatan 1:b9d129e45c30 50 DigitalOut shdn_n_lt3472( PG_9, 0 ); ///< DigitalOut instance for shutdown/enable pin of on-board amplifier supply
scabatan 1:b9d129e45c30 51
scabatan 1:b9d129e45c30 52 /* Configure and instantiate UART protocol and baud rate */
scabatan 1:b9d129e45c30 53 UnbufferedSerial pc( USBTX, USBRX, BAUD_RATE );
Kjansen45 0:3c9cc352dbfc 54
scabatan 1:b9d129e45c30 55 /*** Function Declarations ***/
scabatan 1:b9d129e45c30 56 void setup_device( void );
scabatan 1:b9d129e45c30 57 void print_title( void );
scabatan 1:b9d129e45c30 58 void print_prompt1( void );
scabatan 1:b9d129e45c30 59 void print_prompt2( void );
scabatan 1:b9d129e45c30 60 void print_menu( void );
scabatan 1:b9d129e45c30 61 void play_example1( void );
scabatan 1:b9d129e45c30 62 void play_example2( void );
scabatan 1:b9d129e45c30 63 void play_example3( void );
scabatan 1:b9d129e45c30 64 void play_example4( void );
scabatan 1:b9d129e45c30 65 void play_example5( void );
scabatan 1:b9d129e45c30 66 void play_example6( void );
scabatan 1:b9d129e45c30 67 void print_prompt3( void );
scabatan 1:b9d129e45c30 68 void stop_example( void );
scabatan 1:b9d129e45c30 69 void print_prompt4( void );
Kjansen45 0:3c9cc352dbfc 70
scabatan 1:b9d129e45c30 71 /*** Main Function ***/
Kjansen45 0:3c9cc352dbfc 72
Kjansen45 0:3c9cc352dbfc 73 int main()
Kjansen45 0:3c9cc352dbfc 74 {
scabatan 1:b9d129e45c30 75 char ext_clk = 'y';
scabatan 1:b9d129e45c30 76 char amp_out = 'n';
scabatan 1:b9d129e45c30 77 char stop = 'n';
scabatan 1:b9d129e45c30 78 char exit = 'n';
scabatan 1:b9d129e45c30 79 char example = 1;
scabatan 1:b9d129e45c30 80 uint8_t connected = 1;
scabatan 1:b9d129e45c30 81
scabatan 1:b9d129e45c30 82 device.resetb = 1;
scabatan 1:b9d129e45c30 83 device.triggerb = 1;
scabatan 1:b9d129e45c30 84 setup_device();
scabatan 1:b9d129e45c30 85
Kjansen45 0:3c9cc352dbfc 86 print_title();
scabatan 1:b9d129e45c30 87
scabatan 1:b9d129e45c30 88 while( connected == 1 ){
scabatan 1:b9d129e45c30 89 print_prompt1();
scabatan 6:b0e941764bb7 90 while( pc.readable() == 0 );
scabatan 1:b9d129e45c30 91 ext_clk = getchar();
scabatan 1:b9d129e45c30 92 if ( ext_clk == 'y' ){
scabatan 1:b9d129e45c30 93 en_cvddx = 0;
scabatan 1:b9d129e45c30 94 printf("Please connect external clock source to J10.\n");
scabatan 1:b9d129e45c30 95 } else {
scabatan 1:b9d129e45c30 96 en_cvddx = 1;
scabatan 1:b9d129e45c30 97 printf("On-board oscillator supply is enabled.\n");
scabatan 1:b9d129e45c30 98 }
scabatan 2:f20dbb194f12 99 thread_sleep_for(500);
scabatan 1:b9d129e45c30 100 print_prompt2();
scabatan 6:b0e941764bb7 101 while( pc.readable() == 0 );
scabatan 1:b9d129e45c30 102 amp_out = getchar();
scabatan 1:b9d129e45c30 103 if ( amp_out == 'y' ){
scabatan 1:b9d129e45c30 104 shdn_n_lt3472 = 1;
scabatan 1:b9d129e45c30 105 printf("On-board amplifier supply is enabled.\n");
scabatan 1:b9d129e45c30 106 } else {
scabatan 1:b9d129e45c30 107 shdn_n_lt3472 = 0;
scabatan 1:b9d129e45c30 108 }
scabatan 1:b9d129e45c30 109 print_menu();
scabatan 1:b9d129e45c30 110 example = getchar();
scabatan 6:b0e941764bb7 111 while( pc.readable() == 0 );
scabatan 1:b9d129e45c30 112 printf("%c\n", example);
scabatan 1:b9d129e45c30 113 switch (example) {
scabatan 1:b9d129e45c30 114 case '1':
scabatan 1:b9d129e45c30 115 play_example1();
scabatan 1:b9d129e45c30 116 break;
Kjansen45 0:3c9cc352dbfc 117
scabatan 1:b9d129e45c30 118 case '2':
scabatan 1:b9d129e45c30 119 play_example2();
scabatan 1:b9d129e45c30 120 break;
scabatan 1:b9d129e45c30 121
scabatan 1:b9d129e45c30 122 case '3':
scabatan 1:b9d129e45c30 123 play_example3();
Kjansen45 0:3c9cc352dbfc 124 break;
Kjansen45 0:3c9cc352dbfc 125
scabatan 1:b9d129e45c30 126 case '4':
scabatan 1:b9d129e45c30 127 play_example4();
Kjansen45 0:3c9cc352dbfc 128 break;
scabatan 1:b9d129e45c30 129
scabatan 1:b9d129e45c30 130 case '5':
scabatan 1:b9d129e45c30 131 play_example5();
scabatan 1:b9d129e45c30 132 break;
scabatan 1:b9d129e45c30 133
scabatan 1:b9d129e45c30 134 case '6':
scabatan 1:b9d129e45c30 135 play_example6();
scabatan 1:b9d129e45c30 136 break;
scabatan 1:b9d129e45c30 137
Kjansen45 0:3c9cc352dbfc 138 default:
scabatan 1:b9d129e45c30 139 printf("\n****Invalid Entry****\n\n");
Kjansen45 0:3c9cc352dbfc 140 break;
scabatan 1:b9d129e45c30 141 }
scabatan 1:b9d129e45c30 142 print_prompt3();
scabatan 6:b0e941764bb7 143 while( pc.readable() == 0 );
scabatan 1:b9d129e45c30 144 while ( !(stop == 'y') ){
scabatan 1:b9d129e45c30 145 stop = getchar();
scabatan 1:b9d129e45c30 146 }
scabatan 1:b9d129e45c30 147 stop_example();
scabatan 1:b9d129e45c30 148 print_prompt4();
scabatan 6:b0e941764bb7 149 while( pc.readable() == 0 );
scabatan 1:b9d129e45c30 150 exit = getchar();
scabatan 1:b9d129e45c30 151 if ( exit == 'y' ){
scabatan 1:b9d129e45c30 152 connected = 0;
scabatan 1:b9d129e45c30 153 printf("\nExiting program...\n");
scabatan 6:b0e941764bb7 154 }else{
scabatan 6:b0e941764bb7 155 stop = 'n';
scabatan 1:b9d129e45c30 156 }
scabatan 1:b9d129e45c30 157
scabatan 1:b9d129e45c30 158 }
scabatan 1:b9d129e45c30 159
scabatan 1:b9d129e45c30 160 return 0;
scabatan 1:b9d129e45c30 161
scabatan 1:b9d129e45c30 162 }
scabatan 1:b9d129e45c30 163
scabatan 1:b9d129e45c30 164 /*** Function Definitions ***/
Kjansen45 0:3c9cc352dbfc 165
scabatan 1:b9d129e45c30 166 /*Function to setup SPI communication*/
scabatan 1:b9d129e45c30 167 void setup_device()
scabatan 1:b9d129e45c30 168 {
scabatan 1:b9d129e45c30 169 device.spi_init( WORD_LEN, POL, FREQ );
scabatan 1:b9d129e45c30 170 device.AD910x_reg_reset();
scabatan 1:b9d129e45c30 171 }
scabatan 1:b9d129e45c30 172
scabatan 1:b9d129e45c30 173 /*Function to print the title block when program first starts*/
scabatan 1:b9d129e45c30 174 void print_title()
scabatan 1:b9d129e45c30 175 {
scabatan 1:b9d129e45c30 176 printf("\n***********************************************************************\n");
scabatan 2:f20dbb194f12 177 printf("* EVAL-%s Demonstration Program *\n", ACTIVE_DEVICE);
scabatan 1:b9d129e45c30 178 printf("* *\n");
scabatan 1:b9d129e45c30 179 printf("* This program demonstrates how to generate waveforms with the %s *\n", ACTIVE_DEVICE);
scabatan 1:b9d129e45c30 180 printf("* using example register configurations in the datasheet. *\n");
scabatan 3:7a4971eab899 181 printf("* This program is developed on Mbed OS version 6. *\n");
scabatan 1:b9d129e45c30 182 printf("***********************************************************************\n");
scabatan 1:b9d129e45c30 183 }
scabatan 1:b9d129e45c30 184
scabatan 1:b9d129e45c30 185 /*Function to print the first prompt/question to user to setup on-board oscillator supply*/
scabatan 1:b9d129e45c30 186 void print_prompt1()
scabatan 1:b9d129e45c30 187 {
scabatan 1:b9d129e45c30 188 printf( "\nUsing external clock source?\n" );
scabatan 1:b9d129e45c30 189 printf( "If yes, press y. If no, press any other key.\n" );
scabatan 1:b9d129e45c30 190 }
scabatan 1:b9d129e45c30 191
scabatan 1:b9d129e45c30 192 /*Function to print the next prompt/question to user to setup on-board amplifier supply*/
scabatan 1:b9d129e45c30 193 void print_prompt2()
scabatan 1:b9d129e45c30 194 {
scabatan 1:b9d129e45c30 195 printf( "\nConnected DAC outputs to on-board amplifiers?\n" );
scabatan 1:b9d129e45c30 196 printf( "If yes, press y. If no, press any other key.\n" );
Kjansen45 0:3c9cc352dbfc 197 }
Kjansen45 0:3c9cc352dbfc 198
scabatan 1:b9d129e45c30 199 /*Function to print summary of example AD910x configurations to play*/
scabatan 1:b9d129e45c30 200 void print_menu()
scabatan 1:b9d129e45c30 201 {
scabatan 1:b9d129e45c30 202 printf("\nExample Summary\n");
scabatan 1:b9d129e45c30 203 if ( ACTIVE_DEVICE == "AD9106" ){
scabatan 1:b9d129e45c30 204 printf(" 1 - 4 Gaussian Pulses with Different Start Delays and Digital Gain Settings\n");
scabatan 1:b9d129e45c30 205 printf(" 2 - 4 Pulses Generated from an SRAM Vector\n");
scabatan 1:b9d129e45c30 206 printf(" 3 - 4 Pulsed DDS-Generated Sine Waves with Different Start Delays and Digital Gain Settings\n");
scabatan 1:b9d129e45c30 207 printf(" 4 - Pulsed DDS-Generated Sine Wave and 3 Sawtooth Generator Waveforms\n");
scabatan 1:b9d129e45c30 208 printf(" 5 - Pulsed DDS-Generated Sine Waves Amplitude-Modulated by an SRAM Vector\n");
scabatan 1:b9d129e45c30 209 printf(" 6 - DDS-Generated Sine Wave and 3 Sawtooth Waveforms\n");
scabatan 1:b9d129e45c30 210 }else if( ACTIVE_DEVICE == "AD9102" ){
scabatan 1:b9d129e45c30 211 printf(" 1 - Gaussian Pulse\n");
scabatan 1:b9d129e45c30 212 printf(" 2 - Pulse Generated from an SRAM Vector\n");
scabatan 1:b9d129e45c30 213 printf(" 3 - Pulsed DDS-Generated Sine Wave\n");
scabatan 1:b9d129e45c30 214 printf(" 4 - Sawtooth Waveform\n");
scabatan 1:b9d129e45c30 215 printf(" 5 - Pulsed DDS-Generated Sine Wave Amplitude-Modulated by an SRAM Vector\n");
scabatan 1:b9d129e45c30 216 printf(" 6 - DDS-Generated Sine Wave\n");
scabatan 1:b9d129e45c30 217 }
scabatan 1:b9d129e45c30 218 printf("Select an option: ");
scabatan 1:b9d129e45c30 219 }
Kjansen45 0:3c9cc352dbfc 220
scabatan 1:b9d129e45c30 221 /*Function to play example 1*/
scabatan 1:b9d129e45c30 222 void play_example1()
Kjansen45 0:3c9cc352dbfc 223 {
scabatan 1:b9d129e45c30 224 if ( ACTIVE_DEVICE == "AD9106" ){
scabatan 1:b9d129e45c30 225 printf("\n4 Gaussian Pulses with Different Start Delays and Digital Gain Settings\n");
scabatan 1:b9d129e45c30 226 thread_sleep_for(500);
scabatan 1:b9d129e45c30 227 device.AD910x_update_sram( example1_RAM_gaussian );
scabatan 1:b9d129e45c30 228 device.AD910x_update_regs( AD9106_example1_regval );
scabatan 1:b9d129e45c30 229 }else if( ACTIVE_DEVICE == "AD9102" ){
scabatan 1:b9d129e45c30 230 printf("\nGaussian Pulse\n");
scabatan 1:b9d129e45c30 231 thread_sleep_for(500);
scabatan 1:b9d129e45c30 232 device.AD910x_update_sram( example1_RAM_gaussian );
scabatan 1:b9d129e45c30 233 device.AD910x_update_regs( AD9102_example1_regval );
scabatan 1:b9d129e45c30 234 }
scabatan 1:b9d129e45c30 235 device.AD910x_start_pattern();
scabatan 1:b9d129e45c30 236 }
scabatan 1:b9d129e45c30 237
scabatan 1:b9d129e45c30 238 /*Function to play example 2*/
scabatan 1:b9d129e45c30 239 void play_example2()
scabatan 1:b9d129e45c30 240 {
scabatan 1:b9d129e45c30 241 if ( ACTIVE_DEVICE == "AD9106" ){
scabatan 1:b9d129e45c30 242 printf("\n4 Pulses Generated from an SRAM Vector\n");
scabatan 1:b9d129e45c30 243 thread_sleep_for(500);
scabatan 1:b9d129e45c30 244 device.AD910x_update_sram( example2_4096_ramp );
scabatan 1:b9d129e45c30 245 device.AD910x_update_regs( AD9106_example2_regval );
scabatan 1:b9d129e45c30 246 }else if( ACTIVE_DEVICE == "AD9102" ){
scabatan 1:b9d129e45c30 247 printf("\nPulse Generated from an SRAM Vector\n");
scabatan 1:b9d129e45c30 248 thread_sleep_for(500);
scabatan 1:b9d129e45c30 249 device.AD910x_update_sram( example2_4096_ramp );
scabatan 1:b9d129e45c30 250 device.AD910x_update_regs( AD9102_example2_regval );
scabatan 1:b9d129e45c30 251 }
scabatan 1:b9d129e45c30 252 device.AD910x_start_pattern();
Kjansen45 0:3c9cc352dbfc 253 }
Kjansen45 0:3c9cc352dbfc 254
scabatan 1:b9d129e45c30 255 /*Function to play example 3*/
scabatan 1:b9d129e45c30 256 void play_example3()
scabatan 1:b9d129e45c30 257 {
scabatan 1:b9d129e45c30 258 if ( ACTIVE_DEVICE == "AD9106" ){
scabatan 1:b9d129e45c30 259 printf("\n4 Pulsed DDS-Generated Sine Waves with Different Start Delays and Digital Gain Settings\n");
scabatan 1:b9d129e45c30 260 thread_sleep_for(500);
scabatan 1:b9d129e45c30 261 device.AD910x_update_regs( AD9106_example3_regval );
scabatan 1:b9d129e45c30 262 }else if( ACTIVE_DEVICE == "AD9102" ){
scabatan 1:b9d129e45c30 263 printf("\nPulsed DDS-Generated Sine Wave\n");
scabatan 1:b9d129e45c30 264 thread_sleep_for(500);
scabatan 1:b9d129e45c30 265 device.AD910x_update_regs( AD9102_example3_regval );
scabatan 1:b9d129e45c30 266 }
scabatan 1:b9d129e45c30 267 device.AD910x_start_pattern();
scabatan 1:b9d129e45c30 268 }
scabatan 1:b9d129e45c30 269
scabatan 1:b9d129e45c30 270 /*Function to play example 4*/
scabatan 1:b9d129e45c30 271 void play_example4()
scabatan 1:b9d129e45c30 272 {
scabatan 1:b9d129e45c30 273 if ( ACTIVE_DEVICE == "AD9106" ){
scabatan 1:b9d129e45c30 274 printf("\nPulsed DDS-Generated Sine Wave and 3 Sawtooth Generator Waveforms\n");
scabatan 1:b9d129e45c30 275 thread_sleep_for(500);
scabatan 1:b9d129e45c30 276 device.AD910x_update_regs( AD9106_example4_regval );
scabatan 1:b9d129e45c30 277 }else if( ACTIVE_DEVICE == "AD9102" ){
scabatan 1:b9d129e45c30 278 printf("\nSawtooth Waveform\n");
scabatan 1:b9d129e45c30 279 thread_sleep_for(500);
scabatan 1:b9d129e45c30 280 device.AD910x_update_regs( AD9102_example4_regval );
scabatan 1:b9d129e45c30 281 }
scabatan 1:b9d129e45c30 282 device.AD910x_start_pattern();
Kjansen45 0:3c9cc352dbfc 283 }
Kjansen45 0:3c9cc352dbfc 284
scabatan 1:b9d129e45c30 285 /*Function to play example 5*/
scabatan 1:b9d129e45c30 286 void play_example5()
Kjansen45 0:3c9cc352dbfc 287 {
scabatan 1:b9d129e45c30 288 if ( ACTIVE_DEVICE == "AD9106" ){
scabatan 1:b9d129e45c30 289 printf("\n4 Pulses Generated from an SRAM Vector\n");
scabatan 1:b9d129e45c30 290 thread_sleep_for(500);
scabatan 1:b9d129e45c30 291 device.AD910x_update_sram( example5_RAM_gaussian );
scabatan 1:b9d129e45c30 292 device.AD910x_update_regs( AD9106_example5_regval );
scabatan 1:b9d129e45c30 293 }else if ( ACTIVE_DEVICE == "AD9102"){
scabatan 1:b9d129e45c30 294 printf("\nPulse Generated from an SRAM Vector\n");
scabatan 1:b9d129e45c30 295 thread_sleep_for(500);
scabatan 1:b9d129e45c30 296 device.AD910x_update_sram( example5_RAM_gaussian );
scabatan 1:b9d129e45c30 297 device.AD910x_update_regs( AD9102_example5_regval );
scabatan 1:b9d129e45c30 298 }
scabatan 1:b9d129e45c30 299 device.AD910x_start_pattern();
Kjansen45 0:3c9cc352dbfc 300 }
Kjansen45 0:3c9cc352dbfc 301
scabatan 1:b9d129e45c30 302 /*Function to play example 1*/
scabatan 1:b9d129e45c30 303 void play_example6()
scabatan 1:b9d129e45c30 304 {
scabatan 1:b9d129e45c30 305 if ( ACTIVE_DEVICE == "AD9106" ){
scabatan 1:b9d129e45c30 306 printf("\nDDS-Generated Sine Wave and 3 Sawtooth Waveforms\n");
scabatan 1:b9d129e45c30 307 thread_sleep_for(500);
scabatan 1:b9d129e45c30 308 device.AD910x_update_regs( AD9106_example6_regval );
scabatan 1:b9d129e45c30 309 }else if( ACTIVE_DEVICE == "AD9102" ){
scabatan 1:b9d129e45c30 310 printf("\nDDS-Generated Sine Wave\n");
scabatan 1:b9d129e45c30 311 thread_sleep_for(500);
scabatan 1:b9d129e45c30 312 device.AD910x_update_regs( AD9102_example6_regval );
scabatan 1:b9d129e45c30 313 }
scabatan 1:b9d129e45c30 314 device.AD910x_start_pattern();
scabatan 1:b9d129e45c30 315 }
scabatan 1:b9d129e45c30 316
scabatan 1:b9d129e45c30 317 /*Function to print prompt/question to user to stop pattern*/
scabatan 1:b9d129e45c30 318 void print_prompt3()
Kjansen45 0:3c9cc352dbfc 319 {
scabatan 1:b9d129e45c30 320 printf( "\nStop pattern?\n" );
scabatan 1:b9d129e45c30 321 printf( "If yes, press y.\n" );
Kjansen45 0:3c9cc352dbfc 322 }
scabatan 1:b9d129e45c30 323
scabatan 1:b9d129e45c30 324 /*Function to stop pattern generation*/
scabatan 1:b9d129e45c30 325 void stop_example()
scabatan 1:b9d129e45c30 326 {
scabatan 1:b9d129e45c30 327 device.AD910x_stop_pattern();
scabatan 1:b9d129e45c30 328 printf( "Pattern stopped.\n" );
scabatan 1:b9d129e45c30 329 }
scabatan 1:b9d129e45c30 330
scabatan 1:b9d129e45c30 331 /*Function to print prompt/question to user to exit program*/
scabatan 1:b9d129e45c30 332 void print_prompt4()
scabatan 1:b9d129e45c30 333 {
scabatan 1:b9d129e45c30 334 printf( "\nExit program?\n" );
scabatan 1:b9d129e45c30 335 printf( "If yes, press y.\n" );
scabatan 1:b9d129e45c30 336 }