aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2021-01-18 05:12:15 +1100
committerZach White <skullydazed@drpepper.org>2021-01-17 10:19:56 -0800
commit31c57aab35e6fd49c4c8336f449419afe7630e93 (patch)
tree60b3508af9b3a953826d027a2dc6f2e2d028d1cc
parente702c7f1b4cfa8fe1579498ef2877994baa64056 (diff)
downloadqmk_firmware-31c57aab35e6fd49c4c8336f449419afe7630e93.tar.gz
qmk_firmware-31c57aab35e6fd49c4c8336f449419afe7630e93.zip
`qmk cformat`
-rw-r--r--quantum/quantum.c8
-rw-r--r--quantum/quantum.h4
-rw-r--r--quantum/rgblight.c2
-rw-r--r--quantum/split_common/matrix.c2
-rw-r--r--quantum/split_common/transport.c26
-rw-r--r--tmk_core/common/avr/bootloader.c8
-rw-r--r--tmk_core/common/mousekey.c32
-rw-r--r--tmk_core/common/mousekey.h78
-rw-r--r--tmk_core/common/wait.h89
9 files changed, 136 insertions, 113 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index ece0388d3..8db801f19 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -551,10 +551,10 @@ void send_char(char ascii_code) {
551 } 551 }
552#endif 552#endif
553 553
554 uint8_t keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]); 554 uint8_t keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]);
555 bool is_shifted = PGM_LOADBIT(ascii_to_shift_lut, (uint8_t)ascii_code); 555 bool is_shifted = PGM_LOADBIT(ascii_to_shift_lut, (uint8_t)ascii_code);
556 bool is_altgred = PGM_LOADBIT(ascii_to_altgr_lut, (uint8_t)ascii_code); 556 bool is_altgred = PGM_LOADBIT(ascii_to_altgr_lut, (uint8_t)ascii_code);
557 bool is_dead = PGM_LOADBIT(ascii_to_dead_lut, (uint8_t)ascii_code); 557 bool is_dead = PGM_LOADBIT(ascii_to_dead_lut, (uint8_t)ascii_code);
558 558
559 if (is_shifted) { 559 if (is_shifted) {
560 register_code(KC_LSFT); 560 register_code(KC_LSFT);
diff --git a/quantum/quantum.h b/quantum/quantum.h
index d234e6ea0..370a65fe0 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -248,9 +248,9 @@ typedef ioline_t pin_t;
248 */ 248 */
249# if !defined(GPIO_INPUT_PIN_DELAY) 249# if !defined(GPIO_INPUT_PIN_DELAY)
250# if defined(STM32_SYSCLK) 250# if defined(STM32_SYSCLK)
251# define GPIO_INPUT_PIN_DELAY (STM32_SYSCLK/1000000L / 4) 251# define GPIO_INPUT_PIN_DELAY (STM32_SYSCLK / 1000000L / 4)
252# elif defined(KINETIS_SYSCLK_FREQUENCY) 252# elif defined(KINETIS_SYSCLK_FREQUENCY)
253# define GPIO_INPUT_PIN_DELAY (KINETIS_SYSCLK_FREQUENCY/1000000L / 4) 253# define GPIO_INPUT_PIN_DELAY (KINETIS_SYSCLK_FREQUENCY / 1000000L / 4)
254# endif 254# endif
255# endif 255# endif
256# define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY) 256# define waitInputPinDelay() wait_cpuclock(GPIO_INPUT_PIN_DELAY)
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index b16c3e7c2..44e9eade5 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -843,7 +843,7 @@ void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom) {
843 animation_status.restart = true; 843 animation_status.restart = true;
844 } 844 }
845# endif /* RGBLIGHT_SPLIT_NO_ANIMATION_SYNC */ 845# endif /* RGBLIGHT_SPLIT_NO_ANIMATION_SYNC */
846# endif /* RGBLIGHT_USE_TIMER */ 846# endif /* RGBLIGHT_USE_TIMER */
847} 847}
848#endif /* RGBLIGHT_SPLIT */ 848#endif /* RGBLIGHT_SPLIT */
849 849
diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c
index 631e960ea..bad762b49 100644
--- a/quantum/split_common/matrix.c
+++ b/quantum/split_common/matrix.c
@@ -264,7 +264,7 @@ bool matrix_post_scan(void) {
264 // reset other half if disconnected 264 // reset other half if disconnected
265 for (int i = 0; i < ROWS_PER_HAND; ++i) { 265 for (int i = 0; i < ROWS_PER_HAND; ++i) {
266 matrix[thatHand + i] = 0; 266 matrix[thatHand + i] = 0;
267 slave_matrix[i] = 0; 267 slave_matrix[i] = 0;
268 } 268 }
269 269
270 changed = true; 270 changed = true;
diff --git a/quantum/split_common/transport.c b/quantum/split_common/transport.c
index e601fb4df..b45ba92c3 100644
--- a/quantum/split_common/transport.c
+++ b/quantum/split_common/transport.c
@@ -40,7 +40,7 @@ typedef struct _I2C_slave_buffer_t {
40# endif 40# endif
41# endif 41# endif
42# ifdef BACKLIGHT_ENABLE 42# ifdef BACKLIGHT_ENABLE
43 uint8_t backlight_level; 43 uint8_t backlight_level;
44# endif 44# endif
45# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT) 45# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_SPLIT)
46 rgblight_syncinfo_t rgblight_sync; 46 rgblight_syncinfo_t rgblight_sync;
@@ -172,9 +172,9 @@ void transport_slave(matrix_row_t matrix[]) {
172# ifdef SPLIT_MODS_ENABLE 172# ifdef SPLIT_MODS_ENABLE
173 set_mods(i2c_buffer->real_mods); 173 set_mods(i2c_buffer->real_mods);
174 set_weak_mods(i2c_buffer->weak_mods); 174 set_weak_mods(i2c_buffer->weak_mods);
175# ifndef NO_ACTION_ONESHOT 175# ifndef NO_ACTION_ONESHOT
176 set_oneshot_mods(i2c_buffer->oneshot_mods); 176 set_oneshot_mods(i2c_buffer->oneshot_mods);
177# endif 177# endif
178# endif 178# endif
179} 179}
180 180
@@ -191,27 +191,27 @@ typedef struct _Serial_s2m_buffer_t {
191 matrix_row_t smatrix[ROWS_PER_HAND]; 191 matrix_row_t smatrix[ROWS_PER_HAND];
192 192
193# ifdef ENCODER_ENABLE 193# ifdef ENCODER_ENABLE
194 uint8_t encoder_state[NUMBER_OF_ENCODERS]; 194 uint8_t encoder_state[NUMBER_OF_ENCODERS];
195# endif 195# endif
196 196
197} Serial_s2m_buffer_t; 197} Serial_s2m_buffer_t;
198 198
199typedef struct _Serial_m2s_buffer_t { 199typedef struct _Serial_m2s_buffer_t {
200# ifdef SPLIT_MODS_ENABLE 200# ifdef SPLIT_MODS_ENABLE
201 uint8_t real_mods; 201 uint8_t real_mods;
202 uint8_t weak_mods; 202 uint8_t weak_mods;
203# ifndef NO_ACTION_ONESHOT 203# ifndef NO_ACTION_ONESHOT
204 uint8_t oneshot_mods; 204 uint8_t oneshot_mods;
205# endif 205# endif
206# endif 206# endif
207# ifndef DISABLE_SYNC_TIMER 207# ifndef DISABLE_SYNC_TIMER
208 uint32_t sync_timer; 208 uint32_t sync_timer;
209# endif 209# endif
210# ifdef BACKLIGHT_ENABLE 210# ifdef BACKLIGHT_ENABLE
211 uint8_t backlight_level; 211 uint8_t backlight_level;
212# endif 212# endif
213# ifdef WPM_ENABLE 213# ifdef WPM_ENABLE
214 uint8_t current_wpm; 214 uint8_t current_wpm;
215# endif 215# endif
216} Serial_m2s_buffer_t; 216} Serial_m2s_buffer_t;
217 217
@@ -317,18 +317,18 @@ bool transport_master(matrix_row_t matrix[]) {
317 317
318# ifdef WPM_ENABLE 318# ifdef WPM_ENABLE
319 // Write wpm to slave 319 // Write wpm to slave
320 serial_m2s_buffer.current_wpm = get_current_wpm(); 320 serial_m2s_buffer.current_wpm = get_current_wpm();
321# endif 321# endif
322 322
323# ifdef SPLIT_MODS_ENABLE 323# ifdef SPLIT_MODS_ENABLE
324 serial_m2s_buffer.real_mods = get_mods(); 324 serial_m2s_buffer.real_mods = get_mods();
325 serial_m2s_buffer.weak_mods = get_weak_mods(); 325 serial_m2s_buffer.weak_mods = get_weak_mods();
326# ifndef NO_ACTION_ONESHOT 326# ifndef NO_ACTION_ONESHOT
327 serial_m2s_buffer.oneshot_mods = get_oneshot_mods(); 327 serial_m2s_buffer.oneshot_mods = get_oneshot_mods();
328# endif 328# endif
329# endif 329# endif
330# ifndef DISABLE_SYNC_TIMER 330# ifndef DISABLE_SYNC_TIMER
331 serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET; 331 serial_m2s_buffer.sync_timer = sync_timer_read32() + SYNC_TIMER_OFFSET;
332# endif 332# endif
333 return true; 333 return true;
334} 334}
diff --git a/tmk_core/common/avr/bootloader.c b/tmk_core/common/avr/bootloader.c
index c0272903b..4e3a27022 100644
--- a/tmk_core/common/avr/bootloader.c
+++ b/tmk_core/common/avr/bootloader.c
@@ -237,13 +237,13 @@ __attribute__((weak)) void bootloader_jump(void) {
237 "bootloader_startup_loop%=: \n\t" 237 "bootloader_startup_loop%=: \n\t"
238 "rjmp bootloader_startup_loop%= \n\t" 238 "rjmp bootloader_startup_loop%= \n\t"
239 : 239 :
240 : [mcucsrio] "I"(_SFR_IO_ADDR(MCUCSR)), 240 : [ mcucsrio ] "I"(_SFR_IO_ADDR(MCUCSR)),
241# if (FLASHEND > 131071) 241# if (FLASHEND > 131071)
242 [ramendhi] "M"(((RAMEND - 2) >> 8) & 0xff), [ramendlo] "M"(((RAMEND - 2) >> 0) & 0xff), [bootaddrhi] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 16) & 0xff), 242 [ ramendhi ] "M"(((RAMEND - 2) >> 8) & 0xff), [ ramendlo ] "M"(((RAMEND - 2) >> 0) & 0xff), [ bootaddrhi ] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 16) & 0xff),
243# else 243# else
244 [ramendhi] "M"(((RAMEND - 1) >> 8) & 0xff), [ramendlo] "M"(((RAMEND - 1) >> 0) & 0xff), 244 [ ramendhi ] "M"(((RAMEND - 1) >> 8) & 0xff), [ ramendlo ] "M"(((RAMEND - 1) >> 0) & 0xff),
245# endif 245# endif
246 [bootaddrme] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 8) & 0xff), [bootaddrlo] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 0) & 0xff)); 246 [ bootaddrme ] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 8) & 0xff), [ bootaddrlo ] "M"((((FLASH_SIZE - BOOTLOADER_SIZE) >> 1) >> 0) & 0xff));
247 247
248#else // Assume remaining boards are DFU, even if the flag isn't set 248#else // Assume remaining boards are DFU, even if the flag isn't set
249 249
diff --git a/tmk_core/common/mousekey.c b/tmk_core/common/mousekey.c
index 697e0692c..6c9df6723 100644
--- a/tmk_core/common/mousekey.c
+++ b/tmk_core/common/mousekey.c
@@ -37,7 +37,7 @@ static uint8_t mousekey_accel = 0;
37static uint8_t mousekey_repeat = 0; 37static uint8_t mousekey_repeat = 0;
38static uint8_t mousekey_wheel_repeat = 0; 38static uint8_t mousekey_wheel_repeat = 0;
39#ifdef MK_KINETIC_SPEED 39#ifdef MK_KINETIC_SPEED
40static uint16_t mouse_timer = 0; 40static uint16_t mouse_timer = 0;
41#endif 41#endif
42 42
43#ifndef MK_3_SPEED 43#ifndef MK_3_SPEED
@@ -123,20 +123,18 @@ static uint8_t wheel_unit(void) {
123 * B: base mouse travel speed 123 * B: base mouse travel speed
124 */ 124 */
125const uint16_t mk_accelerated_speed = MOUSEKEY_ACCELERATED_SPEED; 125const uint16_t mk_accelerated_speed = MOUSEKEY_ACCELERATED_SPEED;
126const uint16_t mk_base_speed = MOUSEKEY_BASE_SPEED; 126const uint16_t mk_base_speed = MOUSEKEY_BASE_SPEED;
127const uint16_t mk_decelerated_speed = MOUSEKEY_DECELERATED_SPEED; 127const uint16_t mk_decelerated_speed = MOUSEKEY_DECELERATED_SPEED;
128const uint16_t mk_initial_speed = MOUSEKEY_INITIAL_SPEED; 128const uint16_t mk_initial_speed = MOUSEKEY_INITIAL_SPEED;
129 129
130static uint8_t move_unit(void) { 130static uint8_t move_unit(void) {
131 float speed = mk_initial_speed; 131 float speed = mk_initial_speed;
132 132
133 if (mousekey_accel & ((1<<0) | (1<<2))) { 133 if (mousekey_accel & ((1 << 0) | (1 << 2))) {
134 speed = mousekey_accel & (1<<2) ? mk_accelerated_speed : mk_decelerated_speed; 134 speed = mousekey_accel & (1 << 2) ? mk_accelerated_speed : mk_decelerated_speed;
135 } else if (mousekey_repeat && mouse_timer) { 135 } else if (mousekey_repeat && mouse_timer) {
136 const float time_elapsed = timer_elapsed(mouse_timer) / 50; 136 const float time_elapsed = timer_elapsed(mouse_timer) / 50;
137 speed = mk_initial_speed + 137 speed = mk_initial_speed + MOUSEKEY_MOVE_DELTA * time_elapsed + MOUSEKEY_MOVE_DELTA * 0.5 * time_elapsed * time_elapsed;
138 MOUSEKEY_MOVE_DELTA * time_elapsed +
139 MOUSEKEY_MOVE_DELTA * 0.5 * time_elapsed * time_elapsed;
140 138
141 speed = speed > mk_base_speed ? mk_base_speed : speed; 139 speed = speed > mk_base_speed ? mk_base_speed : speed;
142 } 140 }
@@ -153,14 +151,12 @@ float mk_wheel_interval = 1000.0f / MOUSEKEY_WHEEL_INITIAL_MOVEMENTS;
153static uint8_t wheel_unit(void) { 151static uint8_t wheel_unit(void) {
154 float speed = MOUSEKEY_WHEEL_INITIAL_MOVEMENTS; 152 float speed = MOUSEKEY_WHEEL_INITIAL_MOVEMENTS;
155 153
156 if (mousekey_accel & ((1<<0) | (1<<2))) { 154 if (mousekey_accel & ((1 << 0) | (1 << 2))) {
157 speed = mousekey_accel & (1<<2) ? MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS : MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS; 155 speed = mousekey_accel & (1 << 2) ? MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS : MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS;
158 } else if (mousekey_repeat && mouse_timer) { 156 } else if (mousekey_repeat && mouse_timer) {
159 if (mk_wheel_interval != MOUSEKEY_WHEEL_BASE_MOVEMENTS) { 157 if (mk_wheel_interval != MOUSEKEY_WHEEL_BASE_MOVEMENTS) {
160 const float time_elapsed = timer_elapsed(mouse_timer) / 50; 158 const float time_elapsed = timer_elapsed(mouse_timer) / 50;
161 speed = MOUSEKEY_WHEEL_INITIAL_MOVEMENTS + 159 speed = MOUSEKEY_WHEEL_INITIAL_MOVEMENTS + 1 * time_elapsed + 1 * 0.5 * time_elapsed * time_elapsed;
162 1 * time_elapsed +
163 1 * 0.5 * time_elapsed * time_elapsed;
164 } 160 }
165 speed = speed > MOUSEKEY_WHEEL_BASE_MOVEMENTS ? MOUSEKEY_WHEEL_BASE_MOVEMENTS : speed; 161 speed = speed > MOUSEKEY_WHEEL_BASE_MOVEMENTS ? MOUSEKEY_WHEEL_BASE_MOVEMENTS : speed;
166 } 162 }
@@ -209,7 +205,7 @@ static uint8_t wheel_unit(void) {
209} 205}
210 206
211# endif /* #ifndef MK_KINETIC_SPEED */ 207# endif /* #ifndef MK_KINETIC_SPEED */
212# endif /* #ifndef MK_COMBINED */ 208# endif /* #ifndef MK_COMBINED */
213 209
214void mousekey_task(void) { 210void mousekey_task(void) {
215 // report cursor and scroll movement independently 211 // report cursor and scroll movement independently
@@ -260,11 +256,11 @@ void mousekey_task(void) {
260} 256}
261 257
262void mousekey_on(uint8_t code) { 258void mousekey_on(uint8_t code) {
263#ifdef MK_KINETIC_SPEED 259# ifdef MK_KINETIC_SPEED
264 if (mouse_timer == 0) { 260 if (mouse_timer == 0) {
265 mouse_timer = timer_read(); 261 mouse_timer = timer_read();
266 } 262 }
267#endif /* #ifdef MK_KINETIC_SPEED */ 263# endif /* #ifdef MK_KINETIC_SPEED */
268 264
269 if (code == KC_MS_UP) 265 if (code == KC_MS_UP)
270 mouse_report.y = move_unit() * -1; 266 mouse_report.y = move_unit() * -1;
@@ -335,9 +331,9 @@ void mousekey_off(uint8_t code) {
335 mousekey_accel &= ~(1 << 2); 331 mousekey_accel &= ~(1 << 2);
336 if (mouse_report.x == 0 && mouse_report.y == 0) { 332 if (mouse_report.x == 0 && mouse_report.y == 0) {
337 mousekey_repeat = 0; 333 mousekey_repeat = 0;
338#ifdef MK_KINETIC_SPEED 334# ifdef MK_KINETIC_SPEED
339 mouse_timer = 0; 335 mouse_timer = 0;
340#endif /* #ifdef MK_KINETIC_SPEED */ 336# endif /* #ifdef MK_KINETIC_SPEED */
341 } 337 }
342 if (mouse_report.v == 0 && mouse_report.h == 0) mousekey_wheel_repeat = 0; 338 if (mouse_report.v == 0 && mouse_report.h == 0) mousekey_wheel_repeat = 0;
343} 339}
diff --git a/tmk_core/common/mousekey.h b/tmk_core/common/mousekey.h
index 911d11eeb..52b8fe10e 100644
--- a/tmk_core/common/mousekey.h
+++ b/tmk_core/common/mousekey.h
@@ -36,28 +36,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
36# endif 36# endif
37 37
38# ifndef MOUSEKEY_MOVE_DELTA 38# ifndef MOUSEKEY_MOVE_DELTA
39#ifndef MK_KINETIC_SPEED 39# ifndef MK_KINETIC_SPEED
40# define MOUSEKEY_MOVE_DELTA 5 40# define MOUSEKEY_MOVE_DELTA 5
41#else 41# else
42# define MOUSEKEY_MOVE_DELTA 25 42# define MOUSEKEY_MOVE_DELTA 25
43#endif 43# endif
44# endif 44# endif
45# ifndef MOUSEKEY_WHEEL_DELTA 45# ifndef MOUSEKEY_WHEEL_DELTA
46# define MOUSEKEY_WHEEL_DELTA 1 46# define MOUSEKEY_WHEEL_DELTA 1
47# endif 47# endif
48# ifndef MOUSEKEY_DELAY 48# ifndef MOUSEKEY_DELAY
49#ifndef MK_KINETIC_SPEED 49# ifndef MK_KINETIC_SPEED
50# define MOUSEKEY_DELAY 300 50# define MOUSEKEY_DELAY 300
51#else 51# else
52# define MOUSEKEY_DELAY 8 52# define MOUSEKEY_DELAY 8
53#endif 53# endif
54# endif 54# endif
55# ifndef MOUSEKEY_INTERVAL 55# ifndef MOUSEKEY_INTERVAL
56#ifndef MK_KINETIC_SPEED 56# ifndef MK_KINETIC_SPEED
57# define MOUSEKEY_INTERVAL 50 57# define MOUSEKEY_INTERVAL 50
58#else 58# else
59# define MOUSEKEY_INTERVAL 8 59# define MOUSEKEY_INTERVAL 8
60#endif 60# endif
61# endif 61# endif
62# ifndef MOUSEKEY_MAX_SPEED 62# ifndef MOUSEKEY_MAX_SPEED
63# define MOUSEKEY_MAX_SPEED 10 63# define MOUSEKEY_MAX_SPEED 10
@@ -78,30 +78,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
78# define MOUSEKEY_WHEEL_TIME_TO_MAX 40 78# define MOUSEKEY_WHEEL_TIME_TO_MAX 40
79# endif 79# endif
80 80
81#ifndef MOUSEKEY_INITIAL_SPEED 81# ifndef MOUSEKEY_INITIAL_SPEED
82#define MOUSEKEY_INITIAL_SPEED 100 82# define MOUSEKEY_INITIAL_SPEED 100
83#endif 83# endif
84#ifndef MOUSEKEY_BASE_SPEED 84# ifndef MOUSEKEY_BASE_SPEED
85#define MOUSEKEY_BASE_SPEED 1000 85# define MOUSEKEY_BASE_SPEED 1000
86#endif 86# endif
87#ifndef MOUSEKEY_DECELERATED_SPEED 87# ifndef MOUSEKEY_DECELERATED_SPEED
88#define MOUSEKEY_DECELERATED_SPEED 400 88# define MOUSEKEY_DECELERATED_SPEED 400
89#endif 89# endif
90#ifndef MOUSEKEY_ACCELERATED_SPEED 90# ifndef MOUSEKEY_ACCELERATED_SPEED
91#define MOUSEKEY_ACCELERATED_SPEED 3000 91# define MOUSEKEY_ACCELERATED_SPEED 3000
92#endif 92# endif
93#ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 93# ifndef MOUSEKEY_WHEEL_INITIAL_MOVEMENTS
94#define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 16 94# define MOUSEKEY_WHEEL_INITIAL_MOVEMENTS 16
95#endif 95# endif
96#ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS 96# ifndef MOUSEKEY_WHEEL_BASE_MOVEMENTS
97#define MOUSEKEY_WHEEL_BASE_MOVEMENTS 32 97# define MOUSEKEY_WHEEL_BASE_MOVEMENTS 32
98#endif 98# endif
99#ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 99# ifndef MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS
100#define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48 100# define MOUSEKEY_WHEEL_ACCELERATED_MOVEMENTS 48
101#endif 101# endif
102#ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 102# ifndef MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS
103#define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8 103# define MOUSEKEY_WHEEL_DECELERATED_MOVEMENTS 8
104#endif 104# endif
105 105
106#else /* #ifndef MK_3_SPEED */ 106#else /* #ifndef MK_3_SPEED */
107 107
diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h
index 0b3fd755a..28224fe3a 100644
--- a/tmk_core/common/wait.h
+++ b/tmk_core/common/wait.h
@@ -15,44 +15,71 @@ extern "C" {
15 15
16# define CLOCK_DELAY_NOP8 "nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t" 16# define CLOCK_DELAY_NOP8 "nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t"
17 17
18__attribute__((always_inline)) 18__attribute__((always_inline)) static inline void wait_cpuclock_allnop(unsigned int n) { /* n: 1..135 */
19static inline void wait_cpuclock_allnop(unsigned int n) { /* n: 1..135 */
20 /* The argument n must be a constant expression. 19 /* The argument n must be a constant expression.
21 * That way, compiler optimization will remove unnecessary code. */ 20 * That way, compiler optimization will remove unnecessary code. */
22 if (n < 1) { return; } 21 if (n < 1) {
22 return;
23 }
23 if (n > 8) { 24 if (n > 8) {
24 unsigned int n8 = n/8; 25 unsigned int n8 = n / 8;
25 n = n - n8*8; 26 n = n - n8 * 8;
26 switch (n8) { 27 switch (n8) {
27 case 16: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 28 case 16:
28 case 15: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 29 asm volatile(CLOCK_DELAY_NOP8::: "memory");
29 case 14: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 30 case 15:
30 case 13: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 31 asm volatile(CLOCK_DELAY_NOP8::: "memory");
31 case 12: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 32 case 14:
32 case 11: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 33 asm volatile(CLOCK_DELAY_NOP8::: "memory");
33 case 10: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 34 case 13:
34 case 9: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 35 asm volatile(CLOCK_DELAY_NOP8::: "memory");
35 case 8: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 36 case 12:
36 case 7: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 37 asm volatile(CLOCK_DELAY_NOP8::: "memory");
37 case 6: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 38 case 11:
38 case 5: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 39 asm volatile(CLOCK_DELAY_NOP8::: "memory");
39 case 4: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 40 case 10:
40 case 3: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 41 asm volatile(CLOCK_DELAY_NOP8::: "memory");
41 case 2: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 42 case 9:
42 case 1: asm volatile (CLOCK_DELAY_NOP8::: "memory"); 43 asm volatile(CLOCK_DELAY_NOP8::: "memory");
43 case 0: break; 44 case 8:
45 asm volatile(CLOCK_DELAY_NOP8::: "memory");
46 case 7:
47 asm volatile(CLOCK_DELAY_NOP8::: "memory");
48 case 6:
49 asm volatile(CLOCK_DELAY_NOP8::: "memory");
50 case 5:
51 asm volatile(CLOCK_DELAY_NOP8::: "memory");
52 case 4:
53 asm volatile(CLOCK_DELAY_NOP8::: "memory");
54 case 3:
55 asm volatile(CLOCK_DELAY_NOP8::: "memory");
56 case 2:
57 asm volatile(CLOCK_DELAY_NOP8::: "memory");
58 case 1:
59 asm volatile(CLOCK_DELAY_NOP8::: "memory");
60 case 0:
61 break;
44 } 62 }
45 } 63 }
46 switch (n) { 64 switch (n) {
47 case 8: asm volatile ("nop"::: "memory"); 65 case 8:
48 case 7: asm volatile ("nop"::: "memory"); 66 asm volatile("nop" ::: "memory");
49 case 6: asm volatile ("nop"::: "memory"); 67 case 7:
50 case 5: asm volatile ("nop"::: "memory"); 68 asm volatile("nop" ::: "memory");
51 case 4: asm volatile ("nop"::: "memory"); 69 case 6:
52 case 3: asm volatile ("nop"::: "memory"); 70 asm volatile("nop" ::: "memory");
53 case 2: asm volatile ("nop"::: "memory"); 71 case 5:
54 case 1: asm volatile ("nop"::: "memory"); 72 asm volatile("nop" ::: "memory");
55 case 0: break; 73 case 4:
74 asm volatile("nop" ::: "memory");
75 case 3:
76 asm volatile("nop" ::: "memory");
77 case 2:
78 asm volatile("nop" ::: "memory");
79 case 1:
80 asm volatile("nop" ::: "memory");
81 case 0:
82 break;
56 } 83 }
57} 84}
58#endif 85#endif