diff options
-rw-r--r-- | drivers/chibios/ws2812_pwm.c | 12 | ||||
-rw-r--r-- | drivers/chibios/ws2812_spi.c | 2 | ||||
-rw-r--r-- | drivers/issi/is31fl3731-simple.c | 2 | ||||
-rw-r--r-- | keyboards/mt64rgb/keymaps/default/readme.md | 6 | ||||
-rw-r--r-- | keyboards/mt64rgb/readme.md | 32 | ||||
-rw-r--r-- | keyboards/zinc/keymaps/default/readme_en.md | 2 | ||||
-rw-r--r-- | quantum/debounce/sym_defer_pk.c | 10 | ||||
-rw-r--r-- | quantum/matrix.c | 20 | ||||
-rw-r--r-- | quantum/split_common/matrix.c | 20 | ||||
-rw-r--r-- | quantum/split_common/split_util.c | 8 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_device_conf.h | 4 | ||||
-rw-r--r-- | tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c | 4 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/usb_main.c | 222 | ||||
-rw-r--r-- | tmk_core/protocol/usb_descriptor.h | 52 | ||||
-rw-r--r-- | util/pro_micro_ISP_B6_10.hex | 724 |
15 files changed, 550 insertions, 570 deletions
diff --git a/drivers/chibios/ws2812_pwm.c b/drivers/chibios/ws2812_pwm.c index 7595e2fa28..3af922c063 100644 --- a/drivers/chibios/ws2812_pwm.c +++ b/drivers/chibios/ws2812_pwm.c @@ -118,7 +118,7 @@ * * @return The bit index */ -# define WS2812_RED_BIT(led, bit) WS2812_BIT((led), 1, (bit)) +# define WS2812_RED_BIT(led, bit) WS2812_BIT((led), 1, (bit)) /** * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given green bit @@ -130,7 +130,7 @@ * * @return The bit index */ -# define WS2812_GREEN_BIT(led, bit) WS2812_BIT((led), 0, (bit)) +# define WS2812_GREEN_BIT(led, bit) WS2812_BIT((led), 0, (bit)) /** * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given blue bit @@ -142,7 +142,7 @@ * * @return The bit index */ -# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit)) +# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit)) #elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_RGB) /** @@ -155,7 +155,7 @@ * * @return The bit index */ -# define WS2812_RED_BIT(led, bit) WS2812_BIT((led), 0, (bit)) +# define WS2812_RED_BIT(led, bit) WS2812_BIT((led), 0, (bit)) /** * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given green bit @@ -167,7 +167,7 @@ * * @return The bit index */ -# define WS2812_GREEN_BIT(led, bit) WS2812_BIT((led), 1, (bit)) +# define WS2812_GREEN_BIT(led, bit) WS2812_BIT((led), 1, (bit)) /** * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given blue bit @@ -179,7 +179,7 @@ * * @return The bit index */ -# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit)) +# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 2, (bit)) #endif /* --- PRIVATE VARIABLES ---------------------------------------------------- */ diff --git a/drivers/chibios/ws2812_spi.c b/drivers/chibios/ws2812_spi.c index 1dec1f5167..a933424362 100644 --- a/drivers/chibios/ws2812_spi.c +++ b/drivers/chibios/ws2812_spi.c @@ -69,7 +69,7 @@ static void set_led_color_rgb(LED_TYPE color, int pos) { #elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_RGB) for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + j] = get_protocol_eq(color.r, j); for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE + j] = get_protocol_eq(color.g, j); - for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.b, j); + for (int j = 0; j < 4; j++) tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.b, j); #endif } diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/issi/is31fl3731-simple.c index cffb4d87ff..7c86841f1e 100644 --- a/drivers/issi/is31fl3731-simple.c +++ b/drivers/issi/is31fl3731-simple.c @@ -75,7 +75,7 @@ uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}}; #elif LED_DRIVER_COUNT == 4 uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}}; #endif -bool g_led_control_registers_update_required[LED_DRIVER_COUNT] = {false}; +bool g_led_control_registers_update_required[LED_DRIVER_COUNT] = {false}; // This is the bit pattern in the LED control registers // (for matrix A, add one to register for matrix B) diff --git a/keyboards/mt64rgb/keymaps/default/readme.md b/keyboards/mt64rgb/keymaps/default/readme.md index f42a9a615d..5508f7df16 100644 --- a/keyboards/mt64rgb/keymaps/default/readme.md +++ b/keyboards/mt64rgb/keymaps/default/readme.md @@ -1,3 +1,3 @@ -# Default mt4rgb Layout
-
-This is the default layout that comes flashed on every mt64rgb. All key pins are shown in the file.
\ No newline at end of file +# Default mt4rgb Layout + +This is the default layout that comes flashed on every mt64rgb. All key pins are shown in the file. diff --git a/keyboards/mt64rgb/readme.md b/keyboards/mt64rgb/readme.md index c412835b83..dcc9412368 100644 --- a/keyboards/mt64rgb/readme.md +++ b/keyboards/mt64rgb/readme.md @@ -1,16 +1,16 @@ -# mt64rgb
-
-![mt64rgb](https://i.imgur.com/kxGGUg9.jpg?1)
-
-A 60% keyboard PCB made by MT.
-It supports an ANSI-based 64-key layout, with hotswap sockets and per-key RGB backlight.
-
-* Keyboard Maintainer: [MT](https://github.com/704340378)
-* Hardware Supported: mt64rgb (atmega32u4)
-* Hardware Availability: [麦田外设](https://shop110310565.taobao.com)
-
-Make example for this keyboard (after setting up your build environment):
-
- make mt64rgb:default
-
-See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
+# mt64rgb + +![mt64rgb](https://i.imgur.com/kxGGUg9.jpg?1) + +A 60% keyboard PCB made by MT. +It supports an ANSI-based 64-key layout, with hotswap sockets and per-key RGB backlight. + +* Keyboard Maintainer: [MT](https://github.com/704340378) +* Hardware Supported: mt64rgb (atmega32u4) +* Hardware Availability: [麦田外设](https://shop110310565.taobao.com) + +Make example for this keyboard (after setting up your build environment): + + make mt64rgb:default + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/zinc/keymaps/default/readme_en.md b/keyboards/zinc/keymaps/default/readme_en.md index 6447e96ed4..3be6b29616 100644 --- a/keyboards/zinc/keymaps/default/readme_en.md +++ b/keyboards/zinc/keymaps/default/readme_en.md @@ -1,4 +1,4 @@ -# The Default Zinc Layout +# The Default Zinc Layout ## layout ### Qwerty diff --git a/quantum/debounce/sym_defer_pk.c b/quantum/debounce/sym_defer_pk.c index f404cf9c44..6c0e3bb071 100644 --- a/quantum/debounce/sym_defer_pk.c +++ b/quantum/debounce/sym_defer_pk.c @@ -38,12 +38,12 @@ static bool counters_need_update; #define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1) static uint8_t wrapping_timer_read(void) { - static uint16_t time = 0; + static uint16_t time = 0; static uint8_t last_result = 0; - uint16_t new_time = timer_read(); - uint16_t diff = new_time - time; - time = new_time; - last_result = (last_result + diff) % (MAX_DEBOUNCE + 1); + uint16_t new_time = timer_read(); + uint16_t diff = new_time - time; + time = new_time; + last_result = (last_result + diff) % (MAX_DEBOUNCE + 1); return last_result; } diff --git a/quantum/matrix.c b/quantum/matrix.c index cab0d2ddca..9083ff3861 100644 --- a/quantum/matrix.c +++ b/quantum/matrix.c @@ -40,9 +40,7 @@ static inline void setPinOutput_writeLow(pin_t pin) { } static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); - } + ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } } // matrix code @@ -82,13 +80,9 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) #elif defined(DIODE_DIRECTION) # if (DIODE_DIRECTION == COL2ROW) -static void select_row(uint8_t row) { - setPinOutput_writeLow(row_pins[row]); -} +static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); } -static void unselect_row(uint8_t row) { - setPinInputHigh_atomic(row_pins[row]); -} +static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) { @@ -133,13 +127,9 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) # elif (DIODE_DIRECTION == ROW2COL) -static void select_col(uint8_t col) { - setPinOutput_writeLow(col_pins[col]); -} +static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); } -static void unselect_col(uint8_t col) { - setPinInputHigh_atomic(col_pins[col]); -} +static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); } static void unselect_cols(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c index cd5a024c3d..51bf8b1095 100644 --- a/quantum/split_common/matrix.c +++ b/quantum/split_common/matrix.c @@ -53,9 +53,7 @@ static inline void setPinOutput_writeLow(pin_t pin) { } static inline void setPinInputHigh_atomic(pin_t pin) { - ATOMIC_BLOCK_FORCEON { - setPinInputHigh(pin); - } + ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); } } // matrix code @@ -95,13 +93,9 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) #elif defined(DIODE_DIRECTION) # if (DIODE_DIRECTION == COL2ROW) -static void select_row(uint8_t row) { - setPinOutput_writeLow(row_pins[row]); -} +static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); } -static void unselect_row(uint8_t row) { - setPinInputHigh_atomic(row_pins[row]); -} +static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); } static void unselect_rows(void) { for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { @@ -146,13 +140,9 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) # elif (DIODE_DIRECTION == ROW2COL) -static void select_col(uint8_t col) { - setPinOutput_writeLow(col_pins[col]); -} +static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); } -static void unselect_col(uint8_t col) { - setPinInputHigh_atomic(col_pins[col]); -} +static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); } static void unselect_cols(void) { for (uint8_t x = 0; x < MATRIX_COLS; x++) { diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 97d49961dc..2ae44e6e15 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c @@ -95,7 +95,7 @@ static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) { uint8_t pin_state = readPin(in_pin); // Set out_pin to a setting that is less susceptible to noise. setPinInputHigh(out_pin); - matrix_io_delay(); // Wait for the pull-up to go HIGH. + matrix_io_delay(); // Wait for the pull-up to go HIGH. return pin_state; } #endif @@ -106,11 +106,11 @@ __attribute__((weak)) bool is_keyboard_left(void) { setPinInput(SPLIT_HAND_PIN); return readPin(SPLIT_HAND_PIN); #elif defined(SPLIT_HAND_MATRIX_GRID) -# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT +# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT return peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID); -# else +# else return !peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID); -# endif +# endif #elif defined(EE_HANDS) return eeconfig_read_handedness(); #elif defined(MASTER_RIGHT) diff --git a/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h b/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h index 505db47b06..9c9d94789d 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h +++ b/tmk_core/protocol/arm_atsam/usb/udi_device_conf.h @@ -291,7 +291,7 @@ typedef struct { extern uint8_t udi_hid_kbd_report_set; // report buffer (to host) -# define UDI_HID_KBD_REPORT_SIZE 8 +#define UDI_HID_KBD_REPORT_SIZE 8 extern uint8_t udi_hid_kbd_report[UDI_HID_KBD_REPORT_SIZE]; COMPILER_PACK_RESET() @@ -784,7 +784,7 @@ COMPILER_PACK_RESET() COMPILER_PACK_SET(1) typedef struct { - usb_conf_desc_t conf; + usb_conf_desc_t conf; udi_hid_kbd_desc_t hid_kbd; #ifdef MOUSE_ENABLE udi_hid_mou_desc_t hid_mou; diff --git a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c index a3fb46a3d4..814389b6e7 100644 --- a/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c +++ b/tmk_core/protocol/arm_atsam/usb/udi_hid_kbd_desc.c @@ -83,7 +83,7 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {.bLength = sizeof(usb #ifdef USB_DEVICE_PRODUCT_NAME .iProduct = 2, #else - .iProduct = 0, // No product string + .iProduct = 0, // No product string #endif #if (defined USB_DEVICE_SERIAL_NAME || defined USB_DEVICE_GET_SERIAL_NAME_POINTER) .iSerialNumber = 3, @@ -120,7 +120,7 @@ UDC_DESC_STORAGE udc_desc_t udc_desc = { .conf.iConfiguration = 0, .conf.bmAttributes = /* USB_CONFIG_ATTR_MUST_SET | */ USB_DEVICE_ATTR, .conf.bMaxPower = USB_CONFIG_MAX_POWER(USB_DEVICE_POWER), - .hid_kbd = UDI_HID_KBD_DESC, + .hid_kbd = UDI_HID_KBD_DESC, #ifdef RAW_ENABLE .hid_raw = UDI_HID_RAW_DESC, #endif diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c index 096e6e676e..9745d147c3 100644 --- a/tmk_core/protocol/chibios/usb_main.c +++ b/tmk_core/protocol/chibios/usb_main.c @@ -194,107 +194,107 @@ typedef struct { #if STM32_USB_USE_OTG1 /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ -#define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ - { \ - .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ - .inout_ep_config = \ - { \ - stream##_IN_MODE, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - qmkusbDataTransmitted, /* IN notification callback */ \ - qmkusbDataReceived, /* OUT notification callback */ \ - stream##_EPSIZE, /* IN maximum packet size */ \ - stream##_EPSIZE, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .int_ep_config = \ - { \ - USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - qmkusbInterruptTransmitted, /* IN notification callback */ \ - NULL, /* OUT notification callback */ \ - CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ - 0, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL, /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .config = { \ - .usbp = &USB_DRIVER, \ - .bulk_in = stream##_IN_EPNUM, \ - .bulk_out = stream##_OUT_EPNUM, \ - .int_in = notification, \ - .in_buffers = stream##_IN_CAPACITY, \ - .out_buffers = stream##_OUT_CAPACITY, \ - .in_size = stream##_EPSIZE, \ - .out_size = stream##_EPSIZE, \ - .fixed_size = fixedsize, \ - .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ - .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ - } \ - } +# define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ + { \ + .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ + .inout_ep_config = \ + { \ + stream##_IN_MODE, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + qmkusbDataTransmitted, /* IN notification callback */ \ + qmkusbDataReceived, /* OUT notification callback */ \ + stream##_EPSIZE, /* IN maximum packet size */ \ + stream##_EPSIZE, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .int_ep_config = \ + { \ + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + qmkusbInterruptTransmitted, /* IN notification callback */ \ + NULL, /* OUT notification callback */ \ + CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ + 0, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL, /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .config = { \ + .usbp = &USB_DRIVER, \ + .bulk_in = stream##_IN_EPNUM, \ + .bulk_out = stream##_OUT_EPNUM, \ + .int_in = notification, \ + .in_buffers = stream##_IN_CAPACITY, \ + .out_buffers = stream##_OUT_CAPACITY, \ + .in_size = stream##_EPSIZE, \ + .out_size = stream##_EPSIZE, \ + .fixed_size = fixedsize, \ + .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ + .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ + } \ + } #else /* Reusable initialization structure - see USBEndpointConfig comment at top of file */ -#define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ - { \ - .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ - .in_ep_config = \ - { \ - stream##_IN_MODE, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - qmkusbDataTransmitted, /* IN notification callback */ \ - NULL, /* OUT notification callback */ \ - stream##_EPSIZE, /* IN maximum packet size */ \ - 0, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .out_ep_config = \ - { \ - stream##_OUT_MODE, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - NULL, /* IN notification callback */ \ - qmkusbDataReceived, /* OUT notification callback */ \ - 0, /* IN maximum packet size */ \ - stream##_EPSIZE, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL, /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .int_ep_config = \ - { \ - USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ - NULL, /* SETUP packet notification callback */ \ - qmkusbInterruptTransmitted, /* IN notification callback */ \ - NULL, /* OUT notification callback */ \ - CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ - 0, /* OUT maximum packet size */ \ - NULL, /* IN Endpoint state */ \ - NULL, /* OUT endpoint state */ \ - 2, /* IN multiplier */ \ - NULL, /* SETUP buffer (not a SETUP endpoint) */ \ - }, \ - .config = { \ - .usbp = &USB_DRIVER, \ - .bulk_in = stream##_IN_EPNUM, \ - .bulk_out = stream##_OUT_EPNUM, \ - .int_in = notification, \ - .in_buffers = stream##_IN_CAPACITY, \ - .out_buffers = stream##_OUT_CAPACITY, \ - .in_size = stream##_EPSIZE, \ - .out_size = stream##_EPSIZE, \ - .fixed_size = fixedsize, \ - .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ - .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ - } \ - } +# define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ + { \ + .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ + .in_ep_config = \ + { \ + stream##_IN_MODE, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + qmkusbDataTransmitted, /* IN notification callback */ \ + NULL, /* OUT notification callback */ \ + stream##_EPSIZE, /* IN maximum packet size */ \ + 0, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .out_ep_config = \ + { \ + stream##_OUT_MODE, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + NULL, /* IN notification callback */ \ + qmkusbDataReceived, /* OUT notification callback */ \ + 0, /* IN maximum packet size */ \ + stream##_EPSIZE, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL, /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .int_ep_config = \ + { \ + USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ + NULL, /* SETUP packet notification callback */ \ + qmkusbInterruptTransmitted, /* IN notification callback */ \ + NULL, /* OUT notification callback */ \ + CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ + 0, /* OUT maximum packet size */ \ + NULL, /* IN Endpoint state */ \ + NULL, /* OUT endpoint state */ \ + 2, /* IN multiplier */ \ + NULL, /* SETUP buffer (not a SETUP endpoint) */ \ + }, \ + .config = { \ + .usbp = &USB_DRIVER, \ + .bulk_in = stream##_IN_EPNUM, \ + .bulk_out = stream##_OUT_EPNUM, \ + .int_in = notification, \ + .in_buffers = stream##_IN_CAPACITY, \ + .out_buffers = stream##_OUT_CAPACITY, \ + .in_size = stream##_EPSIZE, \ + .out_size = stream##_EPSIZE, \ + .fixed_size = fixedsize, \ + .ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ + .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \ + } \ + } #endif typedef struct { @@ -388,12 +388,12 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) { usbInitEndpointI(usbp, SHARED_IN_EPNUM, &shared_ep_config); #endif for (int i = 0; i < NUM_USB_DRIVERS; i++) { - #if STM32_USB_USE_OTG1 +#if STM32_USB_USE_OTG1 usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].inout_ep_config); - #else +#else usbInitEndpointI(usbp, drivers.array[i].config.bulk_in, &drivers.array[i].in_ep_config); usbInitEndpointI(usbp, drivers.array[i].config.bulk_out, &drivers.array[i].out_ep_config); - #endif +#endif if (drivers.array[i].config.int_in) { usbInitEndpointI(usbp, drivers.array[i].config.int_in, &drivers.array[i].int_ep_config); } @@ -544,7 +544,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { #ifdef NKRO_ENABLE keymap_config.nkro = !!keyboard_protocol; if (!keymap_config.nkro && keyboard_idle) { -#else /* NKRO_ENABLE */ +#else /* NKRO_ENABLE */ if (keyboard_idle) { #endif /* NKRO_ENABLE */ /* arm the idle timer if boot protocol & idle */ @@ -562,7 +562,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) { /* arm the timer */ #ifdef NKRO_ENABLE if (!keymap_config.nkro && keyboard_idle) { -#else /* NKRO_ENABLE */ +#else /* NKRO_ENABLE */ if (keyboard_idle) { #endif /* NKRO_ENABLE */ osalSysLockFromISR(); @@ -618,21 +618,21 @@ static const USBConfig usbcfg = { */ void init_usb_driver(US |