From d68740c1731c56414f4e8c7039287dfb1ae0b248 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Thu, 14 Dec 2023 13:48:51 -0800 Subject: [PATCH] cpplint's required corrections --- .../src/BootKeyboard/BootKeyboard.cpp | 14 ++++++-------- .../KeyboardioHID/src/BootKeyboard/BootKeyboard.h | 2 +- plugins/KeyboardioHID/src/HID.cpp | 2 +- plugins/KeyboardioHID/src/HID.h | 7 ++----- plugins/KeyboardioHID/src/MultiReport/Keyboard.cpp | 12 ++++-------- plugins/KeyboardioHID/src/MultiReport/Keyboard.h | 2 +- .../src/MultiReport/SystemControl.cpp | 2 +- .../src/SingleReport/SingleAbsoluteMouse.cpp | 2 +- .../src/SingleReport/SingleAbsoluteMouse.h | 2 +- 9 files changed, 18 insertions(+), 27 deletions(-) diff --git a/plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.cpp b/plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.cpp index dc865ffe8b..30a2dbcc7b 100644 --- a/plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.cpp +++ b/plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.cpp @@ -169,11 +169,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 #if defined(__AVR__) UEDATX = protocol; #elif defined(ARDUINO_ARCH_SAM) @@ -184,7 +184,7 @@ bool BootKeyboard_::setup(USBSetup &setup) { return true; } if (request == HID_GET_IDLE) { - // TODO improve + // TODO(anyone) improve #if defined(__AVR__) UEDATX = idle; #elif defined(ARDUINO_ARCH_SAM) @@ -214,10 +214,8 @@ bool BootKeyboard_::setup(USBSetup &setup) { USB_RecvControl(&leds, length); return true; } - } - - // Input (set HID report) - else if (setup.wValueH == HID_REPORT_TYPE_INPUT) { + // Input (set HID report) + } else if (setup.wValueH == HID_REPORT_TYPE_INPUT) { if (length == sizeof(report_)) { USB_RecvControl(&report_, length); return true; @@ -412,4 +410,4 @@ BootKeyboard_ & BootKeyboard() { static BootKeyboard_ obj; return obj; -}; +} diff --git a/plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.h b/plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.h index 9cb1d199ee..d83f6c734e 100644 --- a/plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.h +++ b/plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.h @@ -44,7 +44,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/plugins/KeyboardioHID/src/HID.cpp b/plugins/KeyboardioHID/src/HID.cpp index 2f347d2971..835c957811 100644 --- a/plugins/KeyboardioHID/src/HID.cpp +++ b/plugins/KeyboardioHID/src/HID.cpp @@ -129,7 +129,7 @@ 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) { diff --git a/plugins/KeyboardioHID/src/HID.h b/plugins/KeyboardioHID/src/HID.h index 3f9a96c889..7e14c0ea28 100644 --- a/plugins/KeyboardioHID/src/HID.h +++ b/plugins/KeyboardioHID/src/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 @@ -131,5 +130,3 @@ HID_ &HID(); { 9, 0x21, 0x01, 0x01, 0, 1, 0x22, lowByte(length), highByte(length) } #endif // USBCON - -#endif // HID_h diff --git a/plugins/KeyboardioHID/src/MultiReport/Keyboard.cpp b/plugins/KeyboardioHID/src/MultiReport/Keyboard.cpp index e72c052efd..2b24cfea7d 100644 --- a/plugins/KeyboardioHID/src/MultiReport/Keyboard.cpp +++ b/plugins/KeyboardioHID/src/MultiReport/Keyboard.cpp @@ -267,10 +267,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) { + // It's a modifier key + } else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) { // Convert key into bitfield (0 - 7) k = k - HID_KEYBOARD_FIRST_MODIFIER; report_.modifiers |= (1 << k); @@ -287,10 +285,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) { + // It's a modifier key + } else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) { // Convert key into bitfield (0 - 7) k = k - HID_KEYBOARD_FIRST_MODIFIER; report_.modifiers &= ~(1 << k); diff --git a/plugins/KeyboardioHID/src/MultiReport/Keyboard.h b/plugins/KeyboardioHID/src/MultiReport/Keyboard.h index 85543f4e60..e5dffc53a2 100644 --- a/plugins/KeyboardioHID/src/MultiReport/Keyboard.h +++ b/plugins/KeyboardioHID/src/MultiReport/Keyboard.h @@ -66,7 +66,7 @@ class Keyboard_ { uint8_t getLEDs() { return HID().getLEDs(); - }; + } private: HID_KeyboardReport_Data_t report_; diff --git a/plugins/KeyboardioHID/src/MultiReport/SystemControl.cpp b/plugins/KeyboardioHID/src/MultiReport/SystemControl.cpp index 40eb389c60..60f9e5b253 100644 --- a/plugins/KeyboardioHID/src/MultiReport/SystemControl.cpp +++ b/plugins/KeyboardioHID/src/MultiReport/SystemControl.cpp @@ -27,7 +27,7 @@ THE SOFTWARE. #include "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) */ diff --git a/plugins/KeyboardioHID/src/SingleReport/SingleAbsoluteMouse.cpp b/plugins/KeyboardioHID/src/SingleReport/SingleAbsoluteMouse.cpp index 70fb474615..fc78a09233 100644 --- a/plugins/KeyboardioHID/src/SingleReport/SingleAbsoluteMouse.cpp +++ b/plugins/KeyboardioHID/src/SingleReport/SingleAbsoluteMouse.cpp @@ -100,7 +100,7 @@ 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) { diff --git a/plugins/KeyboardioHID/src/SingleReport/SingleAbsoluteMouse.h b/plugins/KeyboardioHID/src/SingleReport/SingleAbsoluteMouse.h index c92c83549d..557ed3294d 100644 --- a/plugins/KeyboardioHID/src/SingleReport/SingleAbsoluteMouse.h +++ b/plugins/KeyboardioHID/src/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;