summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-08-03 18:49:33 +0100
committerGitHub <noreply@github.com>2021-08-03 18:49:33 +0100
commit34de7ca224d613e1ae19a45860e27c15d40254dd (patch)
tree3176aa05dd5175ae1a7a56b5b881fc89c1aa18ef /tmk_core
parent3f419dc872d3ab61d129c644e114f62fd738e9d6 (diff)
Move print/debug files to quantum (#12069)
* move print/debug files to quantum * Update comments
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common.mk13
-rw-r--r--tmk_core/common/debug.c25
-rw-r--r--tmk_core/common/debug.h169
-rw-r--r--tmk_core/common/lib_printf.mk9
-rw-r--r--tmk_core/common/nodebug.h26
-rw-r--r--tmk_core/common/print.h135
-rw-r--r--tmk_core/common/printf.c27
-rw-r--r--tmk_core/common/sendchar.h33
-rw-r--r--tmk_core/common/sendchar_null.c19
-rw-r--r--tmk_core/common/sendchar_uart.c23
10 files changed, 4 insertions, 475 deletions
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index 2f8f81126a..bd4142364c 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -8,22 +8,16 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
$(COMMON_DIR)/action_macro.c \
$(COMMON_DIR)/action_layer.c \
$(COMMON_DIR)/action_util.c \
- $(COMMON_DIR)/debug.c \
- $(COMMON_DIR)/sendchar_null.c \
$(COMMON_DIR)/eeconfig.c \
$(COMMON_DIR)/report.c \
+ $(COMMON_DIR)/sync_timer.c \
$(COMMON_DIR)/usb_util.c \
$(PLATFORM_COMMON_DIR)/suspend.c \
$(PLATFORM_COMMON_DIR)/timer.c \
- $(COMMON_DIR)/sync_timer.c \
$(PLATFORM_COMMON_DIR)/bootloader.c \
-# Use platform provided print - fall back to lib/printf
-ifneq ("$(wildcard $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk)","")
- include $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk
-else
- include $(TMK_PATH)/$(COMMON_DIR)/lib_printf.mk
-endif
+# Use platform provided print if it exists
+-include $(TMK_PATH)/$(PLATFORM_COMMON_DIR)/printf.mk
SHARED_EP_ENABLE = no
MOUSE_SHARED_EP ?= yes
@@ -55,6 +49,7 @@ endif
ifeq ($(strip $(CONSOLE_ENABLE)), yes)
TMK_COMMON_DEFS += -DCONSOLE_ENABLE
else
+ # TODO: decouple this so other print backends can exist
TMK_COMMON_DEFS += -DNO_PRINT
TMK_COMMON_DEFS += -DNO_DEBUG
endif
diff --git a/tmk_core/common/debug.c b/tmk_core/common/debug.c
deleted file mode 100644
index ea62deaa8c..0000000000
--- a/tmk_core/common/debug.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-Copyright 2011 Jun Wako <wakojun@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "debug.h"
-
-debug_config_t debug_config = {
- .enable = false, //
- .matrix = false, //
- .keyboard = false, //
- .mouse = false, //
- .reserved = 0 //
-};
diff --git a/tmk_core/common/debug.h b/tmk_core/common/debug.h
deleted file mode 100644
index 3d2e2315ef..0000000000
--- a/tmk_core/common/debug.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-Copyright 2011 Jun Wako <wakojun@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#pragma once
-
-#include <stdbool.h>
-#include "print.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Debug output control
- */
-typedef union {
- struct {
- bool enable : 1;
- bool matrix : 1;
- bool keyboard : 1;
- bool mouse : 1;
- uint8_t reserved : 4;
- };
- uint8_t raw;
-} debug_config_t;
-
-extern debug_config_t debug_config;
-
-#ifdef __cplusplus
-}
-#endif
-
-/* for backward compatibility */
-#define debug_enable (debug_config.enable)
-#define debug_matrix (debug_config.matrix)
-#define debug_keyboard (debug_config.keyboard)
-#define debug_mouse (debug_config.mouse)
-
-/*
- * Debug print utils
- */
-#ifndef NO_DEBUG
-
-# define dprint(s) \
- do { \
- if (debug_enable) print(s); \
- } while (0)
-# define dprintln(s) \
- do { \
- if (debug_enable) println(s); \
- } while (0)
-# define dprintf(fmt, ...) \
- do { \
- if (debug_enable) xprintf(fmt, ##__VA_ARGS__); \
- } while (0)
-# define dmsg(s) dprintf("%s at %s: %S\n", __FILE__, __LINE__, PSTR(s))
-
-/* Deprecated. DO NOT USE these anymore, use dprintf instead. */
-# define debug(s) \
- do { \
- if (debug_enable) print(s); \
- } while (0)
-# define debugln(s) \
- do { \
- if (debug_enable) println(s); \
- } while (0)
-# define debug_msg(s) \
- do { \
- if (debug_enable) { \
- print(__FILE__); \
- print(" at "); \
- print_dec(__LINE__); \
- print(" in "); \
- print(": "); \
- print(s); \
- } \
- } while (0)
-# define debug_dec(data) \
- do { \
- if (debug_enable) print_dec(data); \
- } while (0)
-# define debug_decs(data) \
- do { \
- if (debug_enable) print_decs(data); \
- } while (0)
-# define debug_hex4(data) \
- do { \
- if (debug_enable) print_hex4(data); \
- } while (0)
-# define debug_hex8(data) \
- do { \
- if (debug_enable) print_hex8(data); \
- } while (0)
-# define debug_hex16(data) \
- do { \
- if (debug_enable) print_hex16(data); \
- } while (0)
-# define debug_hex32(data) \
- do { \
- if (debug_enable) print_hex32(data); \
- } while (0)
-# define debug_bin8(data) \
- do { \
- if (debug_enable) print_bin8(data); \
- } while (0)
-# define debug_bin16(data) \
- do { \
- if (debug_enable) print_bin16(data); \
- } while (0)
-# define debug_bin32(data) \
- do { \
- if (debug_enable) print_bin32(data); \
- } while (0)
-# define debug_bin_reverse8(data) \
- do { \
- if (debug_enable) print_bin_reverse8(data); \
- } while (0)
-# define debug_bin_reverse16(data) \
- do { \
- if (debug_enable) print_bin_reverse16(data); \
- } while (0)
-# define debug_bin_reverse32(data) \
- do { \
- if (debug_enable) print_bin_reverse32(data); \
- } while (0)
-# define debug_hex(data) debug_hex8(data)
-# define debug_bin(data) debug_bin8(data)
-# define debug_bin_reverse(data) debug_bin8(data)
-
-#else /* NO_DEBUG */
-
-# define dprint(s)
-# define dprintln(s)
-# define dprintf(fmt, ...)
-# define dmsg(s)
-# define debug(s)
-# define debugln(s)
-# define debug_msg(s)
-# define debug_dec(data)
-# define debug_decs(data)
-# define debug_hex4(data)
-# define debug_hex8(data)
-# define debug_hex16(data)
-# define debug_hex32(data)
-# define debug_bin8(data)
-# define debug_bin16(data)
-# define debug_bin32(data)
-# define debug_bin_reverse8(data)
-# define debug_bin_reverse16(data)
-# define debug_bin_reverse32(data)
-# define debug_hex(data)
-# define debug_bin(data)
-# define debug_bin_reverse(data)
-
-#endif /* NO_DEBUG */
diff --git a/tmk_core/common/lib_printf.mk b/tmk_core/common/lib_printf.mk
deleted file mode 100644
index 10d2d8468d..0000000000
--- a/tmk_core/common/lib_printf.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-PRINTF_PATH = $(LIB_PATH)/printf
-
-TMK_COMMON_SRC += $(PRINTF_PATH)/printf.c
-TMK_COMMON_SRC += $(COMMON_DIR)/printf.c
-TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_FLOAT
-TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_EXPONENTIAL
-TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_LONG_LONG
-TMK_COMMON_DEFS += -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T
-VPATH += $(PRINTF_PATH)
diff --git a/tmk_core/common/nodebug.h b/tmk_core/common/nodebug.h
deleted file mode 100644
index 0b176684bd..0000000000
--- a/tmk_core/common/nodebug.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-Copyright 2013 Jun Wako <wakojun@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#pragma once
-
-#ifndef NO_DEBUG
-# define NO_DEBUG
-# include "debug.h"
-# undef NO_DEBUG
-#else
-# include "debug.h"
-#endif
diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h
deleted file mode 100644
index 8c055f549e..0000000000
--- a/tmk_core/common/print.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright 2012 Jun Wako <wakojun@gmail.com> */
-/* Very basic print functions, intended to be used with usb_debug_only.c
- * http://www.pjrc.com/teensy/
- * Copyright (c) 2008 PJRC.COM, LLC
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "util.h"
-#include "sendchar.h"
-#include "progmem.h"
-
-void print_set_sendchar(sendchar_func_t func);
-
-#ifndef NO_PRINT
-# if __has_include_next("_print.h")
-# include_next "_print.h" /* Include the platforms print.h */
-# else
-// Fall back to lib/printf
-# include "printf.h" // lib/printf/printf.h
-
-// Create user & normal print defines
-# define print(s) printf(s)
-# define println(s) printf(s "\r\n")
-# define xprintf printf
-# define uprint(s) printf(s)
-# define uprintln(s) printf(s "\r\n")
-# define uprintf printf
-
-# endif /* __has_include_next("_print.h") */
-#else /* NO_PRINT */
-# undef xprintf
-// Remove print defines
-# define print(s)
-# define println(s)
-# define xprintf(fmt, ...)
-# define uprintf(fmt, ...)
-# define uprint(s)
-# define uprintln(s)
-
-#endif /* NO_PRINT */
-
-#ifdef USER_PRINT
-// Remove normal print defines
-# undef print
-# undef println
-# undef xprintf
-# define print(s)
-# define println(s)
-# define xprintf(fmt, ...)
-#endif
-
-#define print_dec(i) xprintf("%u", i)
-#define print_decs(i) xprintf("%d", i)
-/* hex */
-#define print_hex4(i) xprintf("%X", i)
-#define print_hex8(i) xprintf("%02X", i)
-#define print_hex16(i) xprintf("%04X", i)
-#define print_hex32(i) xprintf("%08lX", i)
-/* binary */
-#define print_bin4(i) xprintf("%04b", i)
-#define print_bin8(i) xprintf("%08b", i)
-#define print_bin16(i) xprintf("%016b", i)
-#define print_bin32(i) xprintf("%032lb", i)
-#define print_bin_reverse8(i) xprintf("%08b", bitrev(i))
-#define print_bin_reverse16(i) xprintf("%016b", bitrev16(i))
-#define print_bin_reverse32(i) xprintf("%032lb", bitrev32(i))
-/* print value utility */
-#define print_val_dec(v) xprintf(#v ": %u\n", v)
-#define print_val_decs(v) xprintf(#v ": %d\n", v)
-#define print_val_hex8(v) xprintf(#v ": %X\n", v)
-#define print_val_hex16(v) xprintf(#v ": %02X\n", v)
-#define print_val_hex32(v) xprintf(#v ": %04lX\n", v)
-#define print_val_bin8(v) xprintf(#v ": %08b\n", v)
-#define print_val_bin16(v) xprintf(#v ": %016b\n", v)
-#define print_val_bin32(v) xprintf(#v ": %032lb\n", v)
-#define print_val_bin_reverse8(v) xprintf(#v ": %08b\n", bitrev(v))
-#define print_val_bin_reverse16(v) xprintf(#v ": %016b\n", bitrev16(v))
-#define print_val_bin_reverse32(v) xprintf(#v ": %032lb\n", bitrev32(v))
-
-// User print disables the normal print messages in the body of QMK/TMK code and
-// is meant as a lightweight alternative to NOPRINT. Use it when you only want to do
-// a spot of debugging but lack flash resources for allowing all of the codebase to
-// print (and store their wasteful strings).
-//
-// !!! DO NOT USE USER PRINT CALLS IN THE BODY OF QMK/TMK !!!
-
-/* decimal */
-#define uprint_dec(i) uprintf("%u", i)
-#define uprint_decs(i) uprintf("%d", i)
-/* hex */
-#define uprint_hex4(i) uprintf("%X", i)
-#define uprint_hex8(i) uprintf("%02X", i)
-#define uprint_hex16(i) uprintf("%04X", i)
-#define uprint_hex32(i) uprintf("%08lX", i)
-/* binary */
-#define uprint_bin4(i) uprintf("%04b", i)
-#define uprint_bin8(i) uprintf("%08b", i)
-#define uprint_bin16(i) uprintf("%016b", i)
-#define uprint_bin32(i) uprintf("%032lb", i)
-#define uprint_bin_reverse8(i) uprintf("%08b", bitrev(i))
-#define uprint_bin_reverse16(i) uprintf("%016b", bitrev16(i))
-#define uprint_bin_reverse32(i) uprintf("%032lb", bitrev32(i))
-/* print value utility */
-#define uprint_val_dec(v) uprintf(#v ": %u\n", v)
-#define uprint_val_decs(v) uprintf(#v ": %d\n", v)
-#define uprint_val_hex8(v) uprintf(#v ": %X\n", v)
-#define uprint_val_hex16(v) uprintf(#v ": %02X\n", v)
-#define uprint_val_hex32(v) uprintf(#v ": %04lX\n", v)
-#define uprint_val_bin8(v) uprintf(#v ": %08b\n", v)
-#define uprint_val_bin16(v) uprintf(#v ": %016b\n", v)
-#define uprint_val_bin32(v) uprintf(#v ": %032lb\n", v)
-#define uprint_val_bin_reverse8(v) uprintf(#v ": %08b\n", bitrev(v))
-#define uprint_val_bin_reverse16(v) uprintf(#v ": %016b\n", bitrev16(v))
-#define uprint_val_bin_reverse32(v) uprintf(#v ": %032lb\n", bitrev32(v))
diff --git a/tmk_core/common/printf.c b/tmk_core/common/printf.c
deleted file mode 100644
index e8440e55ee..0000000000
--- a/tmk_core/common/printf.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-Copyright 2011 Jun Wako <wakojun@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-#include <stddef.h>
-#include "sendchar.h"
-
-// bind lib/printf to console interface - sendchar
-
-static int8_t null_sendchar_func(uint8_t c) { return 0; }
-static sendchar_func_t func = null_sendchar_func;
-
-void print_set_sendchar(sendchar_func_t send) { func = send; }
-
-void _putchar(char character) { func(character); }
diff --git a/tmk_core/common/sendchar.h b/tmk_core/common/sendchar.h
deleted file mode 100644
index edcddaa6bb..0000000000
--- a/tmk_core/common/sendchar.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-Copyright 2011 Jun Wako <wakojun@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#pragma once
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef int8_t (*sendchar_func_t)(uint8_t c);
-
-/* transmit a character. return 0 on success, -1 on error. */
-int8_t sendchar(uint8_t c);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/tmk_core/common/sendchar_null.c b/tmk_core/common/sendchar_null.c
deleted file mode 100644
index fb67f70866..0000000000
--- a/tmk_core/common/sendchar_null.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-Copyright 2011 Jun Wako <wakojun@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "sendchar.h"
-
-__attribute__((weak)) int8_t sendchar(uint8_t c) { return 0; }
diff --git a/tmk_core/common/sendchar_uart.c b/tmk_core/common/sendchar_uart.c
deleted file mode 100644
index 2fc48bafff..0000000000
--- a/tmk_core/common/sendchar_uart.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-Copyright 2011 Jun Wako <wakojun@gmail.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "uart.h"
-#include "sendchar.h"
-
-int8_t sendchar(uint8_t c) {
- uart_putchar(c);
- return 0;
-}