Basic_sine_wave_generator
Dependencies: mbed 4DGL-uLCD-SE mbed-rtos AD5206
Diff: menu.cpp
- Revision:
- 11:d21c2da8b290
- Parent:
- 10:159f38636ed4
--- a/menu.cpp Tue Dec 01 18:59:42 2015 +0000 +++ b/menu.cpp Wed Dec 02 19:48:56 2015 +0000 @@ -1,6 +1,6 @@ /* * menu.cpp -* The menu is displayed first when the funtion generator starts +* Author: Hanjie Xie */ #include "mbed.h" @@ -143,13 +143,13 @@ } } -int para_setting() { +para para_setting() { mode_set(); freq_set(); amp_set(); - offset_set(); + //offset_set(); para_display(); - return 1; + return mypara; } void mode_set() { @@ -204,12 +204,12 @@ uLCD.printf("\n unit:\n"); */ int choose = 0; - int increment = 100; + float increment = 100; uLCD.locate(1,3); uLCD.printf("\nSet the frequency:\n"); while(choose == 0){ uLCD.locate(4,5); - uLCD.printf("\n%d \n", mypara.get_freq()); + uLCD.printf("\n%.0f \n", mypara.get_freq()); if(left_pb1 == 0){ choose = 1; uLCD.cls(); @@ -254,31 +254,7 @@ } } -void offset_set() { - int choose = 0; - uLCD.locate(4,3); - uLCD.printf("\nSet the offset:\n"); - float increment = 0.5; - while(choose == 0){ - uLCD.locate(4,5); - uLCD.printf("\n%.2f \n", mypara.get_offset()); - if(left_pb1 == 0){ - choose = 1; - uLCD.cls(); - } - if(fire_pb1 == 0){ - float temp = mypara.get_offset(); - temp += increment; - mypara.set_offset(temp); - } - if(right_pb1 == 0){ - float temp = mypara.get_offset(); - temp -= increment; - mypara.set_offset(temp); - } - wait(0.2); - } -} + void para_display() { uLCD.locate(4,3); @@ -287,6 +263,6 @@ uLCD.printf("\n 2.Frequency: %d\n", mypara.get_freq()); uLCD.locate(4,7); uLCD.printf("\n 3.Amplitude: %.2f\n", mypara.get_amp()); - uLCD.locate(4,9); - uLCD.printf("\n 4.Offset: %.2f\n", mypara.get_offset()); + //uLCD.locate(4,9); + //uLCD.printf("\n 4.Offset: %.2f\n", mypara.get_offset()); } \ No newline at end of file