Verified Commit 25f1aa88 authored by Paul Szczepanek's avatar Paul Szczepanek Committed by Vincent Coubard
Browse files

Fix blinking events clogging up the queue



Signed-off-by: Vincent Coubard's avatarVincent Coubard <vincent.coubard@arm.com>
parent 33ed8d2d
......@@ -9,7 +9,7 @@
#include "cmsis_os2.h"
#include <stdbool.h>
#define BLINK_TIMER_PERIOD_MS 25
#define BLINK_TIMER_PERIOD_MS 250
enum {
LED1 = 1 << 0,
......@@ -70,14 +70,14 @@ static void blink_timer_cb(void *arg)
(void)arg;
// Schedule blink of the led in the event queue
if (osMessageQueuePut(ui_msg_queue, (void *)&blink_event, 0, 0) != osOK) {
printf("Failed to send message to ui_msg_queue\r\n");
printf("Failed to send blink_event message to ui_msg_queue\r\n");
}
}
static void ml_change_handler(void *self, ml_processing_state_t new_state)
{
if (osMessageQueuePut(ui_msg_queue, (void *)&ml_state_change_event, 0, 0) != osOK) {
printf("Failed to send message to ui_msg_queue\r\n");
printf("Failed to send ml_state_change_event message to ui_msg_queue\r\n");
}
}
......
......@@ -86,14 +86,15 @@ void main_task(void *arg)
vUARTLockInit();
static const osThreadAttr_t thread_attr = {.priority = osPriorityNormal1, .stack_size = 8192};
osThreadId_t ml_thread = osThreadNew(ml_task, NULL, &thread_attr);
static const osThreadAttr_t ml_task_attr = {.priority = osPriorityNormal1, .stack_size = 8192};
osThreadId_t ml_thread = osThreadNew(ml_task, NULL, &ml_task_attr);
if (!ml_thread) {
printf("Failed to create ml thread\r\n");
return;
}
osThreadId_t blink_thread = osThreadNew(blink_task, NULL, NULL);
static const osThreadAttr_t blink_attr = {.priority = osPriorityHigh};
osThreadId_t blink_thread = osThreadNew(blink_task, NULL, &blink_attr);
if (!blink_thread) {
printf("Failed to create blink thread\r\n");
return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment