From be9be90483ce083490c11b1ae4695ec5149bc783 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Mon, 7 Sep 2015 21:33:06 +0100 Subject: [PATCH] Modularity and gcc warnings fixes. --- tmk_core/common.mk | 2 +- tmk_core/common/action_tapping.c | 2 +- tmk_core/common/bootmagic.c | 2 +- tmk_core/common/command.c | 15 ++++++++++++--- tmk_core/common/keymap.c | 6 ++++++ tmk_core/common/progmem.h | 4 ++-- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/tmk_core/common.mk b/tmk_core/common.mk index cb030b33..f5a464d0 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -1,4 +1,4 @@ -COMMON_DIR = common +COMMON_DIR = $(TMK_DIR)/common SRC += $(COMMON_DIR)/host.c \ $(COMMON_DIR)/keyboard.c \ $(COMMON_DIR)/action.c \ diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index 826c2330..487c62f1 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c @@ -257,7 +257,7 @@ bool process_tapping(keyrecord_t *keyp) return true; } } else { - if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n"); + if (!IS_NOEVENT(event)) debug("Tapping: other key just after tap.\n") {}; process_action(keyp); return true; } diff --git a/tmk_core/common/bootmagic.c b/tmk_core/common/bootmagic.c index b002a585..d6684b2d 100644 --- a/tmk_core/common/bootmagic.c +++ b/tmk_core/common/bootmagic.c @@ -19,7 +19,7 @@ void bootmagic(void) } /* do scans in case of bounce */ - print("boogmagic scan: ... "); + print("bootmagic scan: ... "); uint8_t scan = 100; while (scan--) { matrix_scan(); _delay_ms(10); } print("done.\n"); diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c index 1b6808be..b017f2e2 100644 --- a/tmk_core/common/command.c +++ b/tmk_core/common/command.c @@ -16,7 +16,7 @@ along with this program. If not, see . */ #include #include -#include +#include "wait.h" #include "keycode.h" #include "host.h" #include "keymap.h" @@ -97,12 +97,14 @@ bool command_proc(uint8_t code) bool command_extra(uint8_t code) __attribute__ ((weak)); bool command_extra(uint8_t code) { + (void)code; return false; } bool command_console_extra(uint8_t code) __attribute__ ((weak)); bool command_console_extra(uint8_t code) { + (void)code; return false; } @@ -178,7 +180,9 @@ static void print_eeconfig(void) static bool command_common(uint8_t code) { +#ifdef KEYBOARD_LOCK_ENABLE static host_driver_t *host_driver = 0; +#endif switch (code) { #ifdef SLEEP_LED_ENABLE case KC_Z: @@ -223,7 +227,7 @@ static bool command_common(uint8_t code) case KC_PAUSE: clear_keyboard(); print("\n\nbootloader... "); - _delay_ms(1000); + wait_ms(1000); bootloader_jump(); // not return break; case KC_D: @@ -307,15 +311,20 @@ static bool command_common(uint8_t code) " " STR(BOOTLOADER_SIZE) "\n"); print("GCC: " STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__) +#if defined(__AVR__) " AVR-LIBC: " __AVR_LIBC_VERSION_STRING__ " AVR_ARCH: avr" STR(__AVR_ARCH__) "\n"); +#elif defined(__arm__) + // TODO + ); +#endif break; case KC_S: print("\n\t- Status -\n"); print_val_hex8(host_keyboard_leds()); print_val_hex8(keyboard_protocol); print_val_hex8(keyboard_idle); - print_val_hex32(timer_count); + print_val_hex32(timer_read32()); #ifdef PROTOCOL_PJRC print_val_hex8(UDCON); diff --git a/tmk_core/common/keymap.c b/tmk_core/common/keymap.c index 9f4fab52..be00076c 100644 --- a/tmk_core/common/keymap.c +++ b/tmk_core/common/keymap.c @@ -108,6 +108,9 @@ action_t action_for_key(uint8_t layer, keypos_t key) __attribute__ ((weak)) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + (void)record; + (void)id; + (void)opt; return MACRO_NONE; } @@ -115,6 +118,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) __attribute__ ((weak)) void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + (void)record; + (void)id; + (void)opt; } diff --git a/tmk_core/common/progmem.h b/tmk_core/common/progmem.h index 199b1bed..5b276562 100644 --- a/tmk_core/common/progmem.h +++ b/tmk_core/common/progmem.h @@ -5,8 +5,8 @@ # include #elif defined(__arm__) # define PROGMEM -# define pgm_read_byte(p) *(p) -# define pgm_read_word(p) *(p) +# define pgm_read_byte(p) *((unsigned char*)p) +# define pgm_read_word(p) *((uint16_t*)p) #endif #endif