aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorJames Young <xxiinophobia@yahoo.com>2020-02-29 12:00:00 -0800
committerJames Young <xxiinophobia@yahoo.com>2020-02-29 11:59:30 -0800
commit26eef35f07698d23aafae90e1c230b52e100a334 (patch)
treeeb8e43fc58ca55788e6e89430af0db55ea79e324 /tmk_core
parent85041ff05bf0e5f4ff4535caf6e638491a5614c8 (diff)
downloadqmk_firmware-26eef35f07698d23aafae90e1c230b52e100a334.tar.gz
qmk_firmware-26eef35f07698d23aafae90e1c230b52e100a334.zip
2020 February 29 Breaking Changes Update (#8064)
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/chibios.mk18
-rw-r--r--tmk_core/common.mk5
-rw-r--r--tmk_core/common/action.c26
-rw-r--r--tmk_core/common/action_code.h33
-rw-r--r--tmk_core/common/chibios/timer.c44
-rw-r--r--tmk_core/common/command.c6
-rw-r--r--tmk_core/common/timer.h5
-rw-r--r--tmk_core/protocol/chibios.mk1
-rw-r--r--tmk_core/protocol/chibios/usb_driver.c10
-rw-r--r--tmk_core/protocol/chibios/usb_main.c8
10 files changed, 68 insertions, 88 deletions
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index f9e52aed2..73c01c7b4 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -110,6 +110,8 @@ else ifneq ("$(wildcard $(KEYBOARD_PATH_1)/ld/$(MCU_LDSCRIPT).ld)","")
110 LDSCRIPT = $(KEYBOARD_PATH_1)/ld/$(MCU_LDSCRIPT).ld 110 LDSCRIPT = $(KEYBOARD_PATH_1)/ld/$(MCU_LDSCRIPT).ld
111else ifneq ("$(wildcard $(TOP_DIR)/drivers/boards/ld/$(MCU_LDSCRIPT).ld)","") 111else ifneq ("$(wildcard $(TOP_DIR)/drivers/boards/ld/$(MCU_LDSCRIPT).ld)","")
112 LDSCRIPT = $(TOP_DIR)/drivers/boards/ld/$(MCU_LDSCRIPT).ld 112 LDSCRIPT = $(TOP_DIR)/drivers/boards/ld/$(MCU_LDSCRIPT).ld
113else ifneq ("$(wildcard $(STARTUPLD_CONTRIB)/$(MCU_LDSCRIPT).ld)","")
114 LDSCRIPT = $(STARTUPLD_CONTRIB)/$(MCU_LDSCRIPT).ld
113else 115else
114 LDSCRIPT = $(STARTUPLD)/$(MCU_LDSCRIPT).ld 116 LDSCRIPT = $(STARTUPLD)/$(MCU_LDSCRIPT).ld
115endif 117endif
@@ -120,17 +122,18 @@ CHIBISRC = $(STARTUPSRC) \
120 $(OSALSRC) \ 122 $(OSALSRC) \
121 $(HALSRC) \ 123 $(HALSRC) \
122 $(PLATFORMSRC) \ 124 $(PLATFORMSRC) \
125 $(PLATFORMSRC_CONTRIB) \
123 $(BOARDSRC) \ 126 $(BOARDSRC) \
124 $(STREAMSSRC) \ 127 $(STREAMSSRC)
125 $(STARTUPASM) \ 128
126 $(PORTASM) \ 129# Ensure the ASM files are not subjected to LTO -- it'll strip out interrupt handlers otherwise.
127 $(OSALASM) 130QUANTUM_LIB_SRC += $(STARTUPASM) $(PORTASM) $(OSALASM)
128 131
129CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC)) 132CHIBISRC := $(patsubst $(TOP_DIR)/%,%,$(CHIBISRC))
130 133
131EXTRAINCDIRS += $(CHIBIOS)/os/license \ 134EXTRAINCDIRS += $(CHIBIOS)/os/license $(CHIBIOS)/os/oslib/include \
132 $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \ 135 $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
133 $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \ 136 $(HALINC) $(PLATFORMINC) $(PLATFORMINC_CONTRIB) $(BOARDINC) $(TESTINC) \
134 $(STREAMSINC) $(CHIBIOS)/os/various $(COMMON_VPATH) 137 $(STREAMSINC) $(CHIBIOS)/os/various $(COMMON_VPATH)
135 138
136# 139#
@@ -179,6 +182,9 @@ LDFLAGS += -Wl,--script=$(LDSCRIPT)$(LDSYMBOLS)
179 182
180OPT_DEFS += -DPROTOCOL_CHIBIOS 183OPT_DEFS += -DPROTOCOL_CHIBIOS
181 184
185# Workaround to stop ChibiOS from complaining about new GCC -- it's been fixed for 7/8/9 already
186OPT_DEFS += -DPORT_IGNORE_GCC_VERSION_CHECK=1
187
182MCUFLAGS = -mcpu=$(MCU) 188MCUFLAGS = -mcpu=$(MCU)
183 189
184# FPU options default (Cortex-M4 and Cortex-M7 single precision). 190# FPU options default (Cortex-M4 and Cortex-M7 single precision).
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index 5f149d8f4..24b764800 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -172,11 +172,16 @@ ifeq ($(strip $(LTO_ENABLE)), yes)
172endif 172endif
173 173
174ifeq ($(strip $(LINK_TIME_OPTIMIZATION_ENABLE)), yes) 174ifeq ($(strip $(LINK_TIME_OPTIMIZATION_ENABLE)), yes)
175 ifeq ($(PLATFORM),CHIBIOS)
176 $(info Enabling LTO on ChibiOS-targeting boards is known to have a high likelihood of failure.)
177 $(info If unsure, set LINK_TIME_OPTIMIZATION_ENABLE = no.)
178 endif
175 EXTRAFLAGS += -flto 179 EXTRAFLAGS += -flto
176 TMK_COMMON_DEFS += -DLINK_TIME_OPTIMIZATION_ENABLE 180 TMK_COMMON_DEFS += -DLINK_TIME_OPTIMIZATION_ENABLE
177 TMK_COMMON_DEFS += -DNO_ACTION_MACRO 181 TMK_COMMON_DEFS += -DNO_ACTION_MACRO
178 TMK_COMMON_DEFS += -DNO_ACTION_FUNCTION 182 TMK_COMMON_DEFS += -DNO_ACTION_FUNCTION
179endif 183endif
184
180# Bootloader address 185# Bootloader address
181ifdef STM32_BOOTLOADER_ADDRESS 186ifdef STM32_BOOTLOADER_ADDRESS
182 TMK_COMMON_DEFS += -DSTM32_BOOTLOADER_ADDRESS=$(STM32_BOOTLOADER_ADDRESS) 187 TMK_COMMON_DEFS += -DSTM32_BOOTLOADER_ADDRESS=$(STM32_BOOTLOADER_ADDRESS)
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index d572b7056..0ec4a43ee 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -562,32 +562,6 @@ void process_action(keyrecord_t *record, action_t action) {
562 action_macro_play(action_get_macro(record, action.func.id, action.func.opt)); 562 action_macro_play(action_get_macro(record, action.func.id, action.func.opt));
563 break; 563 break;
564#endif 564#endif
565#if defined(BACKLIGHT_ENABLE) || defined(LED_MATRIX_ENABLE)
566 case ACT_BACKLIGHT:
567 if (!event.pressed) {
568 switch (action.backlight.opt) {
569 case BACKLIGHT_INCREASE:
570 backlight_increase();
571 break;
572 case BACKLIGHT_DECREASE:
573 backlight_decrease();
574 break;
575 case BACKLIGHT_TOGGLE:
576 backlight_toggle();
577 break;
578 case BACKLIGHT_STEP:
579 backlight_step();
580 break;
581 case BACKLIGHT_ON:
582 backlight_level(BACKLIGHT_LEVELS);
583 break;
584 case BACKLIGHT_OFF:
585 backlight_level(0);
586 break;
587 }
588 }
589 break;
590#endif
591 case ACT_COMMAND: 565 case ACT_COMMAND:
592 break; 566 break;
593#ifdef SWAP_HANDS_ENABLE 567#ifdef SWAP_HANDS_ENABLE
diff --git a/tmk_core/common/action_code.h b/tmk_core/common/action_code.h
index 03fcb3382..6c005b76d 100644
--- a/tmk_core/common/action_code.h
+++ b/tmk_core/common/action_code.h
@@ -86,8 +86,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
86 * 1100|opt | id(8) Macro play? 86 * 1100|opt | id(8) Macro play?
87 * 1100|1111| id(8) Macro record? 87 * 1100|1111| id(8) Macro record?
88 * 88 *
89 * ACT_BACKLIGHT(1101): 89 * 1101|xxxx xxxx xxxx (reserved)
90 * 1101|opt |level(8) Backlight commands
91 * 90 *
92 * ACT_COMMAND(1110): 91 * ACT_COMMAND(1110):
93 * 1110|opt | id(8) Built-in Command exec 92 * 1110|opt | id(8) Built-in Command exec
@@ -115,10 +114,9 @@ enum action_kind_id {
115 ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */ 114 ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */
116 ACT_LAYER_TAP_EXT = 0b1011, /* Layer 16-31 */ 115 ACT_LAYER_TAP_EXT = 0b1011, /* Layer 16-31 */
117 /* Extensions */ 116 /* Extensions */
118 ACT_MACRO = 0b1100, 117 ACT_MACRO = 0b1100,
119 ACT_BACKLIGHT = 0b1101, 118 ACT_COMMAND = 0b1110,
120 ACT_COMMAND = 0b1110, 119 ACT_FUNCTION = 0b1111
121 ACT_FUNCTION = 0b1111
122}; 120};
123 121
124/** \brief Action Code Struct 122/** \brief Action Code Struct
@@ -169,11 +167,6 @@ typedef union {
169 uint8_t page : 2; 167 uint8_t page : 2;
170 uint8_t kind : 4; 168 uint8_t kind : 4;
171 } usage; 169 } usage;
172 struct action_backlight {
173 uint8_t level : 8;
174 uint8_t opt : 4;
175 uint8_t kind : 4;
176 } backlight;
177 struct action_command { 170 struct action_command {
178 uint8_t id : 8; 171 uint8_t id : 8;
179 uint8_t opt : 4; 172 uint8_t opt : 4;
@@ -290,28 +283,10 @@ enum layer_param_tap_op {
290#define ACTION_DEFAULT_LAYER_BIT_XOR(part, bits) ACTION_LAYER_BITOP(OP_BIT_XOR, (part), (bits), 0) 283#define ACTION_DEFAULT_LAYER_BIT_XOR(part, bits) ACTION_LAYER_BITOP(OP_BIT_XOR, (part), (bits), 0)
291#define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0) 284#define ACTION_DEFAULT_LAYER_BIT_SET(part, bits) ACTION_LAYER_BITOP(OP_BIT_SET, (part), (bits), 0)
292 285
293/** \brief Extensions
294 */
295enum backlight_opt {
296 BACKLIGHT_INCREASE = 0,
297 BACKLIGHT_DECREASE = 1,
298 BACKLIGHT_TOGGLE = 2,
299 BACKLIGHT_STEP = 3,
300 BACKLIGHT_ON = 4,
301 BACKLIGHT_OFF = 5,
302};
303
304/* Macro */ 286/* Macro */
305#define ACTION_MACRO(id) ACTION(ACT_MACRO, (id)) 287#define ACTION_MACRO(id) ACTION(ACT_MACRO, (id))
306#define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP << 8 | (id)) 288#define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP << 8 | (id))
307#define ACTION_MACRO_OPT(id, opt) ACTION(ACT_MACRO, (opt) << 8 | (id)) 289#define ACTION_MACRO_OPT(id, opt) ACTION(ACT_MACRO, (opt) << 8 | (id))
308/* Backlight */
309#define ACTION_BACKLIGHT_INCREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_INCREASE << 8)
310#define ACTION_BACKLIGHT_DECREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_DECREASE << 8)
311#define ACTION_BACKLIGHT_TOGGLE() ACTION(ACT_BACKLIGHT, BACKLIGHT_TOGGLE << 8)
312#define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8)
313#define ACTION_BACKLIGHT_ON() ACTION(ACT_BACKLIGHT, BACKLIGHT_ON << 8)
314#define ACTION_BACKLIGHT_OFF() ACTION(ACT_BACKLIGHT, BACKLIGHT_OFF << 8)
315/* Command */ 290/* Command */
316#define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt) << 8 | (id)) 291#define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt) << 8 | (id))
317/* Function */ 292/* Function */
diff --git a/tmk_core/common/chibios/timer.c b/tmk_core/common/chibios/timer.c
index ed5cfe1b0..ac5a5af63 100644
--- a/tmk_core/common/chibios/timer.c
+++ b/tmk_core/common/chibios/timer.c
@@ -2,30 +2,44 @@
2 2
3#include "timer.h" 3#include "timer.h"
4 4
5static systime_t last_systime = 0; 5static uint32_t reset_point = 0;
6static systime_t overflow = 0; 6#if CH_CFG_ST_RESOLUTION < 32
7static uint32_t current_time_ms = 0; 7static uint32_t last_systime = 0;
8static uint32_t overflow = 0;
9#endif
8 10
9void timer_init(void) { timer_clear(); } 11void timer_init(void) { timer_clear(); }
10 12
11void timer_clear(void) { 13void timer_clear(void) {
12 last_systime = chVTGetSystemTime(); 14 reset_point = (uint32_t)chVTGetSystemTime();
13 overflow = 0; 15#if CH_CFG_ST_RESOLUTION < 32
14 current_time_ms = 0; 16 last_systime = reset_point;
17 overflow = 0;
18#endif
15} 19}
16 20
17uint16_t timer_read(void) { return (uint16_t)timer_read32(); } 21uint16_t timer_read(void) { return (uint16_t)timer_read32(); }
18 22
19uint32_t timer_read32(void) { 23uint32_t timer_read32(void) {
20 // Note: We assume that the timer update is called at least once betweeen every wrap around of the system time 24 uint32_t systime = (uint32_t)chVTGetSystemTime();
21 systime_t current_systime = chVTGetSystemTime(); 25
22 systime_t elapsed = current_systime - last_systime + overflow; 26#if CH_CFG_ST_RESOLUTION < 32
23 uint32_t elapsed_ms = ST2MS(elapsed); 27 // If/when we need to support 64-bit chips, this may need to be modified to match the native bit-ness of the MCU.
24 current_time_ms += elapsed_ms; 28 // At this point, the only SysTick resolution allowed other than 32 is 16 bit.
25 overflow = elapsed - MS2ST(elapsed_ms); 29 // In the 16-bit case, at:
26 last_systime = current_systime; 30 // - CH_CFG_ST_FREQUENCY = 100000, overflow will occur every ~0.65 seconds
27 31 // - CH_CFG_ST_FREQUENCY = 10000, overflow will occur every ~6.5 seconds
28 return current_time_ms; 32 // - CH_CFG_ST_FREQUENCY = 1000, overflow will occur every ~65 seconds
33 // With this implementation, as long as we ensure a timer read happens at least once during the overflow period, timing should be accurate.
34 if (systime < last_systime) {
35 overflow += ((uint32_t)1) << CH_CFG_ST_RESOLUTION;
36 }
37
38 last_systime = systime;
39 return (uint32_t)TIME_I2MS(systime - reset_point + overflow);
40#else
41 return (uint32_t)TIME_I2MS(systime - reset_point);
42#endif
29} 43}
30 44
31uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); } 45uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); }
diff --git a/tmk_core/common/command.c b/tmk_core/common/command.c
index 900de5410..77a205eac 100644
--- a/tmk_core/common/command.c
+++ b/tmk_core/common/command.c
@@ -153,6 +153,9 @@ static void print_version(void) {
153 print("BUILD: (" __DATE__ ")\n"); 153 print("BUILD: (" __DATE__ ")\n");
154#else 154#else
155 print("BUILD: " STR(QMK_VERSION) " (" __TIME__ " " __DATE__ ")\n"); 155 print("BUILD: " STR(QMK_VERSION) " (" __TIME__ " " __DATE__ ")\n");
156# ifdef PROTOCOL_CHIBIOS
157 print("CHIBIOS: " STR(CHIBIOS_VERSION) ", CONTRIB: " STR(CHIBIOS_CONTRIB_VERSION) "\n");
158# endif
156#endif 159#endif
157 160
158 /* build options */ 161 /* build options */
@@ -182,6 +185,9 @@ static void print_version(void) {
182#ifdef NKRO_ENABLE 185#ifdef NKRO_ENABLE
183 " NKRO" 186 " NKRO"
184#endif 187#endif
188#ifdef LINK_TIME_OPTIMIZATION_ENABLE
189 " LTO"
190#endif
185 191
186 " " STR(BOOTLOADER_SIZE) "\n"); 192 " " STR(BOOTLOADER_SIZE) "\n");
187 193
diff --git a/tmk_core/common/timer.h b/tmk_core/common/timer.h
index 378cf7892..bbaae109d 100644
--- a/tmk_core/common/timer.h
+++ b/tmk_core/common/timer.h
@@ -45,9 +45,8 @@ uint16_t timer_elapsed(uint16_t last);
45uint32_t timer_elapsed32(uint32_t last); 45uint32_t timer_elapsed32(uint32_t last);
46 46
47// Utility functions to check if a future time has expired & autmatically handle time wrapping if checked / reset frequently (half of max value) 47// Utility functions to check if a future time has expired & autmatically handle time wrapping if checked / reset frequently (half of max value)
48inline bool timer_expired(uint16_t current, uint16_t future) { return (uint16_t)(current - future) < 0x8000; } 48#define timer_expired(current, future) (((uint16_t)current - (uint16_t)future) < 0x8000)
49 49#define timer_expired32(current, future) (((uint32_t)current - (uint32_t)future) < 0x80000000)
50inline bool timer_expired32(uint32_t current, uint32_t future) { return (uint32_t)(current - future) < 0x80000000; }
51 50
52#ifdef __cplusplus 51#ifdef __cplusplus
53} 52}
diff --git a/tmk_core/protocol/chibios.mk b/tmk_core/protocol/chibios.mk
index 222fb4dad..2070420f5 100644
--- a/tmk_core/protocol/chibios.mk
+++ b/tmk_core/protocol/chibios.mk
@@ -6,6 +6,7 @@ SRC += $(CHIBIOS_DIR)/usb_main.c
6SRC += $(CHIBIOS_DIR)/main.c 6SRC += $(CHIBIOS_DIR)/main.c
7SRC += usb_descriptor.c 7SRC += usb_descriptor.c
8SRC += $(CHIBIOS_DIR)/usb_driver.c 8SRC += $(CHIBIOS_DIR)/usb_driver.c
9SRC += $(LIBSRC)
9 10
10VPATH += $(TMK_PATH)/$(PROTOCOL_DIR) 11VPATH += $(TMK_PATH)/$(PROTOCOL_DIR)
11VPATH += $(TMK_PATH)/$(CHIBIOS_DIR) 12VPATH += $(TMK_PATH)/$(CHIBIOS_DIR)
diff --git a/tmk_core/protocol/chibios/usb_driver.c b/tmk_core/protocol/chibios/usb_driver.c
index 28a8c6663..22d3c91f5 100644
--- a/tmk_core/protocol/chibios/usb_driver.c
+++ b/tmk_core/protocol/chibios/usb_driver.c
@@ -88,15 +88,15 @@ static msg_t _put(void *ip, uint8_t b) { return obqPutTimeout(&((QMKUSBDriver *)
88 88
89static msg_t _get(void *ip) { return ibqGetTimeout(&((QMKUSBDriver *)ip)->ibqueue, TIME_INFINITE); } 89static msg_t _get(void *ip) { return ibqGetTimeout(&((QMKUSBDriver *)ip)->ibqueue, TIME_INFINITE); }
90 90
91static msg_t _putt(void *ip, uint8_t b, systime_t timeout) { return obqPutTimeout(&((QMKUSBDriver *)ip)->obqueue, b, timeout); } 91static msg_t _putt(void *ip, uint8_t b, sysinterval_t timeout) { return obqPutTimeout(&((QMKUSBDriver *)ip)->obqueue, b, timeout); }
92 92
93static msg_t _gett(void *ip, systime_t timeout) { return ibqGetTimeout(&((QMKUSBDriver *)ip)->ibqueue, timeout); } 93static msg_t _gett(void *ip, sysinterval_t timeout) { return ibqGetTimeout(&((QMKUSBDriver *)ip)->ibqueue, timeout); }
94 94
95static size_t _writet(void *ip, const uint8_t *bp, size_t n, systime_t timeout) { return obqWriteTimeout(&((QMKUSBDriver *)ip)->obqueue, bp, n, timeout); } 95static size_t _writet(void *ip, const uint8_t *bp, size_t n, sysinterval_t timeout) { return obqWriteTimeout(&((QMKUSBDriver *)ip)->obqueue, bp, n, timeout); }
96 96
97static size_t _readt(void *ip, uint8_t *bp, size_t n, systime_t timeout) { return ibqReadTimeout(&((QMKUSBDriver *)ip)->ibqueue, bp, n, timeout); } 97static size_t _readt(void *ip, uint8_t *bp, size_t n, sysinterval_t timeout) { return ibqReadTimeout(&((QMKUSBDriver *)ip)->ibqueue, bp, n, timeout); }
98 98
99static const struct QMKUSBDriverVMT vmt = {_write, _read, _put, _get, _putt, _gett, _writet, _readt}; 99static const struct QMKUSBDriverVMT vmt = {0, _write, _read, _put, _get, _putt, _gett, _writet, _readt};
100 100
101/** 101/**
102 * @brief Notification of empty buffer released into the input buffers queue. 102 * @brief Notification of empty buffer released into the input buffers queue.
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index ec95167cf..ecc83d9ec 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -469,7 +469,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
469#endif /* NKRO_ENABLE */ 469#endif /* NKRO_ENABLE */
470 /* arm the idle timer if boot protocol & idle */ 470 /* arm the idle timer if boot protocol & idle */
471 osalSysLockFromISR(); 471 osalSysLockFromISR();
472 chVTSetI(&keyboard_idle_timer, 4 * MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); 472 chVTSetI(&keyboard_idle_timer, 4 * TIME_MS2I(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp);
473 osalSysUnlockFromISR(); 473 osalSysUnlockFromISR();
474 } 474 }
475 } 475 }
@@ -486,7 +486,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
486 if (keyboard_idle) { 486 if (keyboard_idle) {
487#endif /* NKRO_ENABLE */ 487#endif /* NKRO_ENABLE */
488 osalSysLockFromISR(); 488 osalSysLockFromISR();
489 chVTSetI(&keyboard_idle_timer, 4 * MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); 489 chVTSetI(&keyboard_idle_timer, 4 * TIME_MS2I(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp);
490 osalSysUnlockFromISR(); 490 osalSysUnlockFromISR();
491 } 491 }
492 usbSetupTransfer(usbp, NULL, 0, NULL); 492 usbSetupTransfer(usbp, NULL, 0, NULL);
@@ -601,7 +601,7 @@ static void keyboard_idle_timer_cb(void *arg) {
601 usbStartTransmitI(usbp, KEYBOARD_IN_EPNUM, (uint8_t *)&keyboard_report_sent, KEYBOARD_EPSIZE); 601 usbStartTransmitI(usbp, KEYBOARD_IN_EPNUM, (uint8_t *)&keyboard_report_sent, KEYBOARD_EPSIZE);
602 } 602 }
603 /* rearm the timer */ 603 /* rearm the timer */
604 chVTSetI(&keyboard_idle_timer, 4 * MS2ST(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp); 604 chVTSetI(&keyboard_idle_timer, 4 * TIME_MS2I(keyboard_idle), keyboard_idle_timer_cb, (void *)usbp);
605 } 605 }
606 606
607 /* do not rearm the timer if the condition above fails 607 /* do not rearm the timer if the condition above fails
@@ -700,7 +700,7 @@ void send_mouse(report_mouse_t *report) {
700 * every iteration - otherwise the system will remain locked, 700 * every iteration - otherwise the system will remain locked,
701 * no interrupts served, so USB not going through as well. 701 * no interrupts served, so USB not going through as well.
702 * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */ 702 * Note: for suspend, need USB_USE_WAIT == TRUE in halconf.h */
703 if (osalThreadSuspendTimeoutS(&(&USB_DRIVER)->epc[MOUSE_IN_EPNUM]->in_state->thread, MS2ST(10)) == MSG_TIMEOUT) { 703 if (osalThreadSuspendTimeoutS(&(&USB_DRIVER)->epc[MOUSE_IN_EPNUM]->in_state->thread, TIME_MS2I(10)) == MSG_TIMEOUT) {
704 osalSysUnlock(); 704 osalSysUnlock();
705 return; 705 return;
706 } 706 }