Run cformat and dos2unix manually (#11235)

This commit is contained in:
Ryan 2020-12-18 01:06:30 +11:00 committed by GitHub
parent d9dcb716bf
commit 6ea4b06f9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 550 additions and 570 deletions

View file

@ -118,7 +118,7 @@
* *
* @return The bit index * @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 * @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 * @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 * @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 * @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) #elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_RGB)
/** /**
@ -155,7 +155,7 @@
* *
* @return The bit index * @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 * @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 * @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 * @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 * @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 #endif
/* --- PRIVATE VARIABLES ---------------------------------------------------- */ /* --- PRIVATE VARIABLES ---------------------------------------------------- */

View file

@ -75,7 +75,7 @@ uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}};
#elif LED_DRIVER_COUNT == 4 #elif LED_DRIVER_COUNT == 4
uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}}; uint8_t g_led_control_registers[LED_DRIVER_COUNT][18] = {{0}, {0}, {0}, {0}};
#endif #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 // This is the bit pattern in the LED control registers
// (for matrix A, add one to register for matrix B) // (for matrix A, add one to register for matrix B)

View file

@ -1,4 +1,4 @@
# The Default Zinc Layout # The Default Zinc Layout
## layout ## layout
### Qwerty ### Qwerty

View file

@ -38,12 +38,12 @@ static bool counters_need_update;
#define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1) #define MAX_DEBOUNCE (DEBOUNCE_ELAPSED - 1)
static uint8_t wrapping_timer_read(void) { static uint8_t wrapping_timer_read(void) {
static uint16_t time = 0; static uint16_t time = 0;
static uint8_t last_result = 0; static uint8_t last_result = 0;
uint16_t new_time = timer_read(); uint16_t new_time = timer_read();
uint16_t diff = new_time - time; uint16_t diff = new_time - time;
time = new_time; time = new_time;
last_result = (last_result + diff) % (MAX_DEBOUNCE + 1); last_result = (last_result + diff) % (MAX_DEBOUNCE + 1);
return last_result; return last_result;
} }

View file

