Furi (#24)
* furiac start and thread create implementation" * create and kill task * rename debug, add header * remove write.c * kill itself * furi exit/switch * success switch and exit * WIP furi records * add furi record interface * rename furi app control file * record implementation in progress * wip furi implementation * add automatic tests for FURI AC * differ build tests * small changes * FURI record tests description * change furi statuses * FURI record test blank * exit after all application ends * delay: print then wait * fix FURI implementatnion building * pipe record test * concurrent access * uncomplete mute-test * update FURI documentation
This commit is contained in:
31
core/debug.c
Normal file
31
core/debug.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#define _GNU_SOURCE
|
||||
#include "main.h"
|
||||
#include <stdio.h>
|
||||
|
||||
extern UART_HandleTypeDef DEBUG_UART;
|
||||
|
||||
ssize_t uart_write(void* cookie, const char * buffer, size_t size) {
|
||||
if (buffer == 0) {
|
||||
/*
|
||||
* This means that we should flush internal buffers. Since we
|
||||
* don't we just return. (Remember, "handle" == -1 means that all
|
||||
* handles should be flushed.)
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (ssize_t)HAL_UART_Transmit(&DEBUG_UART, (uint8_t*)buffer, (uint16_t)size, HAL_MAX_DELAY);
|
||||
}
|
||||
|
||||
FILE* get_debug() {
|
||||
FILE* fp = fopencookie(NULL, "w+", (cookie_io_functions_t){
|
||||
.read = NULL,
|
||||
.write = uart_write,
|
||||
.seek = NULL,
|
||||
.close = NULL
|
||||
});
|
||||
|
||||
setvbuf(fp, NULL, _IONBF, 0);
|
||||
|
||||
return fp;
|
||||
}
|
||||
Reference in New Issue
Block a user