From 6ea4b06f9fc19825605477cdc27f5bec0f3dc0a9 Mon Sep 17 00:00:00 2001 From: Ryan Date: Fri, 18 Dec 2020 01:06:30 +1100 Subject: [PATCH] Run cformat and dos2unix manually (#11235) --- drivers/chibios/ws2812_pwm.c | 12 +- drivers/chibios/ws2812_spi.c | 2 +- drivers/issi/is31fl3731-simple.c | 2 +- keyboards/mt64rgb/keymaps/default/readme.md | 6 +- keyboards/mt64rgb/readme.md | 32 +-- keyboards/zinc/keymaps/default/readme_en.md | 2 +- quantum/debounce/sym_defer_pk.c | 10 +- quantum/matrix.c | 20 +- quantum/split_common/matrix.c | 20 +- quantum/split_common/split_util.c | 8 +- .../protocol/arm_atsam/usb/udi_device_conf.h | 4 +- .../protocol/arm_atsam/usb/udi_hid_kbd_desc.c | 4 +- tmk_core/protocol/chibios/usb_main.c | 222 +++++++++--------- tmk_core/protocol/usb_descriptor.h | 52 ++-- util/pro_micro_ISP_B6_10.hex | Bin 16218 -> 15856 bytes 15 files changed, 188 insertions(+), 208 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(USBDriver *usbp) { for (int i = 0; i < NUM_USB_DRIVERS; i++) { - #if STM32_USB_USE_OTG1 +#if STM32_USB_USE_OTG1 QMKUSBDriver *driver = &drivers.array[i].driver; drivers.array[i].inout_ep_config.in_state = &drivers.array[i].in_ep_state; drivers.array[i].inout_ep_config.out_state = &drivers.array[i].out_ep_state; drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; qmkusbObjectInit(driver, &drivers.array[i].config); qmkusbStart(driver, &drivers.array[i].config); - #else +#else QMKUSBDriver *driver = &drivers.array[i].driver; drivers.array[i].in_ep_config.in_state = &drivers.array[i].in_ep_state; drivers.array[i].out_ep_config.out_state = &drivers.array[i].out_ep_state; drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state; qmkusbObjectInit(driver, &drivers.array[i].config); qmkusbStart(driver, &drivers.array[i].config); - #endif +#endif } /* @@ -689,7 +689,7 @@ static void keyboard_idle_timer_cb(void *arg) { #ifdef NKRO_ENABLE if (!keymap_config.nkro && keyboard_idle && keyboard_protocol) { -#else /* NKRO_ENABLE */ +#else /* NKRO_ENABLE */ if (keyboard_idle && keyboard_protocol) { #endif /* NKRO_ENABLE */ /* TODO: are we sure we want the KBD_ENDPOINT? */ @@ -738,7 +738,7 @@ void send_keyboard(report_keyboard_t *report) { usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)report, sizeof(struct nkro_report)); } else #endif /* NKRO_ENABLE */ - { /* regular protocol */ + { /* regular protocol */ /* need to wait until the previous packet has made it through */ /* busy wait, should be short and not very common */ if (usbGetTransmitStatusI(&USB_DRIVER, KEYBOARD_IN_EPNUM)) { @@ -805,7 +805,7 @@ void send_mouse(report_mouse_t *report) { osalSysUnlock(); } -#else /* MOUSE_ENABLE */ +#else /* MOUSE_ENABLE */ void send_mouse(report_mouse_t *report) { (void)report; } #endif /* MOUSE_ENABLE */ @@ -885,7 +885,7 @@ void console_task(void) { } while (size > 0); } -#else /* CONSOLE_ENABLE */ +#else /* CONSOLE_ENABLE */ int8_t sendchar(uint8_t c) { (void)c; return 0; diff --git a/tmk_core/protocol/usb_descriptor.h b/tmk_core/protocol/usb_descriptor.h index 1b43cbf3b2..3a7c0bdbac 100644 --- a/tmk_core/protocol/usb_descriptor.h +++ b/tmk_core/protocol/usb_descriptor.h @@ -204,12 +204,12 @@ enum usb_endpoints { #endif #ifdef RAW_ENABLE - RAW_IN_EPNUM = NEXT_EPNUM, - #if STM32_USB_USE_OTG1 - #define RAW_OUT_EPNUM RAW_IN_EPNUM - #else + RAW_IN_EPNUM = NEXT_EPNUM, +# if STM32_USB_USE_OTG1 +# define RAW_OUT_EPNUM RAW_IN_EPNUM +# else RAW_OUT_EPNUM = NEXT_EPNUM, - #endif +# endif #endif #ifdef SHARED_EP_ENABLE @@ -220,44 +220,44 @@ enum usb_endpoints { CONSOLE_IN_EPNUM = NEXT_EPNUM, # ifdef PROTOCOL_CHIBIOS - // ChibiOS has enough memory and descriptor to actually enable the endpoint - // It could use the same endpoint numbers, as that's supported by ChibiOS - // But the QMK code currently assumes that the endpoint numbers are different - #if STM32_USB_USE_OTG1 - #define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM - #else +// ChibiOS has enough memory and descriptor to actually enable the endpoint +// It could use the same endpoint numbers, as that's supported by ChibiOS +// But the QMK code currently assumes that the endpoint numbers are different +# if STM32_USB_USE_OTG1 +# define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM +# else CONSOLE_OUT_EPNUM = NEXT_EPNUM, - #endif +# endif # else # define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM # endif #endif #ifdef MIDI_ENABLE - MIDI_STREAM_IN_EPNUM = NEXT_EPNUM, - #if STM32_USB_USE_OTG1 - #define MIDI_STREAM_OUT_EPNUM MIDI_STREAM_IN_EPNUM - #else + MIDI_STREAM_IN_EPNUM = NEXT_EPNUM, +# if STM32_USB_USE_OTG1 +# define MIDI_STREAM_OUT_EPNUM MIDI_STREAM_IN_EPNUM +# else MIDI_STREAM_OUT_EPNUM = NEXT_EPNUM, - #endif +# endif #endif #ifdef VIRTSER_ENABLE CDC_NOTIFICATION_EPNUM = NEXT_EPNUM, CDC_IN_EPNUM = NEXT_EPNUM, - #if STM32_USB_USE_OTG1 - #define CDC_OUT_EPNUM CDC_IN_EPNUM - #else - CDC_OUT_EPNUM = NEXT_EPNUM, - #endif +# if STM32_USB_USE_OTG1 +# define CDC_OUT_EPNUM CDC_IN_EPNUM +# else + CDC_OUT_EPNUM = NEXT_EPNUM, +# endif #endif #ifdef JOYSTICK_ENABLE - JOYSTICK_IN_EPNUM = NEXT_EPNUM, - #if STM32_USB_USE_OTG1 + JOYSTICK_IN_EPNUM = NEXT_EPNUM, +# if STM32_USB_USE_OTG1 JOYSTICK_OUT_EPNUM = JOYSTICK_IN_EPNUM, - #else +# else JOYSTICK_OUT_EPNUM = NEXT_EPNUM, - #endif +# endif #endif }; diff --git a/util/pro_micro_ISP_B6_10.hex b/util/pro_micro_ISP_B6_10.hex index cf61bebb94c70e898eaf7114b48c6af556733c21..34ccbd2aefaab5b3b5d0b7331f095f706227a3e8 100644 GIT binary patch delta 1565 zcmXxkdw9)t9Ki8sGiGNuW}D3}#u&4Y`JJ7!o!>cQ3_D$<@<>`Pnah;Ob>td`a!HPl zM3jay||7TU(ttAfR#9gJ4mi2`ZNl$1*c%~6Lnx9JSf5yMAa6}!6>Xi z2`Z6PN3=VpViU^X?=Nac9_C{w$`Mglv?GRNIga2K5(7k^#AK|;3HVt=t>}xn*n#s1 z3lwdSp;(H8_!9|1qFpfoYjGSt!J?_?h1c*Y&LK2Jv@Kr1VicnSaiOA*VjNbX6nBwQ zPxKkg#8#X}P<>G+@}by+YiJZE`Vhw8eSCxe(6WJO4@}2q{DOdR(F_d00(^8MZRm&B@dYj-JW4bhFJT!D z<8L&L7JUMfuns?>RwGdZeJ}^x@jL3rh-TqMEWrWXMB`Y|$1omi@O`W-j1z5*XYndN z!C8dFi)P|^yor6df!M~Pk6(I0PM7cL>Pxo9Vhz&kjKf6y#Rv>T>i1Aap77NTi*4)gFi zE}%h6(GD1fw{Zx6p-Hmn0Bc=^CKmk_b815k1pav+!7My~`N)0d&9u(mUqSB}V zMqvd?P>CcPHNaGCLK*z+)Bt&ykDVw-L^?IVa4g3W+(KdoHNa%7#|ij3r~&$7E_UEN z!c1y_p;&5)f7R=-+HE?`nHXRa`7>89T#a*PdqcE6> rtvHRKEDD2sDE4F}=vn?D?Iq6QGSaLWj%+f}(J(S>%nv@R+ikfIzGwn0 delta 2276 zcmYM!A&eqt9ER~+Y0GvgN3ZnCUb!uM<$AP*mf?nF*rgkCM-Bu6fj}S-D-Z~BK_Ey< z8UzACn-K^EX%Gkm0)Ze6Vg&+$SV2+*0)ar#1c5+M{!h~_;+F~U^L=8({9XF%m*3ov z%)h%mM^ZvX=n3;9y77^yVg_qCz$IEfkS2s#)NzDsv>Bv{U>=(|#w|KNlqQZvY~vL7 z==w;SB$ly@Gc7`N!KNE62* zwsDGkbbTgG63f`d85*9*>cuoxv5yNheJ+iLw^+v^uFz_gCX6|3SUo25>9tQ$G*wX) z{nzU=lM=kTRH9d^KVsH5RQ50ATnr1?!U^us`Ba(&may~m;qIv1{r>#9F>v|Lr>JKA zK;iyU&ZMw{J)EP_Caa1Wtl~4*u@zdp3CaRG*+>X3pAZeqn-cvUf#Tw_wvX2nf~Xq6N5is*6S2QT%q-AITOYl zHt-HNXm>~x!veN&f;)6xNRz-4cJLk#=zbwh3M<&dIU2u_RmBX}aDYp+IHd_;7Ihrq z8f`D7iC`X^IL0kHzLh49MQq~~_vm^hO%lu4#Tgo0vU)L%RqW#eP2WkQ;Vss2h%2;y zFHIP8*uXp7p#2AFVpzZyPH=}#w=@YXVF&N=fNqa8DXd@*=V<&8rU7VreMpiGTZ!V6{C7wGso{QrfP+t22+MDAi>iC%osPf0ZKVLLz GKK%!YvlkBl