aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-09-07 00:41:24 +1000
committerDrashna Jaelre <drashna@live.com>2019-09-06 07:41:24 -0700
commit7ffed07310b4dcf53235bfd8a1700aefd0437f90 (patch)
treecd47b2474d0d8b10b1a62ef466cafd7a83cb81ab
parentf8bf1d1b16848f2d82d4c61b6a8df3f22aa15859 (diff)
downloadqmk_firmware-7ffed07310b4dcf53235bfd8a1700aefd0437f90.tar.gz
qmk_firmware-7ffed07310b4dcf53235bfd8a1700aefd0437f90.zip
Make USB polling rate configurable with a define (#6668)
-rw-r--r--docs/config_options.md4
-rw-r--r--tmk_core/protocol/usb_descriptor.c10
2 files changed, 10 insertions, 4 deletions
diff --git a/docs/config_options.md b/docs/config_options.md
index d2ae56179..77e2368f3 100644
--- a/docs/config_options.md
+++ b/docs/config_options.md
@@ -91,8 +91,10 @@ This is a C header file that is one of the first things included, and will persi
91 * tries to keep switch state consistent with keyboard LED state 91 * tries to keep switch state consistent with keyboard LED state
92* `#define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT)` 92* `#define IS_COMMAND() (get_mods() == MOD_MASK_SHIFT)`
93 * key combination that allows the use of magic commands (useful for debugging) 93 * key combination that allows the use of magic commands (useful for debugging)
94* `#define USB_MAX_POWER_CONSUMPTION` 94* `#define USB_MAX_POWER_CONSUMPTION 500`
95 * sets the maximum power (in mA) over USB for the device (default: 500) 95 * sets the maximum power (in mA) over USB for the device (default: 500)
96* `#define USB_POLLING_INTERVAL_MS 10`
97 * sets the USB polling rate in milliseconds for the keyboard, mouse, and shared (NKRO/media keys) interfaces
96* `#define F_SCL 100000L` 98* `#define F_SCL 100000L`
97 * sets the I2C clock rate speed for keyboards using I2C. The default is `400000L`, except for keyboards using `split_common`, where the default is `100000L`. 99 * sets the I2C clock rate speed for keyboards using I2C. The default is `400000L`, except for keyboards using `split_common`, where the default is `100000L`.
98 100
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index 5349553b7..7d509f4ef 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -302,6 +302,10 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = {.Header = {.
302# define USB_MAX_POWER_CONSUMPTION 500 302# define USB_MAX_POWER_CONSUMPTION 500
303#endif 303#endif
304 304
305#ifndef USB_POLLING_INTERVAL_MS
306# define USB_POLLING_INTERVAL_MS 10
307#endif
308
305/* 309/*
306 * Configuration descriptors 310 * Configuration descriptors
307 */ 311 */
@@ -324,7 +328,7 @@ const USB_Descriptor_Configuration_t PROGMEM
324 328
325 .InterfaceStrIndex = NO_DESCRIPTOR}, 329 .InterfaceStrIndex = NO_DESCRIPTOR},
326 .Keyboard_HID = {.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, .HIDSpec = VERSION_BCD(1, 1, 1), .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, .HIDReportLength = sizeof(KeyboardReport)}, 330 .Keyboard_HID = {.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, .HIDSpec = VERSION_BCD(1, 1, 1), .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, .HIDReportLength = sizeof(KeyboardReport)},
327 .Keyboard_INEndpoint = {.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM), .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = KEYBOARD_EPSIZE, .PollingIntervalMS = 0x0A}, 331 .Keyboard_INEndpoint = {.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_IN | KEYBOARD_IN_EPNUM), .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = KEYBOARD_EPSIZE, .PollingIntervalMS = USB_POLLING_INTERVAL_MS},
328#endif 332#endif
329 333
330#if defined(MOUSE_ENABLE) && !defined(MOUSE_SHARED_EP) 334#if defined(MOUSE_ENABLE) && !defined(MOUSE_SHARED_EP)
@@ -333,7 +337,7 @@ const USB_Descriptor_Configuration_t PROGMEM
333 */ 337 */
334 .Mouse_Interface = {.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, .InterfaceNumber = MOUSE_INTERFACE, .AlternateSetting = 0x00, .TotalEndpoints = 1, .Class = HID_CSCP_HIDClass, .SubClass = HID_CSCP_BootSubclass, .Protocol = HID_CSCP_MouseBootProtocol, .InterfaceStrIndex = NO_DESCRIPTOR}, 338 .Mouse_Interface = {.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, .InterfaceNumber = MOUSE_INTERFACE, .AlternateSetting = 0x00, .TotalEndpoints = 1, .Class = HID_CSCP_HIDClass, .SubClass = HID_CSCP_BootSubclass, .Protocol = HID_CSCP_MouseBootProtocol, .InterfaceStrIndex = NO_DESCRIPTOR},
335 .Mouse_HID = {.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, .HIDSpec = VERSION_BCD(1, 1, 1), .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, .HIDReportLength = sizeof(MouseReport)}, 339 .Mouse_HID = {.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, .HIDSpec = VERSION_BCD(1, 1, 1), .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, .HIDReportLength = sizeof(MouseReport)},
336 .Mouse_INEndpoint = {.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_IN_EPNUM), .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = MOUSE_EPSIZE, .PollingIntervalMS = 0x0A}, 340 .Mouse_INEndpoint = {.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_IN | MOUSE_IN_EPNUM), .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = MOUSE_EPSIZE, .PollingIntervalMS = USB_POLLING_INTERVAL_MS},
337#endif 341#endif
338 342
339#ifdef SHARED_EP_ENABLE 343#ifdef SHARED_EP_ENABLE
@@ -354,7 +358,7 @@ const USB_Descriptor_Configuration_t PROGMEM
354# endif 358# endif
355 .InterfaceStrIndex = NO_DESCRIPTOR}, 359 .InterfaceStrIndex = NO_DESCRIPTOR},
356 .Shared_HID = {.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, .HIDSpec = VERSION_BCD(1, 1, 1), .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, .HIDReportLength = sizeof(SharedReport)}, 360 .Shared_HID = {.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID}, .HIDSpec = VERSION_BCD(1, 1, 1), .CountryCode = 0x00, .TotalReportDescriptors = 1, .HIDReportType = HID_DTYPE_Report, .HIDReportLength = sizeof(SharedReport)},
357 .Shared_INEndpoint = {.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_IN | SHARED_IN_EPNUM), .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = SHARED_EPSIZE, .PollingIntervalMS = 0x0A}, 361 .Shared_INEndpoint = {.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, .EndpointAddress = (ENDPOINT_DIR_IN | SHARED_IN_EPNUM), .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), .EndpointSize = SHARED_EPSIZE, .PollingIntervalMS = USB_POLLING_INTERVAL_MS},
358#endif 362#endif
359 363
360#ifdef RAW_ENABLE 364#ifdef RAW_ENABLE