2020-08-26 18:32:22 +00:00
|
|
|
#include "furi.h"
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
extern UART_HandleTypeDef DEBUG_UART;
|
|
|
|
|
2020-09-01 10:34:23 +00:00
|
|
|
void handle_uart_write(const void* data, size_t size, void* ctx) {
|
2020-08-26 18:32:22 +00:00
|
|
|
HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)data, (uint16_t)size, HAL_MAX_DELAY);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool register_tty_uart() {
|
|
|
|
if(!furi_create("tty", NULL, 0)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-09-01 10:34:23 +00:00
|
|
|
if(furi_open("tty", false, false, handle_uart_write, NULL, NULL) == NULL) {
|
2020-08-26 18:32:22 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|