aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2020-08-29 22:57:48 +0000
committerQMK Bot <hello@qmk.fm>2020-08-29 22:57:48 +0000
commita3db72df7299140e52f57d082a3742a8b480a226 (patch)
tree41d62db0fecd2eb0aeae1744b52e677555e55288
parent000eb14d789f84afc7dbd33955dbfb6481792f0b (diff)
downloadqmk_firmware-a3db72df7299140e52f57d082a3742a8b480a226.tar.gz
qmk_firmware-a3db72df7299140e52f57d082a3742a8b480a226.zip
format code according to conventions [skip ci]
-rw-r--r--drivers/oled/oled_driver.c2
-rw-r--r--drivers/oled/oled_driver.h2
-rw-r--r--keyboards/handwired/onekey/keymaps/joystick/config.h2
-rw-r--r--keyboards/handwired/onekey/keymaps/joystick/rules.mk2
-rw-r--r--quantum/process_keycode/process_auto_shift.c35
-rw-r--r--quantum/process_keycode/process_combo.c4
-rw-r--r--quantum/process_keycode/process_joystick.c42
-rw-r--r--quantum/rgblight.c12
-rw-r--r--tmk_core/common/action_layer.h7
-rw-r--r--tmk_core/common/mousekey.c19
-rw-r--r--tmk_core/common/progmem.h2
-rw-r--r--tmk_core/protocol/chibios/usb_main.c28
-rw-r--r--tmk_core/protocol/lufa/adafruit_ble.h4
-rw-r--r--tmk_core/protocol/lufa/lufa.c28
14 files changed, 93 insertions, 96 deletions
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c
index bbf010a09..9ae737ca2 100644
--- a/drivers/oled/oled_driver.c
+++ b/drivers/oled/oled_driver.c
@@ -447,7 +447,7 @@ void oled_pan(bool left) {
447oled_buffer_reader_t oled_read_raw(uint16_t start_index) { 447oled_buffer_reader_t oled_read_raw(uint16_t start_index) {
448 if (start_index > OLED_MATRIX_SIZE) start_index = OLED_MATRIX_SIZE; 448 if (start_index > OLED_MATRIX_SIZE) start_index = OLED_MATRIX_SIZE;
449 oled_buffer_reader_t ret_reader; 449 oled_buffer_reader_t ret_reader;
450 ret_reader.current_element = &oled_buffer[start_index]; 450 ret_reader.current_element = &oled_buffer[start_index];
451 ret_reader.remaining_element_count = OLED_MATRIX_SIZE - start_index; 451 ret_reader.remaining_element_count = OLED_MATRIX_SIZE - start_index;
452 return ret_reader; 452 return ret_reader;
453} 453}
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index 7ec00d66a..9a4b98d2f 100644
--- a/drivers/oled/oled_driver.h
+++ b/drivers/oled/oled_driver.h
@@ -155,7 +155,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
155#endif 155#endif
156 156
157typedef struct __attribute__((__packed__)) { 157typedef struct __attribute__((__packed__)) {
158 uint8_t *current_element; 158 uint8_t *current_element;
159 uint16_t remaining_element_count; 159 uint16_t remaining_element_count;
160} oled_buffer_reader_t; 160} oled_buffer_reader_t;
161 161
diff --git a/keyboards/handwired/onekey/keymaps/joystick/config.h b/keyboards/handwired/onekey/keymaps/joystick/config.h
index ac09aa7cf..a3b5858ad 100644
--- a/keyboards/handwired/onekey/keymaps/joystick/config.h
+++ b/keyboards/handwired/onekey/keymaps/joystick/config.h
@@ -1,4 +1,4 @@
1#pragma once 1#pragma once
2 2
3#define JOYSTICK_AXES_COUNT 2 3#define JOYSTICK_AXES_COUNT 2
4#define JOYSTICK_BUTTON_COUNT 1 4#define JOYSTICK_BUTTON_COUNT 1
diff --git a/keyboards/handwired/onekey/keymaps/joystick/rules.mk b/keyboards/handwired/onekey/keymaps/joystick/rules.mk
index cf0348173..b910bdbe6 100644
--- a/keyboards/handwired/onekey/keymaps/joystick/rules.mk
+++ b/keyboards/handwired/onekey/keymaps/joystick/rules.mk
@@ -1 +1 @@
JOYSTICK_ENABLE = analog JOYSTICK_ENABLE = analog
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c
index 330037cef..b1267922c 100644
--- a/quantum/process_keycode/process_auto_shift.c
+++ b/quantum/process_keycode/process_auto_shift.c
@@ -41,34 +41,34 @@ void autoshift_flush(void) {
41} 41}
42 42
43void autoshift_on(uint16_t keycode) { 43void autoshift_on(uint16_t keycode) {
44 autoshift_time = timer_read(); 44 autoshift_time = timer_read();
45 autoshift_lastkey = keycode; 45 autoshift_lastkey = keycode;
46} 46}
47 47
48void autoshift_toggle(void) { 48void autoshift_toggle(void) {
49 if (autoshift_enabled) { 49 if (autoshift_enabled) {
50 autoshift_enabled = false; 50 autoshift_enabled = false;
51 autoshift_flush(); 51 autoshift_flush();
52 } else { 52 } else {
53 autoshift_enabled = true; 53 autoshift_enabled = true;
54 } 54 }
55} 55}
56 56
57void autoshift_enable(void) { autoshift_enabled = true; } 57void autoshift_enable(void) { autoshift_enabled = true; }
58void autoshift_disable(void) { 58void autoshift_disable(void) {
59 autoshift_enabled = false; 59 autoshift_enabled = false;
60 autoshift_flush(); 60 autoshift_flush();
61} 61}
62 62
63#ifndef AUTO_SHIFT_NO_SETUP 63# ifndef AUTO_SHIFT_NO_SETUP
64void autoshift_timer_report(void) { 64void autoshift_timer_report(void) {
65 char display[8]; 65 char display[8];
66 66
67 snprintf(display, 8, "\n%d\n", autoshift_timeout); 67 snprintf(display, 8, "\n%d\n", autoshift_timeout);
68 68
69 send_string((const char *)display); 69 send_string((const char *)display);
70} 70}
71#endif 71# endif
72 72
73bool get_autoshift_state(void) { return autoshift_enabled; } 73bool get_autoshift_state(void) { return autoshift_enabled; }
74 74
@@ -79,7 +79,6 @@ void set_autoshift_timeout(uint16_t timeout) { autoshift_timeout = timeout; }
79bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { 79bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
80 if (record->event.pressed) { 80 if (record->event.pressed) {
81 switch (keycode) { 81 switch (keycode) {
82
83 case KC_ASTG: 82 case KC_ASTG:
84 autoshift_toggle(); 83 autoshift_toggle();
85 return true; 84 return true;
@@ -92,10 +91,10 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) {
92 return true; 91 return true;
93 92
94# ifndef AUTO_SHIFT_NO_SETUP 93# ifndef AUTO_SHIFT_NO_SETUP
95 case KC_ASUP: 94 case KC_ASUP:
96 autoshift_timeout += 5; 95 autoshift_timeout += 5;
97 return true; 96 return true;
98 case KC_ASDN: 97 case KC_ASDN:
99 autoshift_timeout -= 5; 98 autoshift_timeout -= 5;
100 return true; 99 return true;
101 100
diff --git a/quantum/process_keycode/process_combo.c b/quantum/process_keycode/process_combo.c
index 1f715f43b..f38d7d47a 100644
--- a/quantum/process_keycode/process_combo.c
+++ b/quantum/process_keycode/process_combo.c
@@ -27,7 +27,7 @@ extern int COMBO_LEN;
27__attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {} 27__attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {}
28 28
29static uint16_t timer = 0; 29static uint16_t timer = 0;
30static uint16_t current_combo_index = 0; 30static uint16_t current_combo_index = 0;
31static bool drop_buffer = false; 31static bool drop_buffer = false;
32static bool is_active = false; 32static bool is_active = false;
33static bool b_combo_enable = true; // defaults to enabled 33static bool b_combo_enable = true; // defaults to enabled
@@ -82,7 +82,7 @@ static inline void dump_key_buffer(bool emit) {
82 } while (0) 82 } while (0)
83 83
84static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record) { 84static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record) {
85 uint8_t count = 0; 85 uint8_t count = 0;
86 uint16_t index = -1; 86 uint16_t index = -1;
87 /* Find index of keycode and number of combo keys */ 87 /* Find index of keycode and number of combo keys */
88 for (const uint16_t *keys = combo->keys;; ++count) { 88 for (const uint16_t *keys = combo->keys;; ++count) {
diff --git a/quantum/process_keycode/process_joystick.c b/quantum/process_keycode/process_joystick.c
index c12f75685..5778a7434 100644
--- a/quantum/process_keycode/process_joystick.c
+++ b/quantum/process_keycode/process_joystick.c
@@ -17,8 +17,7 @@ bool process_joystick(uint16_t keycode, keyrecord_t *record) {
17 return true; 17 return true;
18} 18}
19 19
20__attribute__((weak)) 20__attribute__((weak)) void joystick_task(void) {
21void joystick_task(void) {
22 if (process_joystick_analogread() && (joystick_status.status & JS_UPDATED)) { 21 if (process_joystick_analogread() && (joystick_status.status & JS_UPDATED)) {
23 send_joystick_packet(&joystick_status); 22 send_joystick_packet(&joystick_status);
24 joystick_status.status &= ~JS_UPDATED; 23 joystick_status.status &= ~JS_UPDATED;
@@ -47,16 +46,11 @@ uint16_t savePinState(pin_t pin) {
47 return ((PORTx_ADDRESS(pin) >> pinNumber) & 0x1) << 1 | ((DDRx_ADDRESS(pin) >> pinNumber) & 0x1); 46 return ((PORTx_ADDRESS(pin) >> pinNumber) & 0x1) << 1 | ((DDRx_ADDRESS(pin) >> pinNumber) & 0x1);
48#elif defined(PROTOCOL_CHIBIOS) 47#elif defined(PROTOCOL_CHIBIOS)
49 /* 48 /*
50 The pin configuration is backed up in the following format : 49 The pin configuration is backed up in the following format :
51 bit 15 9 8 7 6 5 4 3 2 1 0 50 bit 15 9 8 7 6 5 4 3 2 1 0
52 |unused|ODR|IDR|PUPDR|OSPEEDR|OTYPER|MODER| 51 |unused|ODR|IDR|PUPDR|OSPEEDR|OTYPER|MODER|
53 */ 52 */
54 return (( PAL_PORT(pin)->MODER >> (2*PAL_PAD(pin))) & 0x3) 53 return ((PAL_PORT(pin)->MODER >> (2 * PAL_PAD(pin))) & 0x3) | (((PAL_PORT(pin)->OTYPER >> (1 * PAL_PAD(pin))) & 0x1) << 2) | (((PAL_PORT(pin)->OSPEEDR >> (2 * PAL_PAD(pin))) & 0x3) << 3) | (((PAL_PORT(pin)->PUPDR >> (2 * PAL_PAD(pin))) & 0x3) << 5) | (((PAL_PORT(pin)->IDR >> (1 * PAL_PAD(pin))) & 0x1) << 7) | (((PAL_PORT(pin)->ODR >> (1 * PAL_PAD(pin))) & 0x1) << 8);
55 | (((PAL_PORT(pin)->OTYPER >> (1*PAL_PAD(pin))) & 0x1) << 2)
56 | (((PAL_PORT(pin)->OSPEEDR >> (2*PAL_PAD(pin))) & 0x3) << 3)
57 | (((PAL_PORT(pin)->PUPDR >> (2*PAL_PAD(pin))) & 0x3) << 5)
58 | (((PAL_PORT(pin)->IDR >> (1*PAL_PAD(pin))) & 0x1) << 7)
59 | (((PAL_PORT(pin)->ODR >> (1*PAL_PAD(pin))) & 0x1) << 8);
60#else 54#else
61 return 0; 55 return 0;
62#endif 56#endif
@@ -68,12 +62,12 @@ void restorePinState(pin_t pin, uint16_t restoreState) {
68 PORTx_ADDRESS(pin) = (PORTx_ADDRESS(pin) & ~_BV(pinNumber)) | (((restoreState >> 1) & 0x1) << pinNumber); 62 PORTx_ADDRESS(pin) = (PORTx_ADDRESS(pin) & ~_BV(pinNumber)) | (((restoreState >> 1) & 0x1) << pinNumber);
69 DDRx_ADDRESS(pin) = (DDRx_ADDRESS(pin) & ~_BV(pinNumber)) | ((restoreState & 0x1) << pinNumber); 63 DDRx_ADDRESS(pin) = (DDRx_ADDRESS(pin) & ~_BV(pinNumber)) | ((restoreState & 0x1) << pinNumber);
70#elif defined(PROTOCOL_CHIBIOS) 64#elif defined(PROTOCOL_CHIBIOS)
71 PAL_PORT(pin)->MODER = (PAL_PORT(pin)->MODER & ~(0x3<< (2*PAL_PAD(pin)))) | (restoreState & 0x3) << (2*PAL_PAD(pin)); 65 PAL_PORT(pin)->MODER = (PAL_PORT(pin)->MODER & ~(0x3 << (2 * PAL_PAD(pin)))) | (restoreState & 0x3) << (2 * PAL_PAD(pin));
72 PAL_PORT(pin)->OTYPER = (PAL_PORT(pin)->OTYPER & ~(0x1<< (1*PAL_PAD(pin)))) | ((restoreState>>2) & 0x1) << (1*PAL_PAD(pin)); 66 PAL_PORT(pin)->OTYPER = (PAL_PORT(pin)->OTYPER & ~(0x1 << (1 * PAL_PAD(pin)))) | ((restoreState >> 2) & 0x1) << (1 * PAL_PAD(pin));
73 PAL_PORT(pin)->OSPEEDR= (PAL_PORT(pin)->OSPEEDR & ~(0x3<< (2*PAL_PAD(pin)))) | ((restoreState>>3) & 0x3) << (2*PAL_PAD(pin)); 67 PAL_PORT(pin)->OSPEEDR = (PAL_PORT(pin)->OSPEEDR & ~(0x3 << (2 * PAL_PAD(pin)))) | ((restoreState >> 3) & 0x3) << (2 * PAL_PAD(pin));
74 PAL_PORT(pin)->PUPDR = (PAL_PORT(pin)->PUPDR & ~(0x3<< (2*PAL_PAD(pin)))) | ((restoreState>>5) & 0x3) << (2*PAL_PAD(pin)); 68 PAL_PORT(pin)->PUPDR = (PAL_PORT(pin)->PUPDR & ~(0x3 << (2 * PAL_PAD(pin)))) | ((restoreState >> 5) & 0x3) << (2 * PAL_PAD(pin));
75 PAL_PORT(pin)->IDR = (PAL_PORT(pin)->IDR & ~(0x1<< (1*PAL_PAD(pin)))) | ((restoreState>>7) & 0x1) << (1*PAL_PAD(pin)); 69 PAL_PORT(pin)->IDR = (PAL_PORT(pin)->IDR & ~(0x1 << (1 * PAL_PAD(pin)))) | ((restoreState >> 7) & 0x1) << (1 * PAL_PAD(pin));
76 PAL_PORT(pin)->ODR = (PAL_PORT(pin)->ODR & ~(0x1<< (1*PAL_PAD(pin)))) | ((restoreState>>8) & 0x1) << (1*PAL_PAD(pin)); 70 PAL_PORT(pin)->ODR = (PAL_PORT(pin)->ODR & ~(0x1 << (1 * PAL_PAD(pin)))) | ((restoreState >> 8) & 0x1) << (1 * PAL_PAD(pin));
77#else 71#else
78 return; 72 return;
79#endif 73#endif
@@ -132,21 +126,21 @@ bool process_joystick_analogread_quantum() {
132 int16_t axis_val = joystick_axes[axis_index].mid_digit; 126 int16_t axis_val = joystick_axes[axis_index].mid_digit;
133# endif 127# endif
134 128
135 //test the converted value against the lower range 129 // test the converted value against the lower range
136 int32_t ref = joystick_axes[axis_index].mid_digit; 130 int32_t ref = joystick_axes[axis_index].mid_digit;
137 int32_t range = joystick_axes[axis_index].min_digit; 131 int32_t range = joystick_axes[axis_index].min_digit;
138 int32_t ranged_val = ((axis_val - ref) * -127) / (range - ref) ; 132 int32_t ranged_val = ((axis_val - ref) * -127) / (range - ref);
139 133
140 if (ranged_val > 0) { 134 if (ranged_val > 0) {
141 //the value is in the higher range 135 // the value is in the higher range
142 range = joystick_axes[axis_index].max_digit; 136 range = joystick_axes[axis_index].max_digit;
143 ranged_val = ((axis_val - ref) * 127) / (range - ref); 137 ranged_val = ((axis_val - ref) * 127) / (range - ref);
144 } 138 }
145 139
146 //clamp the result in the valid range 140 // clamp the result in the valid range
147 ranged_val = ranged_val < -127 ? -127 : ranged_val; 141 ranged_val = ranged_val < -127 ? -127 : ranged_val;
148 ranged_val = ranged_val > 127 ? 127 : ranged_val; 142 ranged_val = ranged_val > 127 ? 127 : ranged_val;
149 143
150 if (ranged_val != joystick_status.axes[axis_index]) { 144 if (ranged_val != joystick_status.axes[axis_index]) {
151 joystick_status.axes[axis_index] = ranged_val; 145 joystick_status.axes[axis_index] = ranged_val;
152 joystick_status.status |= JS_UPDATED; 146 joystick_status.status |= JS_UPDATED;
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 52d8da181..211ec975a 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -407,7 +407,6 @@ void rgblight_decrease_val_helper(bool write_to_eeprom) {
407void rgblight_decrease_val_noeeprom(void) { rgblight_decrease_val_helper(false); } 407void rgblight_decrease_val_noeeprom(void) { rgblight_decrease_val_helper(false); }
408void rgblight_decrease_val(void) { rgblight_decrease_val_helper(true); } 408void rgblight_decrease_val(void) { rgblight_decrease_val_helper(true); }
409 409
410
411void rgblight_increase_speed_helper(bool write_to_eeprom) { 410void rgblight_increase_speed_helper(bool write_to_eeprom) {
412 if (rgblight_config.speed < 3) rgblight_config.speed++; 411 if (rgblight_config.speed < 3) rgblight_config.speed++;
413 // RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED? 412 // RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED?
@@ -428,7 +427,6 @@ void rgblight_decrease_speed_helper(bool write_to_eeprom) {
428void rgblight_decrease_speed(void) { rgblight_decrease_speed_helper(true); } 427void rgblight_decrease_speed(void) { rgblight_decrease_speed_helper(true); }
429void rgblight_decrease_speed_noeeprom(void) { rgblight_decrease_speed_helper(false); } 428void rgblight_decrease_speed_noeeprom(void) { rgblight_decrease_speed_helper(false); }
430 429
431
432void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) { 430void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) {
433 if (rgblight_config.enable) { 431 if (rgblight_config.enable) {
434 LED_TYPE tmp_led; 432 LED_TYPE tmp_led;
@@ -1170,17 +1168,17 @@ void rgblight_effect_knight(animation_status_t *anim) {
1170 */ 1168 */
1171void rgblight_effect_christmas(animation_status_t *anim) { 1169void rgblight_effect_christmas(animation_status_t *anim) {
1172 static int8_t increment = 1; 1170 static int8_t increment = 1;
1173 const uint8_t max_pos = 32; 1171 const uint8_t max_pos = 32;
1174 const uint8_t hue_green = 85; 1172 const uint8_t hue_green = 85;
1175 1173
1176 uint32_t xa; 1174 uint32_t xa;
1177 uint8_t hue, val; 1175 uint8_t hue, val;
1178 uint8_t i; 1176 uint8_t i;
1179 1177
1180 // The effect works by animating anim->pos from 0 to 32 and back to 0. 1178 // The effect works by animating anim->pos from 0 to 32 and back to 0.
1181 // The pos is used in a cubic bezier formula to ease-in-out between red and green, leaving the interpolated colors visible as short as possible. 1179 // The pos is used in a cubic bezier formula to ease-in-out between red and green, leaving the interpolated colors visible as short as possible.
1182 xa = CUBED((uint32_t) anim->pos); 1180 xa = CUBED((uint32_t)anim->pos);
1183 hue = ((uint32_t) hue_green) * xa / (xa + CUBED((uint32_t) (max_pos - anim->pos))); 1181 hue = ((uint32_t)hue_green) * xa / (xa + CUBED((uint32_t)(max_pos - anim->pos)));
1184 // Additionally, these interpolated colors get shown with a slightly darker value, to make them less prominent than the main colors. 1182 // Additionally, these interpolated colors get shown with a slightly darker value, to make them less prominent than the main colors.
1185 val = 255 - (3 * (hue < hue_green / 2 ? hue : hue_green - hue) / 2); 1183 val = 255 - (3 * (hue < hue_green / 2 ? hue : hue_green - hue) / 2);
1186 1184
diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h
index 9b9173c33..f9f686112 100644
--- a/tmk_core/common/action_layer.h
+++ b/tmk_core/common/action_layer.h
@@ -82,9 +82,9 @@ void layer_on(uint8_t layer);
82void layer_off(uint8_t layer); 82void layer_off(uint8_t layer);
83void layer_invert(uint8_t layer); 83void layer_invert(uint8_t layer);
84/* bitwise operation */ 84/* bitwise operation */
85void layer_or(layer_state_t state); 85void layer_or(layer_state_t state);
86void layer_and(layer_state_t state); 86void layer_and(layer_state_t state);
87void layer_xor(layer_state_t state); 87void layer_xor(layer_state_t state);
88layer_state_t layer_state_set_user(layer_state_t state); 88layer_state_t layer_state_set_user(layer_state_t state);
89layer_state_t layer_state_set_kb(layer_state_t state); 89layer_state_t layer_state_set_kb(layer_state_t state);
90#else 90#else
@@ -107,7 +107,6 @@ layer_state_t layer_state_set_kb(layer_state_t state);
107# define layer_state_set_user(state) (void)state 107# define layer_state_set_user(state) (void)state
108#endif 108#endif
109 109
110
111/* pressed actions cache */ 110/* pressed actions cache */
112#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE) 111#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)
113 112
diff --git a/tmk_core/common/mousekey.c b/tmk_core/common/mousekey.c
index 390c74e0f..ef18bcf1a 100644
--- a/tmk_core/common/mousekey.c
+++ b/tmk_core/common/mousekey.c
@@ -33,8 +33,8 @@ inline int8_t times_inv_sqrt2(int8_t x) {
33 33
34static report_mouse_t mouse_report = {0}; 34static report_mouse_t mouse_report = {0};
35static void mousekey_debug(void); 35static void mousekey_debug(void);
36static uint8_t mousekey_accel = 0; 36static 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 39
40#ifndef MK_3_SPEED 40#ifndef MK_3_SPEED
@@ -225,7 +225,6 @@ void mousekey_on(uint8_t code) {
225 mousekey_accel |= (1 << 1); 225 mousekey_accel |= (1 << 1);
226 else if (code == KC_MS_ACCEL2) 226 else if (code == KC_MS_ACCEL2)
227 mousekey_accel |= (1 << 2); 227 mousekey_accel |= (1 << 2);
228
229} 228}
230 229
231void mousekey_off(uint8_t code) { 230void mousekey_off(uint8_t code) {
@@ -284,10 +283,10 @@ uint16_t w_intervals[mkspd_COUNT] = {MK_W_INTERVAL_UNMOD, MK_W_INTERVAL_0
284void mousekey_task(void) { 283void mousekey_task(void) {
285 // report cursor and scroll movement independently 284 // report cursor and scroll movement independently
286 report_mouse_t const tmpmr = mouse_report; 285 report_mouse_t const tmpmr = mouse_report;
287 mouse_report.x = 0; 286 mouse_report.x = 0;
288 mouse_report.y = 0; 287 mouse_report.y = 0;
289 mouse_report.v = 0; 288 mouse_report.v = 0;
290 mouse_report.h = 0; 289 mouse_report.h = 0;
291 290
292 if ((tmpmr.x || tmpmr.y) && timer_elapsed(last_timer_c) > c_intervals[mk_speed]) { 291 if ((tmpmr.x || tmpmr.y) && timer_elapsed(last_timer_c) > c_intervals[mk_speed]) {
293 mouse_report.x = tmpmr.x; 292 mouse_report.x = tmpmr.x;
@@ -421,10 +420,10 @@ void mousekey_send(void) {
421} 420}
422 421
423void mousekey_clear(void) { 422void mousekey_clear(void) {
424 mouse_report = (report_mouse_t){}; 423 mouse_report = (report_mouse_t){};
425 mousekey_repeat = 0; 424 mousekey_repeat = 0;
426 mousekey_wheel_repeat = 0; 425 mousekey_wheel_repeat = 0;
427 mousekey_accel = 0; 426 mousekey_accel = 0;
428} 427}
429 428
430static void mousekey_debug(void) { 429static void mousekey_debug(void) {
diff --git a/tmk_core/common/progmem.h b/tmk_core/common/progmem.h
index 41b5b537c..c8863d3ad 100644
--- a/tmk_core/common/progmem.h
+++ b/tmk_core/common/progmem.h
@@ -4,7 +4,7 @@
4# include <avr/pgmspace.h> 4# include <avr/pgmspace.h>
5#else 5#else
6# define PROGMEM 6# define PROGMEM
7# define PGM_P const char * 7# define PGM_P const char*
8# define memcpy_P(dest, src, n) memcpy(dest, src, n) 8# define memcpy_P(dest, src, n) memcpy(dest, src, n)
9# define pgm_read_byte(address_short) *((uint8_t*)(address_short)) 9# define pgm_read_byte(address_short) *((uint8_t*)(address_short))
10# define pgm_read_word(address_short) *((uint16_t*)(address_short)) 10# define pgm_read_word(address_short) *((uint16_t*)(address_short))
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index 68c61cf55..ae33e86a7 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -888,39 +888,43 @@ void virtser_task(void) {
888void send_joystick_packet(joystick_t *joystick) { 888void send_joystick_packet(joystick_t *joystick) {
889 joystick_report_t rep = { 889 joystick_report_t rep = {
890# if JOYSTICK_AXES_COUNT > 0 890# if JOYSTICK_AXES_COUNT > 0
891 .axes = {joystick->axes[0], 891 .axes =
892 {
893 joystick->axes[0],
892 894
893# if JOYSTICK_AXES_COUNT >= 2 895# if JOYSTICK_AXES_COUNT >= 2
894 joystick->axes[1], 896 joystick->axes[1],
895# endif 897# endif
896# if JOYSTICK_AXES_COUNT >= 3 898# if JOYSTICK_AXES_COUNT >= 3
897 joystick->axes[2], 899 joystick->axes[2],
898# endif 900# endif
899# if JOYSTICK_AXES_COUNT >= 4 901# if JOYSTICK_AXES_COUNT >= 4
900 joystick->axes[3], 902 joystick->axes[3],
901# endif 903# endif
902# if JOYSTICK_AXES_COUNT >= 5 904# if JOYSTICK_AXES_COUNT >= 5
903 joystick->axes[4], 905 joystick->axes[4],
904# endif 906# endif
905# if JOYSTICK_AXES_COUNT >= 6 907# if JOYSTICK_AXES_COUNT >= 6
906 joystick->axes[5], 908 joystick->axes[5],
907# endif 909# endif
908 }, 910 },
909# endif // JOYSTICK_AXES_COUNT>0 911# endif // JOYSTICK_AXES_COUNT>0
910 912
911# if JOYSTICK_BUTTON_COUNT > 0 913# if JOYSTICK_BUTTON_COUNT > 0
912 .buttons = {joystick->buttons[0], 914 .buttons =
915 {
916 joystick->buttons[0],
913 917
914# if JOYSTICK_BUTTON_COUNT > 8 918# if JOYSTICK_BUTTON_COUNT > 8
915 joystick->buttons[1], 919 joystick->buttons[1],
916# endif 920# endif
917# if JOYSTICK_BUTTON_COUNT > 16 921# if JOYSTICK_BUTTON_COUNT > 16
918 joystick->buttons[2], 922 joystick->buttons[2],
919# endif 923# endif
920# if JOYSTICK_BUTTON_COUNT > 24 924# if JOYSTICK_BUTTON_COUNT > 24
921 joystick->buttons[3], 925 joystick->buttons[3],
922# endif 926# endif
923 } 927 }
924# endif // JOYSTICK_BUTTON_COUNT>0 928# endif // JOYSTICK_BUTTON_COUNT>0
925 }; 929 };
926 930
diff --git a/tmk_core/protocol/lufa/adafruit_ble.h b/tmk_core/protocol/lufa/adafruit_ble.h
index aebded7b3..9dfc9b435 100644
--- a/tmk_core/protocol/lufa/adafruit_ble.h
+++ b/tmk_core/protocol/lufa/adafruit_ble.h
@@ -41,12 +41,12 @@ extern bool adafruit_ble_send_keys(uint8_t hid_modifier_mask, uint8_t *keys, uin
41 * (milliseconds) */ 41 * (milliseconds) */
42extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration); 42extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration);
43 43
44# ifdef MOUSE_ENABLE 44#ifdef MOUSE_ENABLE
45/* Send a mouse/wheel movement report. 45/* Send a mouse/wheel movement report.
46 * The parameters are signed and indicate positive of negative direction 46 * The parameters are signed and indicate positive of negative direction
47 * change. */ 47 * change. */
48extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons); 48extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll, int8_t pan, uint8_t buttons);
49# endif 49#endif
50 50
51/* Compute battery voltage by reading an analog pin. 51/* Compute battery voltage by reading an analog pin.
52 * Returns the integer number of millivolts */ 52 * Returns the integer number of millivolts */
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 09ba0bacf..cec004402 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -316,39 +316,43 @@ void send_joystick_packet(joystick_t *joystick) {
316 316
317 joystick_report_t r = { 317 joystick_report_t r = {
318# if JOYSTICK_AXES_COUNT > 0 318# if JOYSTICK_AXES_COUNT > 0
319 .axes = {joystick->axes[0], 319 .axes =
320 {
321 joystick->axes[0],
320 322
321# if JOYSTICK_AXES_COUNT >= 2 323# if JOYSTICK_AXES_COUNT >= 2
322 joystick->axes[1], 324 joystick->axes[1],
323# endif 325# endif
324# if JOYSTICK_AXES_COUNT >= 3 326# if JOYSTICK_AXES_COUNT >= 3
325 joystick->axes[2], 327 joystick->axes[2],
326# endif 328# endif
327# if JOYSTICK_AXES_COUNT >= 4 329# if JOYSTICK_AXES_COUNT >= 4
328 joystick->axes[3], 330 joystick->axes[3],
329# endif 331# endif
330# if JOYSTICK_AXES_COUNT >= 5 332# if JOYSTICK_AXES_COUNT >= 5
331 joystick->axes[4], 333 joystick->axes[4],
332# endif 334# endif
333# if JOYSTICK_AXES_COUNT >= 6 335# if JOYSTICK_AXES_COUNT >= 6
334 joystick->axes[5], 336 joystick->axes[5],
335# endif 337# endif
336 }, 338 },
337# endif // JOYSTICK_AXES_COUNT>0 339# endif // JOYSTICK_AXES_COUNT>0
338 340
339# if JOYSTICK_BUTTON_COUNT > 0 341# if JOYSTICK_BUTTON_COUNT > 0
340 .buttons = {joystick->buttons[0], 342 .buttons =
343 {
344 joystick->buttons[0],
341 345
342# if JOYSTICK_BUTTON_COUNT > 8 346# if JOYSTICK_BUTTON_COUNT > 8
343 joystick->buttons[1], 347 joystick->buttons[1],
344# endif 348# endif
345# if JOYSTICK_BUTTON_COUNT > 16 349# if JOYSTICK_BUTTON_COUNT > 16
346 joystick->buttons[2], 350 joystick->buttons[2],
347# endif 351# endif
348# if JOYSTICK_BUTTON_COUNT > 24 352# if JOYSTICK_BUTTON_COUNT > 24
349 joystick->buttons[3], 353 joystick->buttons[3],
350# endif 354# endif
351 } 355 }
352# endif // JOYSTICK_BUTTON_COUNT>0 356# endif // JOYSTICK_BUTTON_COUNT>0
353 }; 357 };
354 358