tty_uart.c 405 B

1234567891011121314151617181920
  1. #include "furi.h"
  2. #include "main.h"
  3. extern UART_HandleTypeDef DEBUG_UART;
  4. void handle_uart_write(const void* data, size_t size) {
  5. HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)data, (uint16_t)size, HAL_MAX_DELAY);
  6. }
  7. bool register_tty_uart() {
  8. if(!furi_create("tty", NULL, 0)) {
  9. return false;
  10. }
  11. if(furi_open("tty", false, false, handle_uart_write, NULL) == NULL) {
  12. return false;
  13. }
  14. return true;
  15. }