Make printf great again (#1438)

* Printf lib: wrap *printf* functions
* Printf lib, FW: drop sprintf. Dolphin: dump timestamp as is, wo asctime.
* FW: remove sniprintf, wrap assert functions
* Printf lib: wrap putc, puts, putchar
* Printf: a working but not thread-safe concept.
* Poorly wrap fflush
* stdglue: buffers
* Core: thread local buffers
* Core: move stdglue to thread api, add ability to get FuriThread instance of current thread.
* RPC tests: replace sprintf with snprintf
* Applications: use new stdout api
* Printf lib: wrap more printf-like and stdout functions
* Documentation
* Apps: snprintf size fixes

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
SG
2022-08-04 02:00:17 +10:00
committed by GitHub
parent eed4296890
commit bc34689ed6
22 changed files with 1484 additions and 175 deletions

View File

@@ -27,7 +27,7 @@ static void signal_received_callback(void* context, InfraredWorkerSignal* receiv
if(infrared_worker_signal_is_decoded(received_signal)) {
const InfraredMessage* message = infrared_worker_get_decoded_signal(received_signal);
buf_cnt = sniprintf(
buf_cnt = snprintf(
buf,
sizeof(buf),
"%s, A:0x%0*lX, C:0x%0*lX%s\r\n",
@@ -43,13 +43,13 @@ static void signal_received_callback(void* context, InfraredWorkerSignal* receiv
size_t timings_cnt;
infrared_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
buf_cnt = sniprintf(buf, sizeof(buf), "RAW, %d samples:\r\n", timings_cnt);
buf_cnt = snprintf(buf, sizeof(buf), "RAW, %d samples:\r\n", timings_cnt);
cli_write(cli, (uint8_t*)buf, buf_cnt);
for(size_t i = 0; i < timings_cnt; ++i) {
buf_cnt = sniprintf(buf, sizeof(buf), "%lu ", timings[i]);
buf_cnt = snprintf(buf, sizeof(buf), "%lu ", timings[i]);
cli_write(cli, (uint8_t*)buf, buf_cnt);
}
buf_cnt = sniprintf(buf, sizeof(buf), "\r\n");
buf_cnt = snprintf(buf, sizeof(buf), "\r\n");
cli_write(cli, (uint8_t*)buf, buf_cnt);
}
}