Skip to content
Snippets Groups Projects
Commit 88bc3ea3 authored by swym's avatar swym
Browse files

Merge branch 'rahix/fix-serial' into 'master'

Perform serial prints in a critical section

See merge request card10/firmware!240
parents 61599d4d 32681478
No related branches found
No related tags found
1 merge request!240Perform serial prints in a critical section
Pipeline #3348 passed with warnings
...@@ -27,7 +27,21 @@ static QueueHandle_t read_queue; ...@@ -27,7 +27,21 @@ static QueueHandle_t read_queue;
*/ */
void epic_uart_write_str(const char *str, intptr_t length) void epic_uart_write_str(const char *str, intptr_t length)
{ {
uint32_t basepri = __get_BASEPRI();
if (xPortIsInsideInterrupt()) {
taskENTER_CRITICAL_FROM_ISR();
} else {
taskENTER_CRITICAL();
}
UART_Write(ConsoleUart, (uint8_t *)str, length); UART_Write(ConsoleUart, (uint8_t *)str, length);
if (xPortIsInsideInterrupt()) {
taskEXIT_CRITICAL_FROM_ISR(basepri);
} else {
taskEXIT_CRITICAL();
}
cdcacm_write((uint8_t *)str, length); cdcacm_write((uint8_t *)str, length);
ble_uart_write((uint8_t *)str, length); ble_uart_write((uint8_t *)str, length);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment