diff options
author | James Young <18669334+noroadsleft@users.noreply.github.com> | 2020-11-28 12:02:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-28 12:02:18 -0800 |
commit | c66df1664497546f32662409778731143e45a552 (patch) | |
tree | da73a2d532a27685a31d932b3a44a707d4a3af81 /tmk_core/protocol | |
parent | 15385d4113414d42bd062c60c9de5df797d3157f (diff) | |
download | qmk_firmware-c66df1664497546f32662409778731143e45a552.tar.gz qmk_firmware-c66df1664497546f32662409778731143e45a552.zip |
2020 November 28 Breaking Changes Update (#11053)
* Branch point for 2020 November 28 Breaking Change
* Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183)
* Add support for soft serial to ATmega32U2 (#10204)
* Change MIDI velocity implementation to allow direct control of velocity value (#9940)
* Add ability to build a subset of all keyboards based on platform.
* Actually use eeprom_driver_init().
* Make bootloader_jump weak for ChibiOS. (#10417)
* Joystick 16-bit support (#10439)
* Per-encoder resolutions (#10259)
* Share button state from mousekey to pointing_device (#10179)
* Add hotfix for chibios keyboards not wake (#10088)
* Add advanced/efficient RGB Matrix Indicators (#8564)
* Naming change.
* Support for STM32 GPIOF,G,H,I,J,K (#10206)
* Add milc as a dependency and remove the installed milc (#10563)
* ChibiOS upgrade: early init conversions (#10214)
* ChibiOS upgrade: configuration file migrator (#9952)
* Haptic and solenoid cleanup (#9700)
* XD75 cleanup (#10524)
* OLED display update interval support (#10388)
* Add definition based on currently-selected serial driver. (#10716)
* New feature: Retro Tapping per key (#10622)
* Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638)
* Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530)
* Rescale both ChibiOS and AVR backlighting.
* Reduce Helix keyboard build variation (#8669)
* Minor change to behavior allowing display updates to continue between task ticks (#10750)
* Some GPIO manipulations in matrix.c change to atomic. (#10491)
* qmk cformat (#10767)
* [Keyboard] Update the Speedo firmware for v3.0 (#10657)
* Maartenwut/Maarten namechange to evyd13/Evy (#10274)
* [quantum] combine repeated lines of code (#10837)
* Add step sequencer feature (#9703)
* aeboards/ext65 refactor (#10820)
* Refactor xelus/dawn60 for Rev2 later (#10584)
* add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824)
* [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549)
* update chibios os usb for the otg driver (#8893)
* Remove HD44780 References, Part 4 (#10735)
* [Keyboard] Add Valor FRL TKL (+refactor) (#10512)
* Fix cursor position bug in oled_write_raw functions (#10800)
* Fixup version.h writing when using SKIP_VERSION=yes (#10972)
* Allow for certain code in the codebase assuming length of string. (#10974)
* Add AT90USB support for serial.c (#10706)
* Auto shift: support repeats and early registration (#9826)
* Rename ledmatrix.h to match .c file (#7949)
* Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231)
* Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840)
* Merge point for 2020 Nov 28 Breaking Change
Diffstat (limited to 'tmk_core/protocol')
-rw-r--r-- | tmk_core/protocol/arm_atsam.mk | 6 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/arm_atsam_protocol.h | 2 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/main_arm_atsam.c | 4 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/md_rgb_matrix.c (renamed from tmk_core/protocol/arm_atsam/led_matrix.c) | 12 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/md_rgb_matrix.h (renamed from tmk_core/protocol/arm_atsam/led_matrix.h) | 2 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c (renamed from tmk_core/protocol/arm_atsam/led_matrix_programs.c) | 2 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/main.c | 11 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 81 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/usb_main.h | 3 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 4 | ||||
-rw-r--r-- | tmk_core/protocol/usb_descriptor.c | 15 | ||||
-rw-r--r-- | tmk_core/protocol/usb_descriptor.h | 20 | ||||
-rw-r--r-- | tmk_core/protocol/vusb/main.c | 4 |
13 files changed, 152 insertions, 14 deletions
diff --git a/tmk_core/protocol/arm_atsam.mk b/tmk_core/protocol/arm_atsam.mk index 8d6f724f0..5bb45d658 100644 --- a/tmk_core/protocol/arm_atsam.mk +++ b/tmk_core/protocol/arm_atsam.mk | |||
@@ -4,9 +4,9 @@ SRC += $(ARM_ATSAM_DIR)/adc.c | |||
4 | SRC += $(ARM_ATSAM_DIR)/clks.c | 4 | SRC += $(ARM_ATSAM_DIR)/clks.c |
5 | SRC += $(ARM_ATSAM_DIR)/d51_util.c | 5 | SRC += $(ARM_ATSAM_DIR)/d51_util.c |
6 | SRC += $(ARM_ATSAM_DIR)/i2c_master.c | 6 | SRC += $(ARM_ATSAM_DIR)/i2c_master.c |
7 | ifeq ($(RGB_MATRIX_ENABLE),custom) | 7 | ifeq ($(RGB_MATRIX_DRIVER),custom) |
8 | SRC += $(ARM_ATSAM_DIR)/led_matrix_programs.c | 8 | SRC += $(ARM_ATSAM_DIR)/md_rgb_matrix_programs.c |
9 | SRC += $(ARM_ATSAM_DIR)/led_matrix.c | 9 | SRC += $(ARM_ATSAM_DIR)/md_rgb_matrix.c |
10 | endif | 10 | endif |
11 | SRC += $(ARM_ATSAM_DIR)/main_arm_atsam.c | 11 | SRC += $(ARM_ATSAM_DIR)/main_arm_atsam.c |
12 | SRC += $(ARM_ATSAM_DIR)/spi.c | 12 | SRC += $(ARM_ATSAM_DIR)/spi.c |
diff --git a/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h b/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h index 8cb00b872..d126c66e7 100644 --- a/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h +++ b/tmk_core/protocol/arm_atsam/arm_atsam_protocol.h | |||
@@ -35,7 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
35 | 35 | ||
36 | # include "main_arm_atsam.h" | 36 | # include "main_arm_atsam.h" |
37 | # ifdef RGB_MATRIX_ENABLE | 37 | # ifdef RGB_MATRIX_ENABLE |
38 | # include "led_matrix.h" | 38 | # include "md_rgb_matrix.h" |
39 | # include "rgb_matrix.h" | 39 | # include "rgb_matrix.h" |
40 | # endif | 40 | # endif |
41 | # include "issi3733_driver.h" | 41 | # include "issi3733_driver.h" |
diff --git a/tmk_core/protocol/arm_atsam/main_arm_atsam.c b/tmk_core/protocol/arm_atsam/main_arm_atsam.c index e4e79d351..e10be52fb 100644 --- a/tmk_core/protocol/arm_atsam/main_arm_atsam.c +++ b/tmk_core/protocol/arm_atsam/main_arm_atsam.c | |||
@@ -305,6 +305,10 @@ int main(void) { | |||
305 | // dprintf("5v=%u 5vu=%u dlow=%u dhi=%u gca=%u gcd=%u\r\n", v_5v, v_5v_avg, v_5v_avg - V5_LOW, v_5v_avg - V5_HIGH, gcr_actual, gcr_desired); | 305 | // dprintf("5v=%u 5vu=%u dlow=%u dhi=%u gca=%u gcd=%u\r\n", v_5v, v_5v_avg, v_5v_avg - V5_LOW, v_5v_avg - V5_HIGH, gcr_actual, gcr_desired); |
306 | } | 306 | } |
307 | #endif // CONSOLE_ENABLE | 307 | #endif // CONSOLE_ENABLE |
308 | |||
309 | // Run housekeeping | ||
310 | housekeeping_task_kb(); | ||
311 | housekeeping_task_user(); | ||
308 | } | 312 | } |
309 | 313 | ||
310 | return 1; | 314 | return 1; |
diff --git a/tmk_core/protocol/arm_atsam/led_matrix.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c index 69cb03a9f..439aaf8b3 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.c +++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix.c | |||
@@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
23 | 23 | ||
24 | #ifdef USE_MASSDROP_CONFIGURATOR | 24 | #ifdef USE_MASSDROP_CONFIGURATOR |
25 | __attribute__((weak)) led_instruction_t led_instructions[] = {{.end = 1}}; | 25 | __attribute__((weak)) led_instruction_t led_instructions[] = {{.end = 1}}; |
26 | static void led_matrix_massdrop_config_override(int i); | 26 | static void md_rgb_matrix_config_override(int i); |
27 | #endif // USE_MASSDROP_CONFIGURATOR | 27 | #endif // USE_MASSDROP_CONFIGURATOR |
28 | 28 | ||
29 | void SERCOM1_0_Handler(void) { | 29 | void SERCOM1_0_Handler(void) { |
@@ -188,7 +188,7 @@ void issi3733_prepare_arrays(void) { | |||
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | void led_matrix_prepare(void) { | 191 | void md_rgb_matrix_prepare(void) { |
192 | for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) { | 192 | for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) { |
193 | *led_map[i].rgb.r = 0; | 193 | *led_map[i].rgb.r = 0; |
194 | *led_map[i].rgb.g = 0; | 194 | *led_map[i].rgb.g = 0; |
@@ -199,7 +199,7 @@ void led_matrix_prepare(void) { | |||
199 | void led_set_one(int i, uint8_t r, uint8_t g, uint8_t b) { | 199 | void led_set_one(int i, uint8_t r, uint8_t g, uint8_t b) { |
200 | if (i < ISSI3733_LED_COUNT) { | 200 | if (i < ISSI3733_LED_COUNT) { |
201 | #ifdef USE_MASSDROP_CONFIGURATOR | 201 | #ifdef USE_MASSDROP_CONFIGURATOR |
202 | led_matrix_massdrop_config_override(i); | 202 | md_rgb_matrix_config_override(i); |
203 | #else | 203 | #else |
204 | led_buffer[i].r = r; | 204 | led_buffer[i].r = r; |
205 | led_buffer[i].g = g; | 205 | led_buffer[i].g = g; |
@@ -219,7 +219,7 @@ void init(void) { | |||
219 | 219 | ||
220 | issi3733_prepare_arrays(); | 220 | issi3733_prepare_arrays(); |
221 | 221 | ||
222 | led_matrix_prepare(); | 222 | md_rgb_matrix_prepare(); |
223 | 223 | ||
224 | gcr_min_counter = 0; | 224 | gcr_min_counter = 0; |
225 | v_5v_cat_hit = 0; | 225 | v_5v_cat_hit = 0; |
@@ -290,7 +290,7 @@ void flush(void) { | |||
290 | i2c_led_q_run(); | 290 | i2c_led_q_run(); |
291 | } | 291 | } |
292 | 292 | ||
293 | void led_matrix_indicators(void) { | 293 | void md_rgb_matrix_indicators(void) { |
294 | uint8_t kbled = keyboard_leds(); | 294 | uint8_t kbled = keyboard_leds(); |
295 | if (kbled && rgb_matrix_config.enable) { | 295 | if (kbled && rgb_matrix_config.enable) { |
296 | for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) { | 296 | for (uint8_t i = 0; i < ISSI3733_LED_COUNT; i++) { |
@@ -397,7 +397,7 @@ static void led_run_pattern(led_setup_t* f, float* ro, float* go, float* bo, flo | |||
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
400 | static void led_matrix_massdrop_config_override(int i) { | 400 | static void md_rgb_matrix_config_override(int i) { |
401 | float ro = 0; | 401 | float ro = 0; |
402 | float go = 0; | 402 | float go = 0; |
403 | float bo = 0; | 403 | float bo = 0; |
diff --git a/tmk_core/protocol/arm_atsam/led_matrix.h b/tmk_core/protocol/arm_atsam/md_rgb_matrix.h index 8eaa5623b..322b0f99d 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix.h +++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix.h | |||
@@ -86,7 +86,7 @@ extern uint8_t gcr_actual_last; | |||
86 | 86 | ||
87 | void gcr_compute(void); | 87 | void gcr_compute(void); |
88 | 88 | ||
89 | void led_matrix_indicators(void); | 89 | void md_rgb_matrix_indicators(void); |
90 | 90 | ||
91 | /*------------------------- Legacy Lighting Support ------------------------*/ | 91 | /*------------------------- Legacy Lighting Support ------------------------*/ |
92 | 92 | ||
diff --git a/tmk_core/protocol/arm_atsam/led_matrix_programs.c b/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c index 360102ba8..b43008cc5 100644 --- a/tmk_core/protocol/arm_atsam/led_matrix_programs.c +++ b/tmk_core/protocol/arm_atsam/md_rgb_matrix_programs.c | |||
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
17 | 17 | ||
18 | #ifdef USE_MASSDROP_CONFIGURATOR | 18 | #ifdef USE_MASSDROP_CONFIGURATOR |
19 | 19 | ||
20 | # include "led_matrix.h" | 20 | # include "md_rgb_matrix.h" |
21 | 21 | ||
22 | // Teal <-> Salmon | 22 | // Teal <-> Salmon |
23 | led_setup_t leds_teal_salmon[] = { | 23 | led_setup_t leds_teal_salmon[] = { |
diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index a0d28f9af..400c0b8f5 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c | |||
@@ -54,6 +54,9 @@ | |||
54 | #ifdef STM32_EEPROM_ENABLE | 54 | #ifdef STM32_EEPROM_ENABLE |
55 | # include "eeprom_stm32.h" | 55 | # include "eeprom_stm32.h" |
56 | #endif | 56 | #endif |
57 | #ifdef EEPROM_DRIVER | ||
58 | # include "eeprom_driver.h" | ||
59 | #endif | ||
57 | #include "suspend.h" | 60 | #include "suspend.h" |
58 | #include "wait.h" | 61 | #include "wait.h" |
59 | 62 | ||
@@ -150,6 +153,9 @@ int main(void) { | |||
150 | #ifdef STM32_EEPROM_ENABLE | 153 | #ifdef STM32_EEPROM_ENABLE |
151 | EEPROM_Init(); | 154 | EEPROM_Init(); |
152 | #endif | 155 | #endif |
156 | #ifdef EEPROM_DRIVER | ||
157 | eeprom_driver_init(); | ||
158 | #endif | ||
153 | 159 | ||
154 | // TESTING | 160 | // TESTING |
155 | // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); | 161 | // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); |
@@ -230,6 +236,7 @@ int main(void) { | |||
230 | /* Remote wakeup */ | 236 | /* Remote wakeup */ |
231 | if (suspend_wakeup_condition()) { | 237 | if (suspend_wakeup_condition()) { |
232 | usbWakeupHost(&USB_DRIVER); | 238 | usbWakeupHost(&USB_DRIVER); |
239 | restart_usb_driver(&USB_DRIVER); | ||
233 | } | 240 | } |
234 | } | 241 | } |
235 | /* Woken up */ | 242 | /* Woken up */ |
@@ -258,5 +265,9 @@ int main(void) { | |||
258 | #ifdef RAW_ENABLE | 265 | #ifdef RAW_ENABLE |
259 | raw_hid_task(); | 266 | raw_hid_task(); |
260 | #endif | 267 | #endif |
268 | |||
269 | // Run housekeeping | ||
270 | housekeeping_task_kb(); | ||
271 | housekeeping_task_user(); | ||
261 | } | 272 | } |
262 | } | 273 | } |
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index ae33e86a7..bb4bf6a58 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c | |||
@@ -165,6 +165,19 @@ static const USBEndpointConfig shared_ep_config = { | |||
165 | }; | 165 | }; |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | #if STM32_USB_USE_OTG1 | ||
169 | typedef struct { | ||
170 | size_t queue_capacity_in; | ||
171 | size_t queue_capacity_out; | ||
172 | USBInEndpointState in_ep_state; | ||
173 | USBOutEndpointState out_ep_state; | ||
174 | USBInEndpointState int_ep_state; | ||
175 | USBEndpointConfig inout_ep_config; | ||
176 | USBEndpointConfig int_ep_config; | ||
177 | const QMKUSBConfig config; | ||
178 | QMKUSBDriver driver; | ||
179 | } usb_driver_config_t; | ||
180 | #else | ||
168 | typedef struct { | 181 | typedef struct { |
169 | size_t queue_capacity_in; | 182 | size_t queue_capacity_in; |
170 | size_t queue_capacity_out; | 183 | size_t queue_capacity_out; |
@@ -177,7 +190,54 @@ typedef struct { | |||
177 | const QMKUSBConfig config; | 190 | const QMKUSBConfig config; |
178 | QMKUSBDriver driver; | 191 | QMKUSBDriver driver; |
179 | } usb_driver_config_t; | 192 | } usb_driver_config_t; |
193 | #endif | ||
180 | 194 | ||
195 | #if STM32_USB_USE_OTG1 | ||
196 | /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ | ||
197 | #define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ | ||
198 | { \ | ||
199 | .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ | ||
200 | .inout_ep_config = \ | ||
201 | { \ | ||
202 | stream##_IN_MODE, /* Interrupt EP */ \ | ||
203 | NULL, /* SETUP packet notification callback */ \ | ||
204 | qmkusbDataTransmitted, /* IN notification callback */ \ | ||
205 | qmkusbDataReceived, /* OUT notification callback */ \ | ||
206 | stream##_EPSIZE, /* IN maximum packet size */ \ | ||
207 | stream##_EPSIZE, /* OUT maximum packet size */ \ | ||
208 | NULL, /* IN Endpoint state */ \ | ||
209 | NULL, /* OUT endpoint state */ \ | ||
210 | 2, /* IN multiplier */ \ | ||
211 | NULL /* SETUP buffer (not a SETUP endpoint) */ \ | ||
212 | }, \ | ||
213 | .int_ep_config = \ | ||
214 | { \ | ||
215 | USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ | ||
216 | NULL, /* SETUP packet notification callback */ \ | ||
217 | qmkusbInterruptTransmitted, /* IN notification callback */ \ | ||
218 | NULL, /* OUT notification callback */ \ | ||
219 | CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ | ||
220 | 0, /* OUT maximum packet size */ \ | ||
221 | NULL, /* IN Endpoint state */ \ | ||
222 | NULL, /* OUT endpoint state */ \ | ||
223 | 2, /* IN multiplier */ \ | ||
224 | NULL, /* SETUP buffer (not a SETUP endpoint) */ \ | ||
225 | }, \ | ||
226 | .config = { \ | ||
227 | .usbp = &USB_DRIVER, \ | ||
228 | .bulk_in = stream##_IN_EPNUM, \ | ||
229 | .bulk_out = stream##_OUT_EPNUM, \ | ||
230 | .int_in = notification, \ | ||
231 | .in_buffers = stream##_IN_CAPACITY, \ | ||
232 | .out_buffers = stream##_OUT_CAPACITY, \ | ||
233 | .in_size = stream##_EPSIZE, \ | ||
234 | .out_size = stream##_EPSIZE, \ | ||
235 | .fixed_size = fixedsize, \ | ||
236 | .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ | ||
237 | .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ | ||
238 | } \ | ||
239 | } | ||
240 | #else | ||
181 | /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ | 241 | /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ |
182 | #define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ | 242 | #define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ |
183 | { \ | 243 | { \ |
@@ -235,6 +295,7 @@ typedef struct { | |||
235 | .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ | 295 | .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ |
236 | } \ | 296 | } \ |
237 | } | 297 | } |
298 | #endif | ||
238 | 299 | ||
239 | typedef struct { | 300 | typedef struct { |
240 | union { | 301 | union { |
@@ -327,8 +388,12 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { | |||
327 | usbInitEndpointI(usbp, SHARED_IN_EPNUM, &shared_ep_config); | 388 | usbInitEndpointI(usbp, SHARED_IN_EPNUM, &shared_ep_config); |
328 | #endif | 389 | #endif |
329 | for (int i = 0; i < NUM_USB_DRIVERS; i++) { | 390 | for (int i = 0; i < NUM_USB_DRIVERS; i++) { |
391 | #if STM32_USB_USE_OTG1 | ||
392 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].inout_ep_config); | ||
393 | #else | ||
330 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].in_ep_config); | 394 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].in_ep_config); |
331 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_out, &drivers.array[i].out_ep_config); | 395 | usbInitEndpointI(usbp, drivers.array[i].config.bulk_out, &drivers.array[i].out_ep_config); |
396 | #endif | ||
332 | if (drivers.array[i].config.int_in) { | 397 | if (drivers.array[i].config.int_in) { |
333 | usbInitEndpointI(usbp, drivers.array[i].config.int_in, &drivers.array[i].int_ep_config); | 398 | usbInitEndpointI(usbp, drivers.array[i].config.int_in, &drivers.array[i].int_ep_config); |
334 | } | 399 | } |
@@ -553,12 +618,21 @@ static const USBConfig usbcfg = { | |||
553 | */ | 618 | */ |
554 | void init_usb_driver(USBDriver *usbp) { | 619 | void init_usb_driver(USBDriver *usbp) { |
555 | for (int i = 0; i < NUM_USB_DRIVERS; i++) { | 620 | for (int i = 0; i < NUM_USB_DRIVERS; i++) { |
621 | #if STM32_USB_USE_OTG1 | ||
622 | QMKUSBDriver *driver = &drivers.array[i].driver; | ||
623 | drivers.array[i].inout_ep_config.in_state = &drivers.array[i].in_ep_state; | ||
624 | drivers.array[i].inout_ep_config.out_state = &drivers.array[i].out_ep_state; | ||
625 | drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; | ||
626 | qmkusbObjectInit(driver, &drivers.array[i].config); | ||
627 | qmkusbStart(driver, &drivers.array[i].config); | ||
628 | #else | ||
556 | QMKUSBDriver *driver = &drivers.array[i].driver; | 629 | QMKUSBDriver *driver = &drivers.array[i].driver; |
557 | drivers.array[i].in_ep_config.in_state = &drivers.array[i].in_ep_state; | 630 | drivers.array[i].in_ep_config.in_state = &drivers.array[i].in_ep_state; |
558 | drivers.array[i].out_ep_config.out_state = &drivers.array[i].out_ep_state; | 631 | drivers.array[i].out_ep_config.out_state = &drivers.array[i].out_ep_state; |
559 | drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; | 632 | drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; |
560 | qmkusbObjectInit(driver, &drivers.array[i].config); | 633 | qmkusbObjectInit(driver, &drivers.array[i].config); |
561 | qmkusbStart(driver, &drivers.array[i].config); | 634 | qmkusbStart(driver, &drivers.array[i].config); |
635 | #endif | ||
562 | } | 636 | } |
563 | 637 | ||
564 | /* | 638 | /* |
@@ -574,6 +648,13 @@ void init_usb_driver(USBDriver *usbp) { | |||
574 | chVTObjectInit(&keyboard_idle_timer); | 648 | chVTObjectInit(&keyboard_idle_timer); |
575 | } | 649 | } |
576 | 650 | ||
651 | void restart_usb_driver(USBDriver *usbp) { | ||
652 | usbStop(usbp); | ||
653 | usbDisconnectBus(usbp); | ||
654 | usbStart(usbp, &usbcfg); | ||
655 | usbConnectBus(usbp); | ||
656 | } | ||
657 | |||
577 | /* --------------------------------------------------------- | 658 | /* --------------------------------------------------------- |
578 | * Keyboard functions | 659 | * Keyboard functions |
579 | * --------------------------------------------------------- | 660 | * --------------------------------------------------------- |
diff --git a/tmk_core/protocol/chibios/usb_main.h b/tmk_core/protocol/chibios/usb_main.h index 94baf9b35..d8813f480 100644 --- a/tmk_core/protocol/chibios/usb_main.h +++ b/tmk_core/protocol/chibios/usb_main.h | |||
@@ -35,6 +35,9 @@ | |||
35 | /* Initialize the USB driver and bus */ | 35 | /* Initialize the USB driver and bus */ |
36 | void init_usb_driver(USBDriver *usbp); | 36 | void init_usb_driver(USBDriver *usbp); |
37 | 37 | ||
38 | /* Restart the USB driver and bus */ | ||
39 | void restart_usb_driver(USBDriver *usbp); | ||
40 | |||
38 | /* --------------- | 41 | /* --------------- |
39 | * Keyboard header | 42 | * Keyboard header |
40 | * --------------- | 43 | * --------------- |
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index cec004402..878be7d34 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
@@ -1104,6 +1104,10 @@ int main(void) { | |||
1104 | #if !defined(INTERRUPT_CONTROL_ENDPOINT) | 1104 | #if !defined(INTERRUPT_CONTROL_ENDPOINT) |
1105 | USB_USBTask(); | 1105 | USB_USBTask(); |
1106 | #endif | 1106 | #endif |
1107 | |||
1108 | // Run housekeeping | ||
1109 | housekeeping_task_kb(); | ||
1110 | housekeeping_task_user(); | ||
1107 | } | 1111 | } |
1108 | } | 1112 | } |
1109 | 1113 | ||
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c index f5d32445d..a0c0d4cdc 100644 --- a/tmk_core/protocol/usb_descriptor.c +++ b/tmk_core/protocol/usb_descriptor.c | |||
@@ -41,6 +41,10 @@ | |||
41 | #include "usb_descriptor.h" | 41 | #include "usb_descriptor.h" |
42 | #include "usb_descriptor_common.h" | 42 | #include "usb_descriptor_common.h" |
43 | 43 | ||
44 | #ifdef JOYSTICK_ENABLE | ||
45 | # include "joystick.h" | ||
46 | #endif | ||
47 | |||
44 | // clang-format off | 48 | // clang-format off |
45 | 49 | ||
46 | /* | 50 | /* |
@@ -308,10 +312,17 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] = { | |||
308 | HID_RI_USAGE(8, 0x35), // Rz | 312 | HID_RI_USAGE(8, 0x35), // Rz |
309 | # endif | 313 | # endif |
310 | # if JOYSTICK_AXES_COUNT >= 1 | 314 | # if JOYSTICK_AXES_COUNT >= 1 |
311 | HID_RI_LOGICAL_MINIMUM(8, -127), | 315 | # if JOYSTICK_AXES_RESOLUTION == 8 |
312 | HID_RI_LOGICAL_MAXIMUM(8, 127), | 316 | HID_RI_LOGICAL_MINIMUM(8, -JOYSTICK_RESOLUTION), |
317 | HID_RI_LOGICAL_MAXIMUM(8, JOYSTICK_RESOLUTION), | ||
313 | HID_RI_REPORT_COUNT(8, JOYSTICK_AXES_COUNT), | 318 | HID_RI_REPORT_COUNT(8, JOYSTICK_AXES_COUNT), |
314 | HID_RI_REPORT_SIZE(8, 0x08), | 319 | HID_RI_REPORT_SIZE(8, 0x08), |
320 | # else | ||
321 | HID_RI_LOGICAL_MINIMUM(16, -JOYSTICK_RESOLUTION), | ||
322 | HID_RI_LOGICAL_MAXIMUM(16, JOYSTICK_RESOLUTION), | ||
323 | HID_RI_REPORT_COUNT(8, JOYSTICK_AXES_COUNT), | ||
324 | HID_RI_REPORT_SIZE(8, 0x10), | ||
325 | # endif | ||
315 | HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), | 326 | HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), |
316 | # endif | 327 | # endif |
317 | 328 | ||
diff --git a/tmk_core/protocol/usb_descriptor.h b/tmk_core/protocol/usb_descriptor.h index 02a4b1ce5..aa8863f43 100644 --- a/tmk_core/protocol/usb_descriptor.h +++ b/tmk_core/protocol/usb_descriptor.h | |||
@@ -205,7 +205,11 @@ enum usb_endpoints { | |||
205 | 205 | ||
206 | #ifdef RAW_ENABLE | 206 | #ifdef RAW_ENABLE |
207 | RAW_IN_EPNUM = NEXT_EPNUM, | 207 | RAW_IN_EPNUM = NEXT_EPNUM, |
208 | #if STM32_USB_USE_OTG1 | ||
209 | #define RAW_OUT_EPNUM RAW_IN_EPNUM | ||
210 | #else | ||
208 | RAW_OUT_EPNUM = NEXT_EPNUM, | 211 | RAW_OUT_EPNUM = NEXT_EPNUM, |
212 | #endif | ||
209 | #endif | 213 | #endif |
210 | 214 | ||
211 | #ifdef SHARED_EP_ENABLE | 215 | #ifdef SHARED_EP_ENABLE |
@@ -219,7 +223,11 @@ enum usb_endpoints { | |||
219 | // ChibiOS has enough memory and descriptor to actually enable the endpoint | 223 | // ChibiOS has enough memory and descriptor to actually enable the endpoint |
220 | // It could use the same endpoint numbers, as that's supported by ChibiOS | 224 | // It could use the same endpoint numbers, as that's supported by ChibiOS |
221 | // But the QMK code currently assumes that the endpoint numbers are different | 225 | // But the QMK code currently assumes that the endpoint numbers are different |
226 | #if STM32_USB_USE_OTG1 | ||
227 | #define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM | ||
228 | #else | ||
222 | CONSOLE_OUT_EPNUM = NEXT_EPNUM, | 229 | CONSOLE_OUT_EPNUM = NEXT_EPNUM, |
230 | #endif | ||
223 | # else | 231 | # else |
224 | # define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM | 232 | # define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM |
225 | # endif | 233 | # endif |
@@ -227,17 +235,29 @@ enum usb_endpoints { | |||
227 | 235 | ||
228 | #ifdef MIDI_ENABLE | 236 | #ifdef MIDI_ENABLE |
229 | MIDI_STREAM_IN_EPNUM = NEXT_EPNUM, | 237 | MIDI_STREAM_IN_EPNUM = NEXT_EPNUM, |
238 | #if STM32_USB_USE_OTG1 | ||
239 | #define MIDI_STREAM_OUT_EPNUM MIDI_STREAM_IN_EPNUM | ||
240 | #else | ||
230 | MIDI_STREAM_OUT_EPNUM = NEXT_EPNUM, | 241 | MIDI_STREAM_OUT_EPNUM = NEXT_EPNUM, |
242 | #endif | ||
231 | #endif | 243 | #endif |
232 | 244 | ||
233 | #ifdef VIRTSER_ENABLE | 245 | #ifdef VIRTSER_ENABLE |
234 | CDC_NOTIFICATION_EPNUM = NEXT_EPNUM, | 246 | CDC_NOTIFICATION_EPNUM = NEXT_EPNUM, |
235 | CDC_IN_EPNUM = NEXT_EPNUM, | 247 | CDC_IN_EPNUM = NEXT_EPNUM, |
248 | #if STM32_USB_USE_OTG1 | ||
249 | #define CDC_OUT_EPNUM CDC_IN_EPNUM | ||
250 | #else | ||
236 | CDC_OUT_EPNUM = NEXT_EPNUM, | 251 | CDC_OUT_EPNUM = NEXT_EPNUM, |
252 | #endif | ||
237 | #endif | 253 | #endif |
238 | #ifdef JOYSTICK_ENABLE | 254 | #ifdef JOYSTICK_ENABLE |
239 | JOYSTICK_IN_EPNUM = NEXT_EPNUM, | 255 | JOYSTICK_IN_EPNUM = NEXT_EPNUM, |
256 | #if STM32_USB_USE_OTG1 | ||
257 | JOYSTICK_OUT_EPNUM = JOYSTICK_IN_EPNUM, | ||
258 | #else | ||
240 | JOYSTICK_OUT_EPNUM = NEXT_EPNUM, | 259 | JOYSTICK_OUT_EPNUM = NEXT_EPNUM, |
260 | #endif | ||
241 | #endif | 261 | #endif |
242 | }; | 262 | }; |
243 | 263 | ||
diff --git a/tmk_core/protocol/vusb/main.c b/tmk_core/protocol/vusb/main.c index a57df5ce0..0e3447d92 100644 --- a/tmk_core/protocol/vusb/main.c +++ b/tmk_core/protocol/vusb/main.c | |||
@@ -153,6 +153,10 @@ int main(void) { | |||
153 | console_task(); | 153 | console_task(); |
154 | } | 154 | } |
155 | #endif | 155 | #endif |
156 | |||
157 | // Run housekeeping | ||
158 | housekeeping_task_kb(); | ||
159 | housekeeping_task_user(); | ||
156 | } else if (suspend_wakeup_condition()) { | 160 | } else if (suspend_wakeup_condition()) { |
157 | usb_remote_wakeup(); | 161 | usb_remote_wakeup(); |
158 | } | 162 | } |