summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-11-15 10:21:22 +1100
committerFlorian Didron <fdidron@users.noreply.github.com>2020-01-09 08:57:11 +0900
commitc17675f50acc2a1f2403832468928be1ff955c89 (patch)
tree0386e03a0ffffe80b85dac3433459c0c139acb4d
parent8e52dc41b46e8d87c2b67db69d100cf161b8d8b2 (diff)
Add support for configurable polling interval and power usage o… (#7336)
* Add support for custom polling interval and power usage on V-USB boards * Use 1ms as default for now
-rw-r--r--quantum/template/ps2avrgb/usbconfig.h10
-rw-r--r--tmk_core/protocol/vusb/vusb.c15
2 files changed, 12 insertions, 13 deletions
diff --git a/quantum/template/ps2avrgb/usbconfig.h b/quantum/template/ps2avrgb/usbconfig.h
index 9ef232f045..75f318b991 100644
--- a/quantum/template/ps2avrgb/usbconfig.h
+++ b/quantum/template/ps2avrgb/usbconfig.h
@@ -98,20 +98,10 @@ section at the end of this file).
* (e.g. HID), but never want to send any data. This option saves a couple
* of bytes in flash memory and the transmit buffers in RAM.
*/
-#define USB_CFG_INTR_POLL_INTERVAL 1
-/* If you compile a version with endpoint 1 (interrupt-in), this is the poll
- * interval. The value is in milliseconds and must not be less than 10 ms for
- * low speed devices.
- */
#define USB_CFG_IS_SELF_POWERED 0
/* Define this to 1 if the device has its own power supply. Set it to 0 if the
* device is powered from the USB bus.
*/
-#define USB_CFG_MAX_BUS_POWER 500
-/* Set this variable to the maximum USB bus power consumption of your device.
- * The value is in milliamperes. [It will be divided by two since USB
- * communicates power requirements in units of 2 mA.]
- */
#define USB_CFG_IMPLEMENT_FN_WRITE 1
/* Set this to 1 if you want usbFunctionWrite() to be called for control-out
* transfers. Set it to 0 if you don't need it and want to save a couple of
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 3719b7aa0f..72445e00bb 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -345,6 +345,15 @@ const PROGMEM uchar mouse_hid_report[] = {
0xc0, // END_COLLECTION
};
+#ifndef USB_MAX_POWER_CONSUMPTION
+# define USB_MAX_POWER_CONSUMPTION 500
+#endif
+
+// TODO: change this to 10ms to match LUFA
+#ifndef USB_POLLING_INTERVAL_MS
+# define USB_POLLING_INTERVAL_MS 1
+#endif
+
/*
* Descriptor for compite device: Keyboard + Mouse
*
@@ -366,7 +375,7 @@ const PROGMEM char usbDescriptorConfiguration[] = {
# else
(1 << 7), /* attributes */
# endif
- USB_CFG_MAX_BUS_POWER / 2, /* max USB current in 2mA units */
+ USB_MAX_POWER_CONSUMPTION / 2, /* max USB current in 2mA units */
/*
* Keyboard interface
@@ -393,7 +402,7 @@ const PROGMEM char usbDescriptorConfiguration[] = {
(char)0x81, /* IN endpoint number 1 */
0x03, /* attrib: Interrupt endpoint */
8, 0, /* maximum packet size */
- USB_CFG_INTR_POLL_INTERVAL, /* in ms */
+ USB_POLLING_INTERVAL_MS, /* in ms */
# endif
/*
@@ -424,7 +433,7 @@ const PROGMEM char usbDescriptorConfiguration[] = {
(char)(0x80 | USB_CFG_EP3_NUMBER), /* IN endpoint number 3 */
0x03, /* attrib: Interrupt endpoint */
8, 0, /* maximum packet size */
- USB_CFG_INTR_POLL_INTERVAL, /* in ms */
+ USB_POLLING_INTERVAL_MS, /* in ms */
# endif
};
#endif