Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
IoT
Open IoT SDK
examples
total-solutions
Commits
25f1aa88
Verified
Commit
25f1aa88
authored
May 24, 2022
by
Paul Szczepanek
Committed by
Vincent Coubard
May 25, 2022
Browse files
Fix blinking events clogging up the queue
Signed-off-by:
Vincent Coubard
<
vincent.coubard@arm.com
>
parent
33ed8d2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
kws/source/blink_task.c
View file @
25f1aa88
...
...
@@ -9,7 +9,7 @@
#include
"cmsis_os2.h"
#include
<stdbool.h>
#define BLINK_TIMER_PERIOD_MS 25
#define BLINK_TIMER_PERIOD_MS 25
0
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
"
);
}
}
...
...
kws/source/main_ns.c
View file @
25f1aa88
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment