![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Testing 1 blue pill
Dependencies: mbed mbed-rtos TextLCD
Diff: main.cpp
- Revision:
- 28:3193157ebb0c
- Parent:
- 27:22d6fd88828e
- Child:
- 29:f3b1387c81f1
diff -r 22d6fd88828e -r 3193157ebb0c main.cpp --- a/main.cpp Fri Mar 01 21:57:59 2019 +0000 +++ b/main.cpp Mon Mar 11 14:19:26 2019 +0000 @@ -113,24 +113,25 @@ Thread::wait(Debounce_Time); //Button debounce to prevent multiple re-runs this debouce time might need to be longer 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 + pc.printf("System running value is: %d\n",INTERFACE.Get_System_Running()); + if(INTERFACE.Get_System_Running() == 0) + { + INTERFACE.Up(); //Run the interface up routine + } } } void down_thread_function() //Action if the down button is pressed decrement { while(1) { - /* - Thread::signal_wait(1); //Wait to be signaled by the down button interrupt - Thread::wait(Debounce_Time); //Button debounce to prevent multiple re-runs - Thread::signal_wait(2); //Wait to be signaled by the down button interrupt - - */ Thread::signal_wait(1); //Wait to be signaled by the down button interrupt Thread::wait(Debounce_Time); //Button debounce to prevent multiple re-runsn this debounce time might need to be longer down_thread.signal_set(0);//Set the thread signal low to wait for the interrupt before reaccuring pc.printf("Down Button Pressed\n");//Output data to the putty terminal - INTERFACE.Down();//Run the interface down routine + if(INTERFACE.Get_System_Running() == 0) + { + INTERFACE.Down();//Run the interface down routine + } } } void start_stop_thread_function() //Action if the Start/Stop button is pressed @@ -142,7 +143,6 @@ start_stop_thread.signal_set(0);//Set the thread signal low to wait for the interrupt before reaccuring pc.printf("S/S Button Pressed\n");//Output data to the putty terminal INTERFACE.Start_Stop();//Run the interface start / stop routine - //Thread::wait(1000);//Button debounce to prevent multiple re-runs } } void Function_Selection_thread_function()//Action if the Function button is pressed @@ -153,8 +153,10 @@ Thread::wait(Debounce_Time); //Button debounce to prevent multiple re-runsn this debounce time might need to be longer function_thread.signal_set(0);//Set the thread signal low to wait for the interrupt before reaccuring pc.printf("Function Button Pressed\n");//Output data to the putty terminal - INTERFACE.Function();//Run the interface function routine - //Thread::wait(2000);//Button debounce to prevent multiple re-runs + if(INTERFACE.Get_System_Running() == 0) + { + INTERFACE.Function();//Run the interface function routine + } } } void Selection_thread_function()//Action if the Select button is pressed @@ -165,15 +167,14 @@ Thread::wait(Debounce_Time); //Button debounce to prevent multiple re-runsn this debounce time might need to be longer select_thread.signal_set(0);//Set the thread signal low to wait for the interrupt before reaccuring pc.printf("Select Button Pressed\n");//Output data to the putty terminal - INTERFACE.Select();//Run the interface selection routine - //Thread::wait(1000);//Button debounce to prevent multiple re-runs + if(INTERFACE.Get_System_Running() == 0) + { + INTERFACE.Select();//Run the interface selection routine + } } } int main() -{ - //Interrupt setters - - +{ lcd.printf("Ready Player\n"); lcd.printf(" One \n"); Thread::wait(1000);