Sunshine Grace Cabatan
/
EVAL-AD910x
Example program for EVAL-AD9106 and EVAL-AD9102
main.cpp@7:2ff94dbecc75, 2021-03-30 (annotated)
- Committer:
- scabatan
- Date:
- Tue Mar 30 11:31:59 2021 +0000
- Revision:
- 7:2ff94dbecc75
- Parent:
- 6:b0e941764bb7
- Child:
- 8:51792457e0da
removed copyright text
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
scabatan | 7:2ff94dbecc75 | 1 | /* |
scabatan | 1:b9d129e45c30 | 2 | <Insert license number here.> |
Kjansen45 | 0:3c9cc352dbfc | 3 | */ |
Kjansen45 | 0:3c9cc352dbfc | 4 | |
scabatan | 1:b9d129e45c30 | 5 | /*** Libraries ***/ |
scabatan | 1:b9d129e45c30 | 6 | #include "mbed.h" |
scabatan | 1:b9d129e45c30 | 7 | #include "platform/mbed_thread.h" |
scabatan | 1:b9d129e45c30 | 8 | #include "config.h" |
scabatan | 1:b9d129e45c30 | 9 | #include "ad910x.h" |
Kjansen45 | 0:3c9cc352dbfc | 10 | |
scabatan | 1:b9d129e45c30 | 11 | /*** Defines for UART Protocol ***/ |
scabatan | 4:abab08222795 | 12 | #define BAUD_RATE 115200 |
scabatan | 1:b9d129e45c30 | 13 | |
scabatan | 1:b9d129e45c30 | 14 | AD910x device( PA_15 ); |
scabatan | 1:b9d129e45c30 | 15 | DigitalOut en_cvddx( PG_7, 0 ); ///< DigitalOut instance for enable pin of on-board oscillator supply |
scabatan | 1:b9d129e45c30 | 16 | DigitalOut shdn_n_lt3472( PG_9, 0 ); ///< DigitalOut instance for shutdown/enable pin of on-board amplifier supply |
scabatan | 1:b9d129e45c30 | 17 | |
scabatan | 1:b9d129e45c30 | 18 | /* Configure and instantiate UART protocol and baud rate */ |
scabatan | 1:b9d129e45c30 | 19 | UnbufferedSerial pc( USBTX, USBRX, BAUD_RATE ); |
Kjansen45 | 0:3c9cc352dbfc | 20 | |
scabatan | 1:b9d129e45c30 | 21 | /*** Function Declarations ***/ |
scabatan | 1:b9d129e45c30 | 22 | void setup_device( void ); |
scabatan | 1:b9d129e45c30 | 23 | void print_title( void ); |
scabatan | 1:b9d129e45c30 | 24 | void print_prompt1( void ); |
scabatan | 1:b9d129e45c30 | 25 | void print_prompt2( void ); |
scabatan | 1:b9d129e45c30 | 26 | void print_menu( void ); |
scabatan | 1:b9d129e45c30 | 27 | void play_example1( void ); |
scabatan | 1:b9d129e45c30 | 28 | void play_example2( void ); |
scabatan | 1:b9d129e45c30 | 29 | void play_example3( void ); |
scabatan | 1:b9d129e45c30 | 30 | void play_example4( void ); |
scabatan | 1:b9d129e45c30 | 31 | void play_example5( void ); |
scabatan | 1:b9d129e45c30 | 32 | void play_example6( void ); |
scabatan | 1:b9d129e45c30 | 33 | void print_prompt3( void ); |
scabatan | 1:b9d129e45c30 | 34 | void stop_example( void ); |
scabatan | 1:b9d129e45c30 | 35 | void print_prompt4( void ); |
Kjansen45 | 0:3c9cc352dbfc | 36 | |
scabatan | 1:b9d129e45c30 | 37 | /*** Main Function ***/ |
Kjansen45 | 0:3c9cc352dbfc | 38 | |
Kjansen45 | 0:3c9cc352dbfc | 39 | int main() |
Kjansen45 | 0:3c9cc352dbfc | 40 | { |
scabatan | 1:b9d129e45c30 | 41 | char ext_clk = 'y'; |
scabatan | 1:b9d129e45c30 | 42 | char amp_out = 'n'; |
scabatan | 1:b9d129e45c30 | 43 | char stop = 'n'; |
scabatan | 1:b9d129e45c30 | 44 | char exit = 'n'; |
scabatan | 1:b9d129e45c30 | 45 | char example = 1; |
scabatan | 1:b9d129e45c30 | 46 | uint8_t connected = 1; |
scabatan | 1:b9d129e45c30 | 47 | |
scabatan | 1:b9d129e45c30 | 48 | device.resetb = 1; |
scabatan | 1:b9d129e45c30 | 49 | device.triggerb = 1; |
scabatan | 1:b9d129e45c30 | 50 | setup_device(); |
scabatan | 1:b9d129e45c30 | 51 | |
Kjansen45 | 0:3c9cc352dbfc | 52 | print_title(); |
scabatan | 1:b9d129e45c30 | 53 | |
scabatan | 1:b9d129e45c30 | 54 | while( connected == 1 ){ |
scabatan | 1:b9d129e45c30 | 55 | print_prompt1(); |
scabatan | 6:b0e941764bb7 | 56 | while( pc.readable() == 0 ); |
scabatan | 1:b9d129e45c30 | 57 | ext_clk = getchar(); |
scabatan | 1:b9d129e45c30 | 58 | if ( ext_clk == 'y' ){ |
scabatan | 1:b9d129e45c30 | 59 | en_cvddx = 0; |
scabatan | 1:b9d129e45c30 | 60 | printf("Please connect external clock source to J10.\n"); |
scabatan | 1:b9d129e45c30 | 61 | } else { |
scabatan | 1:b9d129e45c30 | 62 | en_cvddx = 1; |
scabatan | 1:b9d129e45c30 | 63 | printf("On-board oscillator supply is enabled.\n"); |
scabatan | 1:b9d129e45c30 | 64 | } |
scabatan | 2:f20dbb194f12 | 65 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 66 | print_prompt2(); |
scabatan | 6:b0e941764bb7 | 67 | while( pc.readable() == 0 ); |
scabatan | 1:b9d129e45c30 | 68 | amp_out = getchar(); |
scabatan | 1:b9d129e45c30 | 69 | if ( amp_out == 'y' ){ |
scabatan | 1:b9d129e45c30 | 70 | shdn_n_lt3472 = 1; |
scabatan | 1:b9d129e45c30 | 71 | printf("On-board amplifier supply is enabled.\n"); |
scabatan | 1:b9d129e45c30 | 72 | } else { |
scabatan | 1:b9d129e45c30 | 73 | shdn_n_lt3472 = 0; |
scabatan | 1:b9d129e45c30 | 74 | } |
scabatan | 1:b9d129e45c30 | 75 | print_menu(); |
scabatan | 1:b9d129e45c30 | 76 | example = getchar(); |
scabatan | 6:b0e941764bb7 | 77 | while( pc.readable() == 0 ); |
scabatan | 1:b9d129e45c30 | 78 | printf("%c\n", example); |
scabatan | 1:b9d129e45c30 | 79 | switch (example) { |
scabatan | 1:b9d129e45c30 | 80 | case '1': |
scabatan | 1:b9d129e45c30 | 81 | play_example1(); |
scabatan | 1:b9d129e45c30 | 82 | break; |
Kjansen45 | 0:3c9cc352dbfc | 83 | |
scabatan | 1:b9d129e45c30 | 84 | case '2': |
scabatan | 1:b9d129e45c30 | 85 | play_example2(); |
scabatan | 1:b9d129e45c30 | 86 | break; |
scabatan | 1:b9d129e45c30 | 87 | |
scabatan | 1:b9d129e45c30 | 88 | case '3': |
scabatan | 1:b9d129e45c30 | 89 | play_example3(); |
Kjansen45 | 0:3c9cc352dbfc | 90 | break; |
Kjansen45 | 0:3c9cc352dbfc | 91 | |
scabatan | 1:b9d129e45c30 | 92 | case '4': |
scabatan | 1:b9d129e45c30 | 93 | play_example4(); |
Kjansen45 | 0:3c9cc352dbfc | 94 | break; |
scabatan | 1:b9d129e45c30 | 95 | |
scabatan | 1:b9d129e45c30 | 96 | case '5': |
scabatan | 1:b9d129e45c30 | 97 | play_example5(); |
scabatan | 1:b9d129e45c30 | 98 | break; |
scabatan | 1:b9d129e45c30 | 99 | |
scabatan | 1:b9d129e45c30 | 100 | case '6': |
scabatan | 1:b9d129e45c30 | 101 | play_example6(); |
scabatan | 1:b9d129e45c30 | 102 | break; |
scabatan | 1:b9d129e45c30 | 103 | |
Kjansen45 | 0:3c9cc352dbfc | 104 | default: |
scabatan | 1:b9d129e45c30 | 105 | printf("\n****Invalid Entry****\n\n"); |
Kjansen45 | 0:3c9cc352dbfc | 106 | break; |
scabatan | 1:b9d129e45c30 | 107 | } |
scabatan | 1:b9d129e45c30 | 108 | print_prompt3(); |
scabatan | 6:b0e941764bb7 | 109 | while( pc.readable() == 0 ); |
scabatan | 1:b9d129e45c30 | 110 | while ( !(stop == 'y') ){ |
scabatan | 1:b9d129e45c30 | 111 | stop = getchar(); |
scabatan | 1:b9d129e45c30 | 112 | } |
scabatan | 1:b9d129e45c30 | 113 | stop_example(); |
scabatan | 1:b9d129e45c30 | 114 | print_prompt4(); |
scabatan | 6:b0e941764bb7 | 115 | while( pc.readable() == 0 ); |
scabatan | 1:b9d129e45c30 | 116 | exit = getchar(); |
scabatan | 1:b9d129e45c30 | 117 | if ( exit == 'y' ){ |
scabatan | 1:b9d129e45c30 | 118 | connected = 0; |
scabatan | 1:b9d129e45c30 | 119 | printf("\nExiting program...\n"); |
scabatan | 6:b0e941764bb7 | 120 | }else{ |
scabatan | 6:b0e941764bb7 | 121 | stop = 'n'; |
scabatan | 1:b9d129e45c30 | 122 | } |
scabatan | 1:b9d129e45c30 | 123 | |
scabatan | 1:b9d129e45c30 | 124 | } |
scabatan | 1:b9d129e45c30 | 125 | |
scabatan | 1:b9d129e45c30 | 126 | return 0; |
scabatan | 1:b9d129e45c30 | 127 | |
scabatan | 1:b9d129e45c30 | 128 | } |
scabatan | 1:b9d129e45c30 | 129 | |
scabatan | 1:b9d129e45c30 | 130 | /*** Function Definitions ***/ |
Kjansen45 | 0:3c9cc352dbfc | 131 | |
scabatan | 1:b9d129e45c30 | 132 | /*Function to setup SPI communication*/ |
scabatan | 1:b9d129e45c30 | 133 | void setup_device() |
scabatan | 1:b9d129e45c30 | 134 | { |
scabatan | 1:b9d129e45c30 | 135 | device.spi_init( WORD_LEN, POL, FREQ ); |
scabatan | 1:b9d129e45c30 | 136 | device.AD910x_reg_reset(); |
scabatan | 1:b9d129e45c30 | 137 | } |
scabatan | 1:b9d129e45c30 | 138 | |
scabatan | 1:b9d129e45c30 | 139 | /*Function to print the title block when program first starts*/ |
scabatan | 1:b9d129e45c30 | 140 | void print_title() |
scabatan | 1:b9d129e45c30 | 141 | { |
scabatan | 1:b9d129e45c30 | 142 | printf("\n***********************************************************************\n"); |
scabatan | 2:f20dbb194f12 | 143 | printf("* EVAL-%s Demonstration Program *\n", ACTIVE_DEVICE); |
scabatan | 1:b9d129e45c30 | 144 | printf("* *\n"); |
scabatan | 1:b9d129e45c30 | 145 | printf("* This program demonstrates how to generate waveforms with the %s *\n", ACTIVE_DEVICE); |
scabatan | 1:b9d129e45c30 | 146 | printf("* using example register configurations in the datasheet. *\n"); |
scabatan | 3:7a4971eab899 | 147 | printf("* This program is developed on Mbed OS version 6. *\n"); |
scabatan | 1:b9d129e45c30 | 148 | printf("***********************************************************************\n"); |
scabatan | 1:b9d129e45c30 | 149 | } |
scabatan | 1:b9d129e45c30 | 150 | |
scabatan | 1:b9d129e45c30 | 151 | /*Function to print the first prompt/question to user to setup on-board oscillator supply*/ |
scabatan | 1:b9d129e45c30 | 152 | void print_prompt1() |
scabatan | 1:b9d129e45c30 | 153 | { |
scabatan | 1:b9d129e45c30 | 154 | printf( "\nUsing external clock source?\n" ); |
scabatan | 1:b9d129e45c30 | 155 | printf( "If yes, press y. If no, press any other key.\n" ); |
scabatan | 1:b9d129e45c30 | 156 | } |
scabatan | 1:b9d129e45c30 | 157 | |
scabatan | 1:b9d129e45c30 | 158 | /*Function to print the next prompt/question to user to setup on-board amplifier supply*/ |
scabatan | 1:b9d129e45c30 | 159 | void print_prompt2() |
scabatan | 1:b9d129e45c30 | 160 | { |
scabatan | 1:b9d129e45c30 | 161 | printf( "\nConnected DAC outputs to on-board amplifiers?\n" ); |
scabatan | 1:b9d129e45c30 | 162 | printf( "If yes, press y. If no, press any other key.\n" ); |
Kjansen45 | 0:3c9cc352dbfc | 163 | } |
Kjansen45 | 0:3c9cc352dbfc | 164 | |
scabatan | 1:b9d129e45c30 | 165 | /*Function to print summary of example AD910x configurations to play*/ |
scabatan | 1:b9d129e45c30 | 166 | void print_menu() |
scabatan | 1:b9d129e45c30 | 167 | { |
scabatan | 1:b9d129e45c30 | 168 | printf("\nExample Summary\n"); |
scabatan | 1:b9d129e45c30 | 169 | if ( ACTIVE_DEVICE == "AD9106" ){ |
scabatan | 1:b9d129e45c30 | 170 | printf(" 1 - 4 Gaussian Pulses with Different Start Delays and Digital Gain Settings\n"); |
scabatan | 1:b9d129e45c30 | 171 | printf(" 2 - 4 Pulses Generated from an SRAM Vector\n"); |
scabatan | 1:b9d129e45c30 | 172 | printf(" 3 - 4 Pulsed DDS-Generated Sine Waves with Different Start Delays and Digital Gain Settings\n"); |
scabatan | 1:b9d129e45c30 | 173 | printf(" 4 - Pulsed DDS-Generated Sine Wave and 3 Sawtooth Generator Waveforms\n"); |
scabatan | 1:b9d129e45c30 | 174 | printf(" 5 - Pulsed DDS-Generated Sine Waves Amplitude-Modulated by an SRAM Vector\n"); |
scabatan | 1:b9d129e45c30 | 175 | printf(" 6 - DDS-Generated Sine Wave and 3 Sawtooth Waveforms\n"); |
scabatan | 1:b9d129e45c30 | 176 | }else if( ACTIVE_DEVICE == "AD9102" ){ |
scabatan | 1:b9d129e45c30 | 177 | printf(" 1 - Gaussian Pulse\n"); |
scabatan | 1:b9d129e45c30 | 178 | printf(" 2 - Pulse Generated from an SRAM Vector\n"); |
scabatan | 1:b9d129e45c30 | 179 | printf(" 3 - Pulsed DDS-Generated Sine Wave\n"); |
scabatan | 1:b9d129e45c30 | 180 | printf(" 4 - Sawtooth Waveform\n"); |
scabatan | 1:b9d129e45c30 | 181 | printf(" 5 - Pulsed DDS-Generated Sine Wave Amplitude-Modulated by an SRAM Vector\n"); |
scabatan | 1:b9d129e45c30 | 182 | printf(" 6 - DDS-Generated Sine Wave\n"); |
scabatan | 1:b9d129e45c30 | 183 | } |
scabatan | 1:b9d129e45c30 | 184 | printf("Select an option: "); |
scabatan | 1:b9d129e45c30 | 185 | } |
Kjansen45 | 0:3c9cc352dbfc | 186 | |
scabatan | 1:b9d129e45c30 | 187 | /*Function to play example 1*/ |
scabatan | 1:b9d129e45c30 | 188 | void play_example1() |
Kjansen45 | 0:3c9cc352dbfc | 189 | { |
scabatan | 1:b9d129e45c30 | 190 | if ( ACTIVE_DEVICE == "AD9106" ){ |
scabatan | 1:b9d129e45c30 | 191 | printf("\n4 Gaussian Pulses with Different Start Delays and Digital Gain Settings\n"); |
scabatan | 1:b9d129e45c30 | 192 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 193 | device.AD910x_update_sram( example1_RAM_gaussian ); |
scabatan | 1:b9d129e45c30 | 194 | device.AD910x_update_regs( AD9106_example1_regval ); |
scabatan | 1:b9d129e45c30 | 195 | }else if( ACTIVE_DEVICE == "AD9102" ){ |
scabatan | 1:b9d129e45c30 | 196 | printf("\nGaussian Pulse\n"); |
scabatan | 1:b9d129e45c30 | 197 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 198 | device.AD910x_update_sram( example1_RAM_gaussian ); |
scabatan | 1:b9d129e45c30 | 199 | device.AD910x_update_regs( AD9102_example1_regval ); |
scabatan | 1:b9d129e45c30 | 200 | } |
scabatan | 1:b9d129e45c30 | 201 | device.AD910x_start_pattern(); |
scabatan | 1:b9d129e45c30 | 202 | } |
scabatan | 1:b9d129e45c30 | 203 | |
scabatan | 1:b9d129e45c30 | 204 | /*Function to play example 2*/ |
scabatan | 1:b9d129e45c30 | 205 | void play_example2() |
scabatan | 1:b9d129e45c30 | 206 | { |
scabatan | 1:b9d129e45c30 | 207 | if ( ACTIVE_DEVICE == "AD9106" ){ |
scabatan | 1:b9d129e45c30 | 208 | printf("\n4 Pulses Generated from an SRAM Vector\n"); |
scabatan | 1:b9d129e45c30 | 209 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 210 | device.AD910x_update_sram( example2_4096_ramp ); |
scabatan | 1:b9d129e45c30 | 211 | device.AD910x_update_regs( AD9106_example2_regval ); |
scabatan | 1:b9d129e45c30 | 212 | }else if( ACTIVE_DEVICE == "AD9102" ){ |
scabatan | 1:b9d129e45c30 | 213 | printf("\nPulse Generated from an SRAM Vector\n"); |
scabatan | 1:b9d129e45c30 | 214 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 215 | device.AD910x_update_sram( example2_4096_ramp ); |
scabatan | 1:b9d129e45c30 | 216 | device.AD910x_update_regs( AD9102_example2_regval ); |
scabatan | 1:b9d129e45c30 | 217 | } |
scabatan | 1:b9d129e45c30 | 218 | device.AD910x_start_pattern(); |
Kjansen45 | 0:3c9cc352dbfc | 219 | } |
Kjansen45 | 0:3c9cc352dbfc | 220 | |
scabatan | 1:b9d129e45c30 | 221 | /*Function to play example 3*/ |
scabatan | 1:b9d129e45c30 | 222 | void play_example3() |
scabatan | 1:b9d129e45c30 | 223 | { |
scabatan | 1:b9d129e45c30 | 224 | if ( ACTIVE_DEVICE == "AD9106" ){ |
scabatan | 1:b9d129e45c30 | 225 | printf("\n4 Pulsed DDS-Generated Sine Waves with Different Start Delays and Digital Gain Settings\n"); |
scabatan | 1:b9d129e45c30 | 226 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 227 | device.AD910x_update_regs( AD9106_example3_regval ); |
scabatan | 1:b9d129e45c30 | 228 | }else if( ACTIVE_DEVICE == "AD9102" ){ |
scabatan | 1:b9d129e45c30 | 229 | printf("\nPulsed DDS-Generated Sine Wave\n"); |
scabatan | 1:b9d129e45c30 | 230 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 231 | device.AD910x_update_regs( AD9102_example3_regval ); |
scabatan | 1:b9d129e45c30 | 232 | } |
scabatan | 1:b9d129e45c30 | 233 | device.AD910x_start_pattern(); |
scabatan | 1:b9d129e45c30 | 234 | } |
scabatan | 1:b9d129e45c30 | 235 | |
scabatan | 1:b9d129e45c30 | 236 | /*Function to play example 4*/ |
scabatan | 1:b9d129e45c30 | 237 | void play_example4() |
scabatan | 1:b9d129e45c30 | 238 | { |
scabatan | 1:b9d129e45c30 | 239 | if ( ACTIVE_DEVICE == "AD9106" ){ |
scabatan | 1:b9d129e45c30 | 240 | printf("\nPulsed DDS-Generated Sine Wave and 3 Sawtooth Generator Waveforms\n"); |
scabatan | 1:b9d129e45c30 | 241 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 242 | device.AD910x_update_regs( AD9106_example4_regval ); |
scabatan | 1:b9d129e45c30 | 243 | }else if( ACTIVE_DEVICE == "AD9102" ){ |
scabatan | 1:b9d129e45c30 | 244 | printf("\nSawtooth Waveform\n"); |
scabatan | 1:b9d129e45c30 | 245 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 246 | device.AD910x_update_regs( AD9102_example4_regval ); |
scabatan | 1:b9d129e45c30 | 247 | } |
scabatan | 1:b9d129e45c30 | 248 | device.AD910x_start_pattern(); |
Kjansen45 | 0:3c9cc352dbfc | 249 | } |
Kjansen45 | 0:3c9cc352dbfc | 250 | |
scabatan | 1:b9d129e45c30 | 251 | /*Function to play example 5*/ |
scabatan | 1:b9d129e45c30 | 252 | void play_example5() |
Kjansen45 | 0:3c9cc352dbfc | 253 | { |
scabatan | 1:b9d129e45c30 | 254 | if ( ACTIVE_DEVICE == "AD9106" ){ |
scabatan | 1:b9d129e45c30 | 255 | printf("\n4 Pulses Generated from an SRAM Vector\n"); |
scabatan | 1:b9d129e45c30 | 256 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 257 | device.AD910x_update_sram( example5_RAM_gaussian ); |
scabatan | 1:b9d129e45c30 | 258 | device.AD910x_update_regs( AD9106_example5_regval ); |
scabatan | 1:b9d129e45c30 | 259 | }else if ( ACTIVE_DEVICE == "AD9102"){ |
scabatan | 1:b9d129e45c30 | 260 | printf("\nPulse Generated from an SRAM Vector\n"); |
scabatan | 1:b9d129e45c30 | 261 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 262 | device.AD910x_update_sram( example5_RAM_gaussian ); |
scabatan | 1:b9d129e45c30 | 263 | device.AD910x_update_regs( AD9102_example5_regval ); |
scabatan | 1:b9d129e45c30 | 264 | } |
scabatan | 1:b9d129e45c30 | 265 | device.AD910x_start_pattern(); |
Kjansen45 | 0:3c9cc352dbfc | 266 | } |
Kjansen45 | 0:3c9cc352dbfc | 267 | |
scabatan | 1:b9d129e45c30 | 268 | /*Function to play example 1*/ |
scabatan | 1:b9d129e45c30 | 269 | void play_example6() |
scabatan | 1:b9d129e45c30 | 270 | { |
scabatan | 1:b9d129e45c30 | 271 | if ( ACTIVE_DEVICE == "AD9106" ){ |
scabatan | 1:b9d129e45c30 | 272 | printf("\nDDS-Generated Sine Wave and 3 Sawtooth Waveforms\n"); |
scabatan | 1:b9d129e45c30 | 273 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 274 | device.AD910x_update_regs( AD9106_example6_regval ); |
scabatan | 1:b9d129e45c30 | 275 | }else if( ACTIVE_DEVICE == "AD9102" ){ |
scabatan | 1:b9d129e45c30 | 276 | printf("\nDDS-Generated Sine Wave\n"); |
scabatan | 1:b9d129e45c30 | 277 | thread_sleep_for(500); |
scabatan | 1:b9d129e45c30 | 278 | device.AD910x_update_regs( AD9102_example6_regval ); |
scabatan | 1:b9d129e45c30 | 279 | } |
scabatan | 1:b9d129e45c30 | 280 | device.AD910x_start_pattern(); |
scabatan | 1:b9d129e45c30 | 281 | } |
scabatan | 1:b9d129e45c30 | 282 | |
scabatan | 1:b9d129e45c30 | 283 | /*Function to print prompt/question to user to stop pattern*/ |
scabatan | 1:b9d129e45c30 | 284 | void print_prompt3() |
Kjansen45 | 0:3c9cc352dbfc | 285 | { |
scabatan | 1:b9d129e45c30 | 286 | printf( "\nStop pattern?\n" ); |
scabatan | 1:b9d129e45c30 | 287 | printf( "If yes, press y.\n" ); |
Kjansen45 | 0:3c9cc352dbfc | 288 | } |
scabatan | 1:b9d129e45c30 | 289 | |
scabatan | 1:b9d129e45c30 | 290 | /*Function to stop pattern generation*/ |
scabatan | 1:b9d129e45c30 | 291 | void stop_example() |
scabatan | 1:b9d129e45c30 | 292 | { |
scabatan | 1:b9d129e45c30 | 293 | device.AD910x_stop_pattern(); |
scabatan | 1:b9d129e45c30 | 294 | printf( "Pattern stopped.\n" ); |
scabatan | 1:b9d129e45c30 | 295 | } |
scabatan | 1:b9d129e45c30 | 296 | |
scabatan | 1:b9d129e45c30 | 297 | /*Function to print prompt/question to user to exit program*/ |
scabatan | 1:b9d129e45c30 | 298 | void print_prompt4() |
scabatan | 1:b9d129e45c30 | 299 | { |
scabatan | 1:b9d129e45c30 | 300 | printf( "\nExit program?\n" ); |
scabatan | 1:b9d129e45c30 | 301 | printf( "If yes, press y.\n" ); |
scabatan | 1:b9d129e45c30 | 302 | } |