@ -40,9 +40,7 @@ static inline void setPinOutput_writeLow(pin_t pin) {
} }
static inline void setPinInputHigh_atomic(pin_t pin) { static inline void setPinInputHigh_atomic(pin_t pin) {
ATOMIC_BLOCK_FORCEON { ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); }
setPinInputHigh(pin);
}
} }
// matrix code // 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) #elif defined(DIODE_DIRECTION)
# if (DIODE_DIRECTION == COL2ROW) # if (DIODE_DIRECTION == COL2ROW)
static void select_row(uint8_t row) { static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); }
setPinOutput_writeLow(row_pins[row]);
}
static void unselect_row(uint8_t row) { static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); }
setPinInputHigh_atomic(row_pins[row]);
}
static void unselect_rows(void) { static void unselect_rows(void) {
for (uint8_t x = 0; x < MATRIX_ROWS; x++) { 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) # elif (DIODE_DIRECTION == ROW2COL)
static void select_col(uint8_t col) { static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); }
setPinOutput_writeLow(col_pins[col]);
}
static void unselect_col(uint8_t col) { static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); }
setPinInputHigh_atomic(col_pins[col]);
}
static void unselect_cols(void) { static void unselect_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) { for (uint8_t x = 0; x < MATRIX_COLS; x++) {

View file

@ -53,9 +53,7 @@ static inline void setPinOutput_writeLow(pin_t pin) {
} }
static inline void setPinInputHigh_atomic(pin_t pin) { static inline void setPinInputHigh_atomic(pin_t pin) {
ATOMIC_BLOCK_FORCEON { ATOMIC_BLOCK_FORCEON { setPinInputHigh(pin); }
setPinInputHigh(pin);
}
} }
// matrix code // 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) #elif defined(DIODE_DIRECTION)
# if (DIODE_DIRECTION == COL2ROW) # if (DIODE_DIRECTION == COL2ROW)
static void select_row(uint8_t row) { static void select_row(uint8_t row) { setPinOutput_writeLow(row_pins[row]); }
setPinOutput_writeLow(row_pins[row]);
}
static void unselect_row(uint8_t row) { static void unselect_row(uint8_t row) { setPinInputHigh_atomic(row_pins[row]); }
setPinInputHigh_atomic(row_pins[row]);
}
static void unselect_rows(void) { static void unselect_rows(void) {
for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { 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) # elif (DIODE_DIRECTION == ROW2COL)
static void select_col(uint8_t col) { static void select_col(uint8_t col) { setPinOutput_writeLow(col_pins[col]); }
setPinOutput_writeLow(col_pins[col]);
}
static void unselect_col(uint8_t col) { static void unselect_col(uint8_t col) { setPinInputHigh_atomic(col_pins[col]); }
setPinInputHigh_atomic(col_pins[col]);
}
static void unselect_cols(void) { static void unselect_cols(void) {
for (uint8_t x = 0; x < MATRIX_COLS; x++) { for (uint8_t x = 0; x < MATRIX_COLS; x++) {

View file

@ -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); uint8_t pin_state = readPin(in_pin);
// Set out_pin to a setting that is less susceptible to noise. // Set out_pin to a setting that is less susceptible to noise.
setPinInputHigh(out_pin); 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; return pin_state;
} }
#endif #endif
@ -106,11 +106,11 @@ __attribute__((weak)) bool is_keyboard_left(void) {
setPinInput(SPLIT_HAND_PIN); setPinInput(SPLIT_HAND_PIN);
return readPin(SPLIT_HAND_PIN); return readPin(SPLIT_HAND_PIN);
#elif defined(SPLIT_HAND_MATRIX_GRID) #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); return peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID);
# else # else
return !peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID); return !peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID);
# endif # endif
#elif defined(EE_HANDS) #elif defined(EE_HANDS)
return eeconfig_read_handedness(); return eeconfig_read_handedness();
#elif defined(MASTER_RIGHT) #elif defined(MASTER_RIGHT)

View file

@ -291,7 +291,7 @@ typedef struct {
extern uint8_t udi_hid_kbd_report_set; extern uint8_t udi_hid_kbd_report_set;
// report buffer (to host) // 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]; extern uint8_t udi_hid_kbd_report[UDI_HID_KBD_REPORT_SIZE];
COMPILER_PACK_RESET() COMPILER_PACK_RESET()
@ -784,7 +784,7 @@ COMPILER_PACK_RESET()
COMPILER_PACK_SET(1) COMPILER_PACK_SET(1)
typedef struct { typedef struct {
usb_conf_desc_t conf; usb_conf_desc_t conf;
udi_hid_kbd_desc_t hid_kbd; udi_hid_kbd_desc_t hid_kbd;
#ifdef MOUSE_ENABLE #ifdef MOUSE_ENABLE
udi_hid_mou_desc_t hid_mou; udi_hid_mou_desc_t hid_mou;

View file

@ -83,7 +83,7 @@ UDC_DESC_STORAGE usb_dev_desc_t udc_device_desc = {.bLength = sizeof(usb
#ifdef USB_DEVICE_PRODUCT_NAME #ifdef USB_DEVICE_PRODUCT_NAME
.iProduct = 2, .iProduct = 2,
#else #else
.iProduct = 0, // No product string .iProduct = 0, // No product string
#endif #endif
#if (defined USB_DEVICE_SERIAL_NAME || defined USB_DEVICE_GET_SERIAL_NAME_POINTER) #if (defined USB_DEVICE_SERIAL_NAME || defined USB_DEVICE_GET_SERIAL_NAME_POINTER)
.iSerialNumber = 3, .iSerialNumber = 3,
@ -120,7 +120,7 @@ UDC_DESC_STORAGE udc_desc_t udc_desc = {
.conf.iConfiguration = 0, .conf.iConfiguration = 0,
.conf.bmAttributes = /* USB_CONFIG_ATTR_MUST_SET | */ USB_DEVICE_ATTR, .conf.bmAttributes = /* USB_CONFIG_ATTR_MUST_SET | */ USB_DEVICE_ATTR,
.conf.bMaxPower = USB_CONFIG_MAX_POWER(USB_DEVICE_POWER), .conf.bMaxPower = USB_CONFIG_MAX_POWER(USB_DEVICE_POWER),
.hid_kbd = UDI_HID_KBD_DESC, .hid_kbd = UDI_HID_KBD_DESC,
#ifdef RAW_ENABLE #ifdef RAW_ENABLE
.hid_raw = UDI_HID_RAW_DESC, .hid_raw = UDI_HID_RAW_DESC,
#endif #endif

View file

@ -194,107 +194,107 @@ typedef struct {
#if STM32_USB_USE_OTG1 #if STM32_USB_USE_OTG1
/* Reusable initialization structure - see USBEndpointConfig comment at top of file */ /* Reusable initialization structure - see USBEndpointConfig comment at top of file */
#define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ # define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \
{ \ { \
.queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \
.inout_ep_config = \ .inout_ep_config = \
{ \ { \
stream##_IN_MODE, /* Interrupt EP */ \ stream##_IN_MODE, /* Interrupt EP */ \
NULL, /* SETUP packet notification callback */ \ NULL, /* SETUP packet notification callback */ \
qmkusbDataTransmitted, /* IN notification callback */ \ qmkusbDataTransmitted, /* IN notification callback */ \
qmkusbDataReceived, /* OUT notification callback */ \ qmkusbDataReceived, /* OUT notification callback */ \
stream##_EPSIZE, /* IN maximum packet size */ \ stream##_EPSIZE, /* IN maximum packet size */ \
stream##_EPSIZE, /* OUT maximum packet size */ \ stream##_EPSIZE, /* OUT maximum packet size */ \
NULL, /* IN Endpoint state */ \ NULL, /* IN Endpoint state */ \
NULL, /* OUT endpoint state */ \ NULL, /* OUT endpoint state */ \
2, /* IN multiplier */ \ 2, /* IN multiplier */ \
NULL /* SETUP buffer (not a SETUP endpoint) */ \ NULL /* SETUP buffer (not a SETUP endpoint) */ \
}, \ }, \
.int_ep_config = \ .int_ep_config = \
{ \ { \
USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \
NULL, /* SETUP packet notification callback */ \ NULL, /* SETUP packet notification callback */ \
qmkusbInterruptTransmitted, /* IN notification callback */ \ qmkusbInterruptTransmitted, /* IN notification callback */ \
NULL, /* OUT notification callback */ \ NULL, /* OUT notification callback */ \
CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \
0, /* OUT maximum packet size */ \ 0, /* OUT maximum packet size */ \
NULL, /* IN Endpoint state */ \ NULL, /* IN Endpoint state */ \
NULL, /* OUT endpoint state */ \ NULL, /* OUT endpoint state */ \
2, /* IN multiplier */ \ 2, /* IN multiplier */ \
NULL, /* SETUP buffer (not a SETUP endpoint) */ \ NULL, /* SETUP buffer (not a SETUP endpoint) */ \
}, \ }, \
.config = { \ .config = { \
.usbp = &USB_DRIVER, \ .usbp = &USB_DRIVER, \
.bulk_in = stream##_IN_EPNUM, \ .bulk_in = stream##_IN_EPNUM, \
.bulk_out = stream##_OUT_EPNUM, \ .bulk_out = stream##_OUT_EPNUM, \
.int_in = notification, \ .int_in = notification, \
.in_buffers = stream##_IN_CAPACITY, \ .in_buffers = stream##_IN_CAPACITY, \
.out_buffers = stream##_OUT_CAPACITY, \ .out_buffers = stream##_OUT_CAPACITY, \
.in_size = stream##_EPSIZE, \ .in_size = stream##_EPSIZE, \
.out_size = stream##_EPSIZE, \ .out_size = stream##_EPSIZE, \
.fixed_size = fixedsize, \ .fixed_size = fixedsize, \
.ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ .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)]){}, \ .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \
} \ } \
} }
#else #else
/* Reusable initialization structure - see USBEndpointConfig comment at top of file */ /* Reusable initialization structure - see USBEndpointConfig comment at top of file */
#define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \ # define QMK_USB_DRIVER_CONFIG(stream, notification, fixedsize) \
{ \ { \
.queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \ .queue_capacity_in = stream##_IN_CAPACITY, .queue_capacity_out = stream##_OUT_CAPACITY, \
.in_ep_config = \ .in_ep_config = \
{ \ { \
stream##_IN_MODE, /* Interrupt EP */ \ stream##_IN_MODE, /* Interrupt EP */ \
NULL, /* SETUP packet notification callback */ \ NULL, /* SETUP packet notification callback */ \
qmkusbDataTransmitted, /* IN notification callback */ \ qmkusbDataTransmitted, /* IN notification callback */ \
NULL, /* OUT notification callback */ \ NULL, /* OUT notification callback */ \
stream##_EPSIZE, /* IN maximum packet size */ \ stream##_EPSIZE, /* IN maximum packet size */ \
0, /* OUT maximum packet size */ \ 0, /* OUT maximum packet size */ \
NULL, /* IN Endpoint state */ \ NULL, /* IN Endpoint state */ \
NULL, /* OUT endpoint state */ \ NULL, /* OUT endpoint state */ \
2, /* IN multiplier */ \ 2, /* IN multiplier */ \
NULL /* SETUP buffer (not a SETUP endpoint) */ \ NULL /* SETUP buffer (not a SETUP endpoint) */ \
}, \ }, \
.out_ep_config = \ .out_ep_config = \
{ \ { \
stream##_OUT_MODE, /* Interrupt EP */ \ stream##_OUT_MODE, /* Interrupt EP */ \
NULL, /* SETUP packet notification callback */ \ NULL, /* SETUP packet notification callback */ \
NULL, /* IN notification callback */ \ NULL, /* IN notification callback */ \
qmkusbDataReceived, /* OUT notification callback */ \ qmkusbDataReceived, /* OUT notification callback */ \
0, /* IN maximum packet size */ \ 0, /* IN maximum packet size */ \
stream##_EPSIZE, /* OUT maximum packet size */ \ stream##_EPSIZE, /* OUT maximum packet size */ \
NULL, /* IN Endpoint state */ \ NULL, /* IN Endpoint state */ \
NULL, /* OUT endpoint state */ \ NULL, /* OUT endpoint state */ \
2, /* IN multiplier */ \ 2, /* IN multiplier */ \
NULL, /* SETUP buffer (not a SETUP endpoint) */ \ NULL, /* SETUP buffer (not a SETUP endpoint) */ \
}, \ }, \
.int_ep_config = \ .int_ep_config = \
{ \ { \
USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \ USB_EP_MODE_TYPE_INTR, /* Interrupt EP */ \
NULL, /* SETUP packet notification callback */ \ NULL, /* SETUP packet notification callback */ \
qmkusbInterruptTransmitted, /* IN notification callback */ \ qmkusbInterruptTransmitted, /* IN notification callback */ \
NULL, /* OUT notification callback */ \ NULL, /* OUT notification callback */ \
CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \ CDC_NOTIFICATION_EPSIZE, /* IN maximum packet size */ \
0, /* OUT maximum packet size */ \ 0, /* OUT maximum packet size */ \
NULL, /* IN Endpoint state */ \ NULL, /* IN Endpoint state */ \
NULL, /* OUT endpoint state */ \ NULL, /* OUT endpoint state */ \
2, /* IN multiplier */ \ 2, /* IN multiplier */ \
NULL, /* SETUP buffer (not a SETUP endpoint) */ \ NULL, /* SETUP buffer (not a SETUP endpoint) */ \
}, \ }, \
.config = { \ .config = { \
.usbp = &USB_DRIVER, \ .usbp = &USB_DRIVER, \
.bulk_in = stream##_IN_EPNUM, \ .bulk_in = stream##_IN_EPNUM, \
.bulk_out = stream##_OUT_EPNUM, \ .bulk_out = stream##_OUT_EPNUM, \
.int_in = notification, \ .int_in = notification, \
.in_buffers = stream##_IN_CAPACITY, \ .in_buffers = stream##_IN_CAPACITY, \
.out_buffers = stream##_OUT_CAPACITY, \ .out_buffers = stream##_OUT_CAPACITY, \
.in_size = stream##_EPSIZE, \ .in_size = stream##_EPSIZE, \
.out_size = stream##_EPSIZE, \ .out_size = stream##_EPSIZE, \
.fixed_size = fixedsize, \ .fixed_size = fixedsize, \
.ib = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_IN_CAPACITY, stream##_EPSIZE)]){}, \ .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)]){}, \ .ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \
} \ } \
} }
#endif #endif
typedef struct { typedef struct {
@ -388,12 +388,12 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) {
usbInitEndpointI(usbp, SHARED_IN_EPNUM, &shared_ep_config); usbInitEndpointI(usbp, SHARED_IN_EPNUM, &shared_ep_config);
#endif #endif
for (int i = 0; i < NUM_USB_DRIVERS; i++) { 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); 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_in, &drivers.array[i].in_ep_config);
usbInitEndpointI(usbp, drivers.array[i].config.bulk_out, &drivers.array[i].out_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) { if (drivers.array[i].config.int_in) {
usbInitEndpointI(usbp, drivers.array[i].config.int_in, &drivers.array[i].int_ep_config); 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 #ifdef NKRO_ENABLE
keymap_config.nkro = !!keyboard_protocol; keymap_config.nkro = !!keyboard_protocol;
if (!keymap_config.nkro && keyboard_idle) { if (!keymap_config.nkro && keyboard_idle) {
#else /* NKRO_ENABLE */ #else /* NKRO_ENABLE */
if (keyboard_idle) { if (keyboard_idle) {
#endif /* NKRO_ENABLE */ #endif /* NKRO_ENABLE */
/* arm the idle timer if boot protocol & idle */ /* arm the idle timer if boot protocol & idle */
@ -562,7 +562,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
/* arm the timer */ /* arm the timer */
#ifdef NKRO_ENABLE #ifdef NKRO_ENABLE
if (!keymap_config.nkro && keyboard_idle) { if (!keymap_config.nkro && keyboard_idle) {
#else /* NKRO_ENABLE */ #else /* NKRO_ENABLE */
if (keyboard_idle) { if (keyboard_idle) {
#endif /* NKRO_ENABLE */ #endif /* NKRO_ENABLE */
osalSysLockFromISR(); osalSysLockFromISR();
@ -618,21 +618,21 @@ static const USBConfig usbcfg = {
*/ */
void init_usb_driver(USBDriver *usbp) { void init_usb_driver(USBDriver *usbp) {
for (int i = 0; i < NUM_USB_DRIVERS; i++) { 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; 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.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].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; drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state;
qmkusbObjectInit(driver, &drivers.array[i].config); qmkusbObjectInit(driver, &drivers.array[i].config);
qmkusbStart(driver, &drivers.array[i].config); qmkusbStart(driver, &drivers.array[i].config);
#else #else
QMKUSBDriver *driver = &drivers.array[i].driver; QMKUSBDriver *driver = &drivers.array[i].driver;
drivers.array[i].in_ep_config.in_state = &drivers.array[i].in_ep_state; 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].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; drivers.array[i].int_ep_config.in_state = &drivers.array[i].int_ep_state;
qmkusbObjectInit(driver, &drivers.array[i].config); qmkusbObjectInit(driver, &drivers.array[i].config);
qmkusbStart(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 #ifdef NKRO_ENABLE
if (!keymap_config.nkro && keyboard_idle && keyboard_protocol) { if (!keymap_config.nkro && keyboard_idle && keyboard_protocol) {
#else /* NKRO_ENABLE */ #else /* NKRO_ENABLE */
if (keyboard_idle && keyboard_protocol) { if (keyboard_idle && keyboard_protocol) {
#endif /* NKRO_ENABLE */ #endif /* NKRO_ENABLE */
/* TODO: are we sure we want the KBD_ENDPOINT? */ /* 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)); usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)report, sizeof(struct nkro_report));
} else } else
#endif /* NKRO_ENABLE */ #endif /* NKRO_ENABLE */
{ /* regular protocol */ { /* regular protocol */
/* need to wait until the previous packet has made it through */ /* need to wait until the previous packet has made it through */
/* busy wait, should be short and not very common */ /* busy wait, should be short and not very common */
if (usbGetTransmitStatusI(&USB_DRIVER, KEYBOARD_IN_EPNUM)) { if (usbGetTransmitStatusI(&USB_DRIVER, KEYBOARD_IN_EPNUM)) {
@ -805,7 +805,7 @@ void send_mouse(report_mouse_t *report) {
osalSysUnlock(); osalSysUnlock();
} }
#else /* MOUSE_ENABLE */ #else /* MOUSE_ENABLE */
void send_mouse(report_mouse_t *report) { (void)report; } void send_mouse(report_mouse_t *report) { (void)report; }
#endif /* MOUSE_ENABLE */ #endif /* MOUSE_ENABLE */
@ -885,7 +885,7 @@ void console_task(void) {
} while (size > 0); } while (size > 0);
} }
#else /* CONSOLE_ENABLE */ #else /* CONSOLE_ENABLE */
int8_t sendchar(uint8_t c) { int8_t sendchar(uint8_t c) {
(void)c; (void)c;
return 0; return 0;

View file

@ -204,12 +204,12 @@ enum usb_endpoints {
#endif #endif
#ifdef RAW_ENABLE #ifdef RAW_ENABLE
RAW_IN_EPNUM = NEXT_EPNUM, RAW_IN_EPNUM = NEXT_EPNUM,
#if STM32_USB_USE_OTG1 # if STM32_USB_USE_OTG1
#define RAW_OUT_EPNUM RAW_IN_EPNUM # define RAW_OUT_EPNUM RAW_IN_EPNUM
#else # else
RAW_OUT_EPNUM = NEXT_EPNUM, RAW_OUT_EPNUM = NEXT_EPNUM,
#endif # endif
#endif #endif
#ifdef SHARED_EP_ENABLE #ifdef SHARED_EP_ENABLE
@ -220,44 +220,44 @@ enum usb_endpoints {
CONSOLE_IN_EPNUM = NEXT_EPNUM, CONSOLE_IN_EPNUM = NEXT_EPNUM,
# ifdef PROTOCOL_CHIBIOS # ifdef PROTOCOL_CHIBIOS
// ChibiOS has enough memory and descriptor to actually enable the endpoint // ChibiOS has enough memory and descriptor to actually enable the endpoint
// It could use the same endpoint numbers, as that's supported by ChibiOS // 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 // But the QMK code currently assumes that the endpoint numbers are different
#if STM32_USB_USE_OTG1 # if STM32_USB_USE_OTG1
#define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM # define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM
#else # else
CONSOLE_OUT_EPNUM = NEXT_EPNUM, CONSOLE_OUT_EPNUM = NEXT_EPNUM,
#endif # endif
# else # else
# define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM # define CONSOLE_OUT_EPNUM CONSOLE_IN_EPNUM
# endif # endif
#endif #endif
#ifdef MIDI_ENABLE #ifdef MIDI_ENABLE
MIDI_STREAM_IN_EPNUM = NEXT_EPNUM, MIDI_STREAM_IN_EPNUM = NEXT_EPNUM,
#if STM32_USB_USE_OTG1 # if STM32_USB_USE_OTG1
#define MIDI_STREAM_OUT_EPNUM MIDI_STREAM_IN_EPNUM # define MIDI_STREAM_OUT_EPNUM MIDI_STREAM_IN_EPNUM
#else # else
MIDI_STREAM_OUT_EPNUM = NEXT_EPNUM, MIDI_STREAM_OUT_EPNUM = NEXT_EPNUM,
#endif # endif
#endif #endif
#ifdef VIRTSER_ENABLE #ifdef VIRTSER_ENABLE
CDC_NOTIFICATION_EPNUM = NEXT_EPNUM, CDC_NOTIFICATION_EPNUM = NEXT_EPNUM,
CDC_IN_EPNUM = NEXT_EPNUM, CDC_IN_EPNUM = NEXT_EPNUM,
#if STM32_USB_USE_OTG1 # if STM32_USB_USE_OTG1
#define CDC_OUT_EPNUM CDC_IN_EPNUM # define CDC_OUT_EPNUM CDC_IN_EPNUM
#else # else
CDC_OUT_EPNUM = NEXT_EPNUM, CDC_OUT_EPNUM = NEXT_EPNUM,
#endif # endif
#endif #endif
#ifdef JOYSTICK_ENABLE #ifdef JOYSTICK_ENABLE
JOYSTICK_IN_EPNUM = NEXT_EPNUM, JOYSTICK_IN_EPNUM = NEXT_EPNUM,
#if STM32_USB_USE_OTG1 # if STM32_USB_USE_OTG1
JOYSTICK_OUT_EPNUM = JOYSTICK_IN_EPNUM, JOYSTICK_OUT_EPNUM = JOYSTICK_IN_EPNUM,
#else # else
JOYSTICK_OUT_EPNUM = NEXT_EPNUM, JOYSTICK_OUT_EPNUM = NEXT_EPNUM,
#endif # endif
#endif #endif
}; };