diff --git a/epicardium/modules/serial.c b/epicardium/modules/serial.c index bbf8c015902cfca4db0d184b304f67d4b1beb0e5..6be231d6538ecd436708ce024b74b6ce8ea2188f 100644 --- a/epicardium/modules/serial.c +++ b/epicardium/modules/serial.c @@ -127,11 +127,18 @@ static void write_str_(const char *str, size_t length) } /* - * API-call to write a string. Output goes to both CDCACM, UART and BLE + * API-call to write a string. Output goes to CDCACM, UART and BLE + * + * This is user data from core 1. */ void epic_uart_write_str(const char *str, size_t length) { - ble_uart_write((uint8_t *)str, length); + /* Make sure that we are not in an interrupt when talking to BLE. + * Should not be the case if this is called from core 1 + * anyways. */ + if (!xPortIsInsideInterrupt()) { + ble_uart_write((uint8_t *)str, length); + } write_str_(str, length); } @@ -202,7 +209,6 @@ static void serial_flush_from_thread(void) taskEXIT_CRITICAL(); cdcacm_write((uint8_t *)&rx_data, received_bytes); - //ble_uart_write((uint8_t *)&rx_data, received_bytes); } while (received_bytes > 0); } @@ -250,7 +256,9 @@ int epic_uart_read_str(char *buf, size_t cnt) } /* - * Write a string. Output goes to both CDCACM and UART + * Write a string from epicardium. Output goes to CDCACM and UART + * + * This mainly log data from epicardium, not user date from core 1. */ long _write_epicardium(int fd, const char *buf, size_t cnt) {