Lidar
Dependencies: TS_DISCO_F746NG mbed BufferedSerial LCD_DISCO_F746NG mbed-rtos Trigo BSP_DISCO_F746NG
Revision 4:0df95765b1b0, committed 2016-11-24
- Comitter:
- Carminio
- Date:
- Thu Nov 24 11:50:42 2016 +0000
- Parent:
- 3:43ab856b5efa
- Child:
- 5:734551a9f4e7
- Commit message:
- Ver. con thread che gestisce lo stop del lidar
Changed in this revision
Main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed-rtos.lib | Show annotated file Show diff for this revision Revisions of this file |
--- a/Main.cpp Thu Nov 24 09:50:36 2016 +0000 +++ b/Main.cpp Thu Nov 24 11:50:42 2016 +0000 @@ -1,4 +1,5 @@ #include "mbed.h" +#include "rtos.h" #include "Serial.h" #include "BufferedSerial.h" #include "Communication.h" @@ -10,8 +11,7 @@ //Dichiarazione oggetti -//DigitalIn myStartButton(USER_BUTTON); -InterruptIn myStopButton(USER_BUTTON); +DigitalIn myStopButton(USER_BUTTON); Motor lid_Motor(PWM_OUT); Communication SendCommands; LCD_DISCO_F746NG lcd; @@ -22,15 +22,23 @@ uint8_t idx; uint8_t start=1; -void pressed() -{ - SendCommands.Stop(); - wait_ms(100); - lid_Motor.StopMotor_Scan(); +void button_thread(void const *args) { + while(true) { + if (myStopButton == 1) { + SendCommands.Stop(); + wait_ms(10); + lid_Motor.StopMotor_Scan(); + wait_ms(10); + SendCommands.Reset(); + } + } } int main() { +// Threads start here + Thread button_th(button_thread); + // Initialize Display lcd.Clear(LCD_COLOR_BLACK); lcd.SetBackColor(LCD_COLOR_BLACK); @@ -86,28 +94,7 @@ } } } - - //while(1) { -// if (myStartButton == 1) { -// SendCommands.Stop(); -// wait_ms(100); -// lid_Motor.StopMotor_Scan(); -// } -// } - - //while(1) { -// myStopButton.rise(&pressed); -// } - - //while(1) { -// // Initialize TFT display -// ts.GetState(&TS_State); -// if (TS_State.touchDetected) { -// SendCommands.Stop(); -// wait_ms(100); -// lid_Motor.StopMotor_Scan(); -// } -// } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Thu Nov 24 11:50:42 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e