qmk cformat
This commit is contained in:
parent
e702c7f1b4
commit
31c57aab35
9 changed files with 136 additions and 113 deletions
|
@ -134,9 +134,7 @@ static uint8_t move_unit(void) {
|
||||||
speed = mousekey_accel & (1 << 2) ? mk_accelerated_speed : mk_decelerated_speed;
|
speed = mousekey_accel & (1 << 2) ? mk_accelerated_speed : mk_decelerated_speed;
|
||||||
} else if (mousekey_repeat && mouse_timer) {
|
} else if (mousekey_repeat && mouse_timer) {
|
||||||
const float time_elapsed = timer_elapsed(mouse_timer) / 50;
|
const float time_elapsed = timer_elapsed(mouse_timer) / 50;
|
||||||
speed = mk_initial_speed +
|
speed = mk_initial_speed + MOUSEKEY_MOVE_DELTA * time_elapsed + MOUSEKEY_MOVE_DELTA * 0.5 * time_elapsed * time_elapsed;
|
||||||
MOUSEKEY_MOVE_DELTA * time_elapsed +
|
|
||||||
MOUSEKEY_MOVE_DELTA * 0.5 * time_elapsed * time_elapsed;
|
|
||||||
|
|
||||||
speed = speed > mk_base_speed ? mk_base_speed : speed;
|
speed = speed > mk_base_speed ? mk_base_speed : speed;
|
||||||
}
|
}
|
||||||
|
@ -158,9 +156,7 @@ static uint8_t wheel_unit(void) {
|
||||||
} else if (mousekey_repeat && mouse_timer) {
|
} else if (mousekey_repeat && mouse_timer) {
|
||||||
if (mk_wheel_interval != MOUSEKEY_WHEEL_BASE_MOVEMENTS) {
|
if (mk_wheel_interval != MOUSEKEY_WHEEL_BASE_MOVEMENTS) {
|
||||||
const float time_elapsed = timer_elapsed(mouse_timer) / 50;
|
const float time_elapsed = timer_elapsed(mouse_timer) / 50;
|
||||||
speed = MOUSEKEY_WHEEL_INITIAL_MOVEMENTS +
|
speed = MOUSEKEY_WHEEL_INITIAL_MOVEMENTS + 1 * time_elapsed + 1 * 0.5 * time_elapsed * time_elapsed;
|
||||||
1 * time_elapsed +
|
|
||||||
1 * 0.5 * time_elapsed * time_elapsed;
|
|
||||||
}
|
}
|
||||||
speed = speed > MOUSEKEY_WHEEL_BASE_MOVEMENTS ? MOUSEKEY_WHEEL_BASE_MOVEMENTS : speed;
|
speed = speed > MOUSEKEY_WHEEL_BASE_MOVEMENTS ? MOUSEKEY_WHEEL_BASE_MOVEMENTS : speed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,44 +15,71 @@ extern "C" {
|
||||||
|
|
||||||
# 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"
|
# 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"
|
||||||
|
|
||||||
__attribute__((always_inline))
|
__attribute__((always_inline)) static inline void wait_cpuclock_allnop(unsigned int n) { /* n: 1..135 */
|
||||||
static inline void wait_cpuclock_allnop(unsigned int n) { /* n: 1..135 */
|
|
||||||
/* The argument n must be a constant expression.
|
/* The argument n must be a constant expression.
|
||||||
* That way, compiler optimization will remove unnecessary code. */
|
* That way, compiler optimization will remove unnecessary code. */
|
||||||
if (n < 1) { return; }
|
if (n < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (n > 8) {
|
if (n > 8) {
|
||||||
unsigned int n8 = n / 8;
|
unsigned int n8 = n / 8;
|
||||||
n = n - n8 * 8;
|
n = n - n8 * 8;
|
||||||
switch (n8) {
|
switch (n8) {
|
||||||
case 16: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
case 16:
|
||||||
case 15: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
case 14: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
case 15:
|
||||||
case 13: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
case 12: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
case 14:
|
||||||
case 11: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
case 10: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
case 13:
|
||||||
case 9: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
case 8: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
case 12:
|
||||||
case 7: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
case 6: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
case 11:
|
||||||
case 5: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
case 4: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
case 10:
|
||||||
case 3: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
case 2: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
case 9:
|
||||||
case 1: asm volatile (CLOCK_DELAY_NOP8::: "memory");
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
case 0: break;
|
case 8:
|
||||||
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
|
case 7:
|
||||||
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
|
case 6:
|
||||||
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
|
case 5:
|
||||||
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
|
case 4:
|
||||||
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
|
case 3:
|
||||||
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
|
case 2:
|
||||||
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
|
case 1:
|
||||||
|
asm volatile(CLOCK_DELAY_NOP8::: "memory");
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 8: asm volatile ("nop"::: "memory");
|
case 8:
|
||||||
case 7: asm volatile ("nop"::: "memory");
|
asm volatile("nop" ::: "memory");
|
||||||
case 6: asm volatile ("nop"::: "memory");
|
case 7:
|
||||||
case 5: asm volatile ("nop"::: "memory");
|
asm volatile("nop" ::: "memory");
|
||||||
case 4: asm volatile ("nop"::: "memory");
|
case 6:
|
||||||
case 3: asm volatile ("nop"::: "memory");
|
asm volatile("nop" ::: "memory");
|
||||||
case 2: asm volatile ("nop"::: "memory");
|
case 5:
|
||||||
case 1: asm volatile ("nop"::: "memory");
|
asm volatile("nop" ::: "memory");
|
||||||
case 0: break;
|
case 4:
|
||||||
|
asm volatile("nop" ::: "memory");
|
||||||
|
case 3:
|
||||||
|
asm volatile("nop" ::: "memory");
|
||||||
|
case 2:
|
||||||
|
asm volatile("nop" ::: "memory");
|
||||||
|
case 1:
|
||||||
|
asm volatile("nop" ::: "memory");
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue