fork of what I have been writing
Diff: ES_CW2_Starter_STARFISH/SerialCommunication.h
- Revision:
- 13:f6e37c21d31d
- Parent:
- 11:038d3ba0d720
--- a/ES_CW2_Starter_STARFISH/SerialCommunication.h Mon Mar 09 15:02:47 2020 +0000 +++ b/ES_CW2_Starter_STARFISH/SerialCommunication.h Mon Mar 09 17:19:39 2020 +0000 @@ -4,9 +4,6 @@ RawSerial pc(USBTX, USBRX); char command_category; Mail<uint8_t, 8> inCharQ; -float NewRotation; -float NewSpeed; -uint64_t NewKey; // Serial port methods @@ -25,18 +22,19 @@ { case 'R': // Rotation command - R-?\d{1,s4}(\.\d)? - Rotation_mutex.lock(); + NewMotorCommand_mutex.lock(); sscanf(serial_buffer.c_str(), "%c %f", &command_category, &NewRotation); pc.printf("You have a new rotation: %f \r\n", NewRotation); - Rotation_mutex.unlock(); + NewMotorCommand_mutex.unlock(); break; case 'V': // Speed command - V\d{1,3}(\.\d)? - Speed_mutex.lock(); + NewMotorCommand_mutex.lock(); sscanf(serial_buffer.c_str(), "%c %f", &command_category, &NewSpeed); pc.printf("You have a new speed: %f \r\n", NewSpeed); - Speed_mutex.unlock(); + NewSpeed_flag = true; + NewMotorCommand_mutex.unlock(); // to implement ! break; @@ -54,7 +52,7 @@ pc.printf("You have entered a new melody: --> TO IMPLEMENT <--- \r\n"); Music_mutex.unlock(); // to implement ! - + default: printf("Input value out of format - please try again! \r\n"); }