mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-12-24 02:05:01 +06:00
Run cformat and dos2unix manually (#11235)
This commit is contained in:
parent
d9dcb716bf
commit
6ea4b06f9f
@ -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 ---------------------------------------------------- */
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
# Default mt4rgb Layout
|
||||
|
||||
This is the default layout that comes flashed on every mt64rgb. All key pins are shown in the file.
|
||||
|
@ -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).
|
||||
|
@ -1,4 +1,4 @@
|
||||
# The Default Zinc Layout
|
||||
# The Default Zinc Layout
|
||||
## layout
|
||||
|
||||
### Qwerty
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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++) {
|
||||
|
@ -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++) {
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user