UART write example (#53)
* Rename test functions * rewrite furi API, segfault * make fixes in FURI, log through FURI * add uart write example blank * implement fuprintf instead of fopencookie * add gif, blank page * UART write example description Co-authored-by: Vadim Kaushan <admin@disasm.info>
This commit is contained in:
20
core/tty_uart.c
Normal file
20
core/tty_uart.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include "furi.h"
|
||||
#include "main.h"
|
||||
|
||||
extern UART_HandleTypeDef DEBUG_UART;
|
||||
|
||||
void handle_uart_write(const void* data, size_t size) {
|
||||
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;
|
||||
}
|
||||
|
||||
if(furi_open("tty", false, false, handle_uart_write, NULL) == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user