Refactor platform logic within print.h (#11863)

* Remove GCC check from debug

* Remove platform logic from common.mk

* Refactor platform logic within print.h

* restore debug.c format

* headers

* Rename function pointer type

* review comments

* Update tmk_core/common/printf.c

Co-authored-by: Nick Brassel <nick@tzarc.org>

* Format

Co-authored-by: Nick Brassel <nick@tzarc.org>
master
Joel Challis 2021-02-14 01:44:22 +00:00 committed by GitHub
parent 72e515547a
commit 1f2fe2eab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 224 additions and 283 deletions

View File

@ -1,5 +1,3 @@
PRINTF_PATH = $(LIB_PATH)/printf
COMMON_DIR = common
PLATFORM_COMMON_DIR = $(COMMON_DIR)/$(PLATFORM_KEY)
@ -10,7 +8,6 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
$(COMMON_DIR)/action_macro.c \
$(COMMON_DIR)/action_layer.c \
$(COMMON_DIR)/action_util.c \
$(COMMON_DIR)/print.c \
$(COMMON_DIR)/debug.c \
$(COMMON_DIR)/sendchar_null.c \
$(COMMON_DIR)/eeconfig.c \
@ -20,17 +17,11 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
$(COMMON_DIR)/sync_timer.c \
$(PLATFORM_COMMON_DIR)/bootloader.c \
ifeq ($(PLATFORM),AVR)
TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/xprintf.S
else ifeq ($(PLATFORM),CHIBIOS)
TMK_COMMON_SRC += $(PRINTF_PATH)/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)
else ifeq ($(PLATFORM),ARM_ATSAM)
TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/printf.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
# Option modules

View File

@ -1,4 +1,4 @@
/* Copyright 2012,2013 Jun Wako <wakojun@gmail.com> */
/* 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
@ -21,27 +21,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include <stdint.h>
#include "print.h"
#include "arm_atsam/printf.h"
#ifndef NO_PRINT
# if defined(__AVR__)
# define sendchar(c) xputc(c)
void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) { xdev_out(sendchar_func); }
# elif defined(PROTOCOL_CHIBIOS) /* __AVR__ */
// don't need anything extra
# elif defined(__arm__) /* __AVR__ */
// TODO
// void print_set_sendchar(int8_t (*sendchar_func)(uint8_t)) { }
# endif /* __AVR__ */
#endif
// Create user & normal print defines
#define xprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__)
#define print(s) xprintf(s)
#define println(s) xprintf(s "\r\n")
#define uprint(s) print(s)
#define uprintln(s) println(s)
#define uprintf(fmt, ...) xprintf(fmt, ##__VA_ARGS__)

View File

@ -15,11 +15,13 @@ 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 "printf.h"
#include "sendchar.h"
#ifdef CONSOLE_ENABLE
# include "samd51j18a.h"
# include "arm_atsam_protocol.h"
# include "printf.h"
# include <string.h>
# include <stdarg.h>
@ -66,3 +68,5 @@ void console_printf(char *fmt, ...) {
}
#endif // CONSOLE_ENABLE
void print_set_sendchar(sendchar_func_t send) {}

View File

@ -0,0 +1 @@
TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/printf.c

View File

@ -0,0 +1,33 @@
/* 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 "avr/xprintf.h"
// Create user & normal print defines
#define print(s) xputs(PSTR(s))
#define println(s) xputs(PSTR(s "\r\n"))
#define uprint(s) print(s)
#define uprintln(s) println(s)
#define uprintf(fmt, ...) xprintf(fmt, ##__VA_ARGS__)

View File

@ -0,0 +1,20 @@
/*
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 "xprintf.h"
#include "sendchar.h"
void print_set_sendchar(sendchar_func_t func) { xdev_out(func); }

View File

@ -0,0 +1,2 @@
TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/xprintf.S
TMK_COMMON_SRC += $(PLATFORM_COMMON_DIR)/printf.c

View File

@ -1,24 +1,25 @@
#include <stdbool.h>
/*
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"
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
debug_config_t debug_config = {
/* GCC Bug 10676 - Using unnamed fields in initializers
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676 */
#if GCC_VERSION >= 40600
.enable = false,
.matrix = false,
.keyboard = false,
.mouse = false,
.reserved = 0
#else
{
false, // .enable
false, // .matrix
false, // .keyboard
false, // .mouse
0 // .reserved
}
#endif
.enable = false, //
.matrix = false, //
.keyboard = false, //
.mouse = false, //
.reserved = 0 //
};

View File

@ -229,6 +229,7 @@ void keyboard_setup(void) {
#ifndef NO_JTAG_DISABLE
disable_jtag();
#endif
print_set_sendchar(sendchar);
matrix_setup();
keyboard_pre_init_kb();
}

View File

@ -0,0 +1,9 @@
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)

View File

@ -27,104 +27,76 @@
#include <stdint.h>
#include <stdbool.h>
#include "util.h"
#include "sendchar.h"
#include "progmem.h"
#if defined(PROTOCOL_CHIBIOS) || defined(PROTOCOL_ARM_ATSAM)
# define PSTR(x) x
#endif
void print_set_sendchar(sendchar_func_t func);
#ifndef NO_PRINT
# if defined(__AVR__) /* __AVR__ */
# include "avr/xprintf.h"
# ifdef USER_PRINT /* USER_PRINT */
// Remove normal print defines
# define print(s)
# define println(s)
# undef xprintf
# define xprintf(fmt, ...)
// Create user print defines
# define uprint(s) xputs(PSTR(s))
# define uprintln(s) xputs(PSTR(s "\r\n"))
# define uprintf(fmt, ...) __xprintf(PSTR(fmt), ##__VA_ARGS__)
# else /* NORMAL PRINT */
// Create user & normal print defines
# define print(s) xputs(PSTR(s))
# define println(s) xputs(PSTR(s "\r\n"))
# define uprint(s) print(s)
# define uprintln(s) println(s)
# define uprintf(fmt, ...) xprintf(fmt, ##__VA_ARGS__)
# endif /* USER_PRINT / NORMAL PRINT */
# ifdef __cplusplus
extern "C"
# endif
/* function pointer of sendchar to be used by print utility */
void print_set_sendchar(int8_t (*print_sendchar_func)(uint8_t));
# elif defined(PROTOCOL_CHIBIOS) /* PROTOCOL_CHIBIOS */
# 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
# ifdef USER_PRINT /* USER_PRINT */
// Remove normal print defines
# define print(s)
# define println(s)
# define xprintf(fmt, ...)
// Create user print defines
# define uprint(s) printf(s)
# define uprintln(s) printf(s "\r\n")
# define uprintf printf
# else /* NORMAL PRINT */
// 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 /* USER_PRINT / NORMAL PRINT */
# elif defined(PROTOCOL_ARM_ATSAM) /* PROTOCOL_ARM_ATSAM */
# include "arm_atsam/printf.h"
# ifdef USER_PRINT /* USER_PRINT */
// Remove normal print defines
# define print(s)
# define println(s)
# define xprintf(fmt, ...)
// Create user print defines
# define uprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__)
# define uprint(s) xprintf(s)
# define uprintln(s) xprintf(s "\r\n")
# else /* NORMAL PRINT */
// Create user & normal print defines
# define xprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__)
# define print(s) xprintf(s)
# define println(s) xprintf(s "\r\n")
# define uprint(s) print(s)
# define uprintln(s) println(s)
# define uprintf(fmt, ...) xprintf(fmt, ##__VA_ARGS__)
# endif /* USER_PRINT / NORMAL PRINT */
# 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 /* __AVR__ / PROTOCOL_CHIBIOS / PROTOCOL_ARM_ATSAM */
#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
@ -132,129 +104,32 @@ extern "C"
// print (and store their wasteful strings).
//
// !!! DO NOT USE USER PRINT CALLS IN THE BODY OF QMK/TMK !!!
//
# ifdef USER_PRINT
// Disable normal print
# define print_dec(data)
# define print_decs(data)
# define print_hex4(data)
# define print_hex8(data)
# define print_hex16(data)
# define print_hex32(data)
# define print_bin4(data)
# define print_bin8(data)
# define print_bin16(data)
# define print_bin32(data)
# define print_bin_reverse8(data)
# define print_bin_reverse16(data)
# define print_bin_reverse32(data)
# define print_val_dec(v)
# define print_val_decs(v)
# define print_val_hex8(v)
# define print_val_hex16(v)
# define print_val_hex32(v)
# define print_val_bin8(v)
# define print_val_bin16(v)
# define print_val_bin32(v)
# define print_val_bin_reverse8(v)
# define print_val_bin_reverse16(v)
# define print_val_bin_reverse32(v)
# else /* NORMAL_PRINT */
// Enable normal print
/* decimal */
# 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))
# endif /* USER_PRINT / NORMAL_PRINT */
// User Print
/* decimal */
# define uprint_dec(i) uprintf("%u", i)
# define uprint_decs(i) uprintf("%d", i)
#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)
#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))
#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))
#else /* NO_PRINT */
# define xprintf(fmt, ...)
# define print(s)
# define println(s)
# define print_set_sendchar(func)
# define print_dec(data)
# define print_decs(data)
# define print_hex4(data)
# define print_hex8(data)
# define print_hex16(data)
# define print_hex32(data)
# define print_bin4(data)
# define print_bin8(data)
# define print_bin16(data)
# define print_bin32(data)
# define print_bin_reverse8(data)
# define print_bin_reverse16(data)
# define print_bin_reverse32(data)
# define print_val_dec(v)
# define print_val_decs(v)
# define print_val_hex8(v)
# define print_val_hex16(v)
# define print_val_hex32(v)
# define print_val_bin8(v)
# define print_val_bin16(v)
# define print_val_bin32(v)
# define print_val_bin_reverse8(v)
# define print_val_bin_reverse16(v)
# define print_val_bin_reverse32(v)
#endif /* NO_PRINT */
#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))

View File

@ -0,0 +1,27 @@
/*
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); }

View File

@ -4,6 +4,7 @@
# include <avr/pgmspace.h>
#else
# define PROGMEM
# define PSTR(x) x
# define PGM_P const char*
# define memcpy_P(dest, src, n) memcpy(dest, src, n)
# define pgm_read_byte(address_short) *((uint8_t*)(address_short))

View File

@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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);

View File

@ -953,15 +953,8 @@ void console_task(void) {
} while (size > 0);
}
#else /* CONSOLE_ENABLE */
int8_t sendchar(uint8_t c) {
(void)c;
return 0;
}
#endif /* CONSOLE_ENABLE */
void _putchar(char character) { sendchar(character); }
#ifdef RAW_ENABLE
void raw_hid_send(uint8_t *data, uint8_t length) {
// TODO: implement variable size packet

View File

@ -1025,7 +1025,6 @@ static void setup_usb(void) {
// for Console_Task
USB_Device_EnableSOFEvents();
print_set_sendchar(sendchar);
}
/** \brief Main

View File

@ -74,12 +74,7 @@ static void usb_remote_wakeup(void) {
*
* FIXME: Needs doc
*/
static void setup_usb(void) {
initForUsbConnectivity();
// for Console_Task
print_set_sendchar(sendchar);
}
static void setup_usb(void) { initForUsbConnectivity(); }
/** \brief Main
*