[MERGE] Implement multiple logging backends (22159)
This commit is contained in:
parent
1648a63812
commit
cbb8b0de36
18 changed files with 111 additions and 35 deletions
|
@ -192,7 +192,7 @@ void set_activity_timestamps(uint32_t matrix_timestamp, uint32_t encoder_timesta
|
|||
last_input_modification_time = MAX(matrix_timestamp, MAX(encoder_timestamp, pointing_device_timestamp));
|
||||
}
|
||||
|
||||
// Only enable this if console is enabled to print to
|
||||
// Only enable this if logging is enabled to print to
|
||||
#if defined(DEBUG_MATRIX_SCAN_RATE)
|
||||
static uint32_t matrix_timer = 0;
|
||||
static uint32_t matrix_scan_count = 0;
|
||||
|
@ -203,9 +203,7 @@ void matrix_scan_perf_task(void) {
|
|||
|
||||
uint32_t timer_now = timer_read32();
|
||||
if (TIMER_DIFF_32(timer_now, matrix_timer) >= 1000) {
|
||||
# if defined(CONSOLE_ENABLE)
|
||||
dprintf("matrix scan frequency: %lu\n", matrix_scan_count);
|
||||
# endif
|
||||
last_matrix_scan_count = matrix_scan_count;
|
||||
matrix_timer = timer_now;
|
||||
matrix_scan_count = 0;
|
||||
|
|
8
quantum/logging/sendchar_console.c
Normal file
8
quantum/logging/sendchar_console.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
// Copyright 2023 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#include "sendchar.h"
|
||||
int8_t console_write(uint8_t c);
|
||||
|
||||
int8_t sendchar(uint8_t c) {
|
||||
return console_write(c);
|
||||
}
|
19
quantum/logging/sendchar_uart.c
Normal file
19
quantum/logging/sendchar_uart.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2023 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#include "sendchar.h"
|
||||
#include "uart.h"
|
||||
|
||||
#ifndef SENDCHAR_BAUD_RATE
|
||||
# define SENDCHAR_BAUD_RATE 9600
|
||||
#endif
|
||||
|
||||
int8_t sendchar(uint8_t c) {
|
||||
static bool s_init = false;
|
||||
if (!s_init) {
|
||||
uart_init(SENDCHAR_BAUD_RATE);
|
||||
s_init = true;
|
||||
}
|
||||
|
||||
uart_write(c);
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue