![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
First Commit
Dependencies: mbed Crypto_light mbed-rtos
Spin it 2 win it
Diff: main.cpp
- Revision:
- 6:44c53574bf84
- Parent:
- 5:fe9b21ba2e33
- Child:
- 7:0d6632fba8d4
--- a/main.cpp Mon Mar 12 14:54:18 2018 +0000 +++ b/main.cpp Mon Mar 12 15:00:13 2018 +0000 @@ -24,7 +24,7 @@ #define MSG_NONCE_OK 1 #define MSG_OVERFLOW 2 //FIFO constant definitions -#define MAX_ARRAY_SIZE 256 //check the variable fifo position if this is changed +#define MAX_ARRAY_SIZE 19 //Max length of input codes //Mapping from sequential drive states to motor phase outputs @@ -106,12 +106,6 @@ osEvent newEvent = inCharQ.get(); uint8_t newChar = (uint8_t)newEvent.value.p; - //------error for overflow-------------------------// - if(bufferPosition >= MAX_ARRAY_SIZE - 1){ - exit = true; - putMessage(MSG_OVERFLOW, bufferPosition); // - } - //-------------------------------------------------// @@ -138,10 +132,20 @@ bufferPosition ++; } + //------error for overflow-------------------------// + if(bufferPosition >= MAX_ARRAY_SIZE ){ + exit = true; + putMessage(MSG_OVERFLOW, bufferPosition); // + } + //-------------------------------------------------// + }//end of : while(!exit){} //iii. Test the first character to determine which command was sent. //iv. Decode the rest of the command + + + }