diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/BootKeyboard/BootKeyboard.cpp b/src/kaleidoscope/driver/hid/keyboardio/usb/BootKeyboard/BootKeyboard.cpp index 05ad759f..36d0a093 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/BootKeyboard/BootKeyboard.cpp +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/BootKeyboard/BootKeyboard.cpp @@ -147,11 +147,11 @@ bool BootKeyboard_::setup(USBSetup& setup) { if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) { if (request == HID_GET_REPORT) { - // TODO: HID_GetReport(); + // TODO(anyone): HID_GetReport(); return true; } if (request == HID_GET_PROTOCOL) { - // TODO improve + // TODO(anyone) improve #ifdef __AVR__ UEDATX = protocol; #endif @@ -161,7 +161,7 @@ bool BootKeyboard_::setup(USBSetup& setup) { return true; } if (request == HID_GET_IDLE) { - // TODO improve + // TODO(anyone) improve #ifdef __AVR__ UEDATX = idle; #endif @@ -212,10 +212,8 @@ bool BootKeyboard_::setup(USBSetup& setup) { // ------------------------------------------------------------ */ return true; } - } - - // Input (set HID report) - else if (setup.wValueH == HID_REPORT_TYPE_INPUT) { + } else if (setup.wValueH == HID_REPORT_TYPE_INPUT) { + // Input (set HID report) if (length == sizeof(report_)) { USB_RecvControl(&report_, length); return true; diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/BootKeyboard/BootKeyboard.h b/src/kaleidoscope/driver/hid/keyboardio/usb/BootKeyboard/BootKeyboard.h index 873cca9a..c7fddb7d 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/BootKeyboard/BootKeyboard.h +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/BootKeyboard/BootKeyboard.h @@ -45,7 +45,7 @@ typedef union { class BootKeyboard_ : public PluggableUSBModule { public: - BootKeyboard_(uint8_t protocol_ = HID_REPORT_PROTOCOL); + explicit BootKeyboard_(uint8_t protocol_ = HID_REPORT_PROTOCOL); size_t press(uint8_t k); void begin(); void end(); diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/HID-Settings.h b/src/kaleidoscope/driver/hid/keyboardio/usb/HID-Settings.h index 7eff1e09..0c0f871b 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/HID-Settings.h +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/HID-Settings.h @@ -140,8 +140,12 @@ int USB_SendControl(uint8_t x, const void* y, uint8_t z); #define ARCH_HAS_CONFIGURABLE_EP_SIZES -constexpr uint16_t EP_TYPE_INTERRUPT_IN(uint8_t buffer_size) { return EPDesc(USB_TRX_IN, USB_EP_ATTR_INT, buffer_size).val; } -constexpr uint16_t EP_TYPE_INTERRUPT_OUT(uint8_t buffer_size) { return EPDesc(USB_TRX_OUT, USB_EP_ATTR_INT, buffer_size).val; } +constexpr uint16_t EP_TYPE_INTERRUPT_IN(uint8_t buffer_size) { + return EPDesc(USB_TRX_IN, USB_EP_ATTR_INT, buffer_size).val; +} +constexpr uint16_t EP_TYPE_INTERRUPT_OUT(uint8_t buffer_size) { + return EPDesc(USB_TRX_OUT, USB_EP_ATTR_INT, buffer_size).val; +} diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/HID_.cpp b/src/kaleidoscope/driver/hid/keyboardio/usb/HID_.cpp index ce19d723..71e9e938 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/HID_.cpp +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/HID_.cpp @@ -132,15 +132,15 @@ bool HID_::setup(USBSetup& setup) { if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) { if (request == HID_GET_REPORT) { - // TODO: HID_GetReport(); + // TODO(anyone): HID_GetReport(); return true; } if (request == HID_GET_PROTOCOL) { - // TODO: Send8(protocol); + // TODO(anyone): Send8(protocol); return true; } if (request == HID_GET_IDLE) { - // TODO: Send8(idle); + // TODO(anyone): Send8(idle); } } diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/HID_.h b/src/kaleidoscope/driver/hid/keyboardio/usb/HID_.h index 22604bb7..48a87f7e 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/HID_.h +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/HID_.h @@ -16,8 +16,7 @@ SOFTWARE. */ -#ifndef HID_h -#define HID_h +#pragma once #include #include @@ -97,7 +96,7 @@ class HID_ : public PluggableUSBModule { void AppendDescriptor(HIDSubDescriptor* node); uint8_t getLEDs() { return setReportData.leds; - }; + } protected: // Implementation of the PluggableUSBModule @@ -129,5 +128,3 @@ HID_& HID(); #define D_HIDREPORT(length) { 9, 0x21, 0x01, 0x01, 0, 1, 0x22, lowByte(length), highByte(length) } #endif // USBCON - -#endif // HID_h diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/Keyboard.cpp b/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/Keyboard.cpp index 6f51f719..d13e30db 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/Keyboard.cpp +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/Keyboard.cpp @@ -236,10 +236,8 @@ size_t Keyboard_::press(uint8_t k) { uint8_t bit = 1 << (uint8_t(k) % 8); report_.keys[k / 8] |= bit; return 1; - } - - // It's a modifier key - else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) { + } else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) { + // It's a modifier key // Convert key into bitfield (0 - 7) k = k - HID_KEYBOARD_FIRST_MODIFIER; report_.modifiers |= (1 << k); @@ -256,10 +254,8 @@ size_t Keyboard_::release(uint8_t k) { uint8_t bit = 1 << (k % 8); report_.keys[k / 8] &= ~bit; return 1; - } - - // It's a modifier key - else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) { + } else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) { + // It's a modifier key // Convert key into bitfield (0 - 7) k = k - HID_KEYBOARD_FIRST_MODIFIER; report_.modifiers &= ~(1 << k); diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/Keyboard.h b/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/Keyboard.h index 381f5b16..c85e7244 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/Keyboard.h +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/Keyboard.h @@ -65,7 +65,7 @@ class Keyboard_ { uint8_t getLEDs() { return HID().getLEDs(); - }; + } private: HID_KeyboardReport_Data_t report_; diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/SystemControl.cpp b/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/SystemControl.cpp index 13bc2ae0..66a4c1f8 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/SystemControl.cpp +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/MultiReport/SystemControl.cpp @@ -27,7 +27,7 @@ THE SOFTWARE. #include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h" static const uint8_t system_control_hid_descriptor_[] PROGMEM = { - //TODO limit to system keys only? + //TODO(anyone) limit to system keys only? /* System Control (Power Down, Sleep, Wakeup, ...) */ D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, /* USAGE_PAGE (Generic Desktop) */ D_USAGE, 0x80, /* USAGE (System Control) */ diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/SingleReport/SingleAbsoluteMouse.cpp b/src/kaleidoscope/driver/hid/keyboardio/usb/SingleReport/SingleAbsoluteMouse.cpp index c5230301..1bab6158 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/SingleReport/SingleAbsoluteMouse.cpp +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/SingleReport/SingleAbsoluteMouse.cpp @@ -97,11 +97,11 @@ bool SingleAbsoluteMouse_::setup(USBSetup& setup) { if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) { if (request == HID_GET_REPORT) { - // TODO: HID_GetReport(); + // TODO(anyone): HID_GetReport(); return true; } if (request == HID_GET_PROTOCOL) { - // TODO: Send8(protocol); + // TODO(anyone): Send8(protocol); return true; } } diff --git a/src/kaleidoscope/driver/hid/keyboardio/usb/SingleReport/SingleAbsoluteMouse.h b/src/kaleidoscope/driver/hid/keyboardio/usb/SingleReport/SingleAbsoluteMouse.h index 97f44fac..dc2e3975 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/usb/SingleReport/SingleAbsoluteMouse.h +++ b/src/kaleidoscope/driver/hid/keyboardio/usb/SingleReport/SingleAbsoluteMouse.h @@ -48,6 +48,6 @@ class SingleAbsoluteMouse_ : public PluggableUSBModule, public AbsoluteMouseAPI uint8_t protocol; uint8_t idle; - virtual inline void sendReport(void* data, int length) override; + inline void sendReport(void* data, int length) override; }; extern SingleAbsoluteMouse_ SingleAbsoluteMouse;