mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-10-02 06:49:16 +02:00
tmk_core: temporary fix to allow HT32 based keyboards to work without patched ChibiOS-contrib (AnnePro2)
This commit is contained in:
@@ -103,7 +103,7 @@ static const USBDescriptor *usb_get_descriptor_cb(USBDriver *usbp, uint8_t dtype
|
||||
static USBDescriptor desc;
|
||||
uint16_t wValue = ((uint16_t)dtype << 8) | dindex;
|
||||
desc.ud_string = NULL;
|
||||
desc.ud_size = get_usb_descriptor(wValue, wIndex, (const void **const) & desc.ud_string);
|
||||
desc.ud_size = get_usb_descriptor(wValue, wIndex, (const void **const)&desc.ud_string);
|
||||
if (desc.ud_string == NULL)
|
||||
return NULL;
|
||||
else
|
||||
@@ -122,9 +122,13 @@ static const USBEndpointConfig kbd_ep_config = {
|
||||
KEYBOARD_EPSIZE, /* IN maximum packet size */
|
||||
0, /* OUT maximum packet size */
|
||||
&kbd_ep_state, /* IN Endpoint state */
|
||||
NULL, /* OUT endpoint state */
|
||||
2, /* IN multiplier */
|
||||
NULL /* SETUP buffer (not a SETUP endpoint) */
|
||||
# ifndef MCU_HT32
|
||||
NULL, /* OUT endpoint state */
|
||||
2, /* IN multiplier */
|
||||
NULL /* SETUP buffer (not a SETUP endpoint) */
|
||||
# else
|
||||
NULL /* OUT endpoint state */
|
||||
# endif
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -141,9 +145,13 @@ static const USBEndpointConfig mouse_ep_config = {
|
||||
MOUSE_EPSIZE, /* IN maximum packet size */
|
||||
0, /* OUT maximum packet size */
|
||||
&mouse_ep_state, /* IN Endpoint state */
|
||||
NULL, /* OUT endpoint state */
|
||||
2, /* IN multiplier */
|
||||
NULL /* SETUP buffer (not a SETUP endpoint) */
|
||||
# ifndef MCU_HT32
|
||||
NULL, /* OUT endpoint state */
|
||||
2, /* IN multiplier */
|
||||
NULL /* SETUP buffer (not a SETUP endpoint) */
|
||||
# else
|
||||
NULL /* OUT endpoint state */
|
||||
# endif
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -160,9 +168,13 @@ static const USBEndpointConfig shared_ep_config = {
|
||||
SHARED_EPSIZE, /* IN maximum packet size */
|
||||
0, /* OUT maximum packet size */
|
||||
&shared_ep_state, /* IN Endpoint state */
|
||||
NULL, /* OUT endpoint state */
|
||||
2, /* IN multiplier */
|
||||
NULL /* SETUP buffer (not a SETUP endpoint) */
|
||||
# ifndef MCU_HT32
|
||||
NULL, /* OUT endpoint state */
|
||||
2, /* IN multiplier */
|
||||
NULL /* SETUP buffer (not a SETUP endpoint) */
|
||||
# else
|
||||
NULL /* OUT endpoint state */
|
||||
# endif
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -238,6 +250,48 @@ typedef struct {
|
||||
.ob = (__attribute__((aligned(4))) uint8_t[BQ_BUFFER_SIZE(stream##_OUT_CAPACITY, stream##_EPSIZE)]){}, \
|
||||
} \
|
||||
}
|
||||
#elif defined(MCU_HT32)
|
||||
# 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_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}, \
|
||||
.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}, \
|
||||
.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) \
|
||||
|
||||
Reference in New Issue
Block a user