Testing 1 blue pill
Dependencies: mbed mbed-rtos TextLCD
Diff: main.cpp
- Revision:
- 25:9751619fa030
- Parent:
- 24:728de4bf961e
- Child:
- 26:83550fc299aa
--- a/main.cpp Mon Feb 18 12:02:34 2019 +0000 +++ b/main.cpp Mon Feb 18 22:04:54 2019 +0000 @@ -1,6 +1,5 @@ #include "SETUP.hpp" - //Thread signal functions void up_signal_rise(){up_thread.signal_set(1);} //Sets the up thread to operate void down_signal_rise(){down_thread.signal_set(1);} //Sets the down thread to operate @@ -17,20 +16,32 @@ while(1) { lcd.cls();//Clear the LCD screen - if(INTERFACE.Get_Function() == 0)//Turn + if(INTERFACE.Get_Function() == 0)//Anneal + { + lcd.printf("Mode: Anneal\n"); + if(INTERFACE.Get_Select() == 0 || INTERFACE.Get_Select() == 1) + { + lcd.printf("Loop:%d On_t:%d\n",INTERFACE.Get_Loop(),INTERFACE.Get_On_Time()); + } + else if(INTERFACE.Get_Select() == 2) + { + lcd.printf("Loop:%d Offt:%d\n",INTERFACE.Get_Loop(),INTERFACE.Get_Off_Time()); + } + } + else if(INTERFACE.Get_Function() == 1)//Test + { + lcd.printf("Mode: Test\n"); + lcd.printf("Duty: %dTime: %d\n",INTERFACE.Get_Duty_Cycle(),INTERFACE.Get_Power_Time()); + } + else if(INTERFACE.Get_Function() == 2)//Coil { lcd.printf("Mode: Turn\n"); lcd.printf("Done:%dToDo: %d\n",INTERFACE.Get_Turns_Done(),INTERFACE.Get_Turns_To_Do()); } - else if(INTERFACE.Get_Function() == 1)//Anneal + else if(INTERFACE.Get_Function() == 3)//Twist { - lcd.printf("Mode: Anneal\n"); - lcd.printf("Loop:%d Wait:%d\n",INTERFACE.Get_Loop(),INTERFACE.Get_Wait_Time()); - - }else if(INTERFACE.Get_Function() == 2)//Test - { - lcd.printf("Mode: Test\n"); - lcd.printf("Duty: %dTime: %d\n",INTERFACE.Get_Duty_Cycle(),INTERFACE.Get_Power_Time()); + lcd.printf("Mode: Turn\n"); + lcd.printf("Done:%dToDo: %d\n",INTERFACE.Get_Turns_Done(),INTERFACE.Get_Turns_To_Do()); } Thread::wait(250);//Refresh rate for Lcd } @@ -47,9 +58,18 @@ { while(1) { + /* Thread::signal_wait(1); //Wait to be signaled by the up button interrupt Thread::wait(Debounce_Time); //Button debounce to prevent multiple re-runs Thread::signal_wait(2); //Wait to be signaled by the up button interrupt + + */ + Thread::signal_wait(1); //Wait to be signaled by the up button interrupt + Thread::wait(Debounce_Time); //Button debounce to prevent multiple re-runs + if(INTERFACE.Get_Function() == 0 || INTERFACE.Get_Function() == 1) + { + Thread::signal_wait(2); //Wait to be signaled by the up button interrupt + } up_thread.signal_set(0); //Set the thread signal low to wait for the interrupt before reaccuring pc.printf("Up Button Pressed\n");//Output data to the putty terminal INTERFACE.Up(); //Run the interface up routine