1
0
Fork 0

[MERGE] Implement multiple logging backends (22159)

This commit is contained in:
Drashna Jael're 2024-02-16 10:41:44 -08:00
parent 1648a63812
commit cbb8b0de36
Signed by: drashna
GPG key ID: DBA1FD3A860D1B11
18 changed files with 111 additions and 35 deletions

View file

@ -39,10 +39,6 @@ endif
ifeq ($(strip $(CONSOLE_ENABLE)), yes)
OPT_DEFS += -DCONSOLE_ENABLE
else
# TODO: decouple this so other print backends can exist
OPT_DEFS += -DNO_PRINT
OPT_DEFS += -DNO_DEBUG
endif
ifeq ($(strip $(NKRO_ENABLE)), yes)

View file

@ -30,7 +30,6 @@
#include "usb_device_state.h"
#include "mousekey.h"
#include "led.h"
#include "sendchar.h"
#include "debug.h"
#include "print.h"

View file

@ -504,7 +504,7 @@ void send_digitizer(report_digitizer_t *report) {
#ifdef CONSOLE_ENABLE
int8_t sendchar(uint8_t c) {
int8_t console_write(uint8_t c) {
return (int8_t)send_report_buffered(USB_ENDPOINT_IN_CONSOLE, &c, sizeof(uint8_t));
}

View file

@ -53,7 +53,7 @@ void usb_event_queue_task(void);
#ifdef CONSOLE_ENABLE
/* Putchar over the USB console */
int8_t sendchar(uint8_t c);
int8_t console_write(uint8_t c);
#endif /* CONSOLE_ENABLE */

View file

@ -42,7 +42,6 @@
#include "keyboard.h"
#include "action.h"
#include "led.h"
#include "sendchar.h"
#include "debug.h"
#ifdef SLEEP_LED_ENABLE
# include "sleep_led.h"
@ -204,7 +203,7 @@ static void console_flush_task(void) {
while (Endpoint_IsReadWriteAllowed())
Endpoint_Write_8(0);
// flush sendchar packet
// flush console packet
if (Endpoint_IsINReady()) {
Endpoint_ClearIN();
}
@ -582,7 +581,7 @@ void send_digitizer(report_digitizer_t *report) {
}
/*******************************************************************************
* sendchar
* CONSOLE
******************************************************************************/
#ifdef CONSOLE_ENABLE
# define SEND_TIMEOUT 5
@ -590,13 +589,13 @@ void send_digitizer(report_digitizer_t *report) {
*
* FIXME: Needs doc
*/
int8_t sendchar(uint8_t c) {
int8_t console_write(uint8_t c) {
// Do not wait if the previous write has timed_out.
// Because sendchar() is called so many times, waiting each call causes big lag.
// Because console_write() is called so many times, waiting each call causes big lag.
// The `timed_out` state is an approximation of the ideal `is_listener_disconnected?` state.
static bool timed_out = false;
// prevents console_flush_task() from running during sendchar() runs.
// prevents console_flush_task() from running during console_write() runs.
// or char will be lost. These two function is mutually exclusive.
CONSOLE_FLUSH_SET(false);

View file

@ -25,7 +25,6 @@
#include "debug.h"
#include "suspend.h"
#include "wait.h"
#include "sendchar.h"
#ifdef SLEEP_LED_ENABLE
# include "sleep_led.h"

View file

@ -179,7 +179,7 @@ void raw_hid_task(void) {
# define CONSOLE_BUFFER_SIZE 32
# define CONSOLE_EPSIZE 8
int8_t sendchar(uint8_t c) {
int8_t console_write(uint8_t c) {
rbuf_enqueue(c);
return 0;
}