Recognizes and processes commands
This commit is contained in:
+8
-3
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
char NULLCHAR = 0x0;
|
char NULLCHAR = 0x0;
|
||||||
QueueHandle_t MESSAGES = NULL;
|
QueueHandle_t MESSAGES = NULL;
|
||||||
|
bool LIGHT = false;
|
||||||
|
|
||||||
void vReadSerial(void* params) {
|
void vReadSerial(void* params) {
|
||||||
// Setup
|
// Setup
|
||||||
@@ -64,8 +64,13 @@ void vProcessMessages(void* params) {
|
|||||||
char* command = pvPortMalloc(BUFFER_SIZE * sizeof(char));
|
char* command = pvPortMalloc(BUFFER_SIZE * sizeof(char));
|
||||||
while(MESSAGES != NULL) {
|
while(MESSAGES != NULL) {
|
||||||
if (xQueueReceive(MESSAGES, command, 50)) {
|
if (xQueueReceive(MESSAGES, command, 50)) {
|
||||||
printf("Recieved message: ");
|
if (strcmp("blink", command)) {
|
||||||
printf("%s\n", command);
|
printf("Recieved message: ");
|
||||||
|
printf("%s\n", command);
|
||||||
|
} else {
|
||||||
|
LIGHT = !LIGHT;
|
||||||
|
gpio_put(PICO_DEFAULT_LED_PIN, LIGHT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user