Skip to content

Commit

Permalink
cpplint's required corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
obra committed Dec 14, 2023
1 parent 0b63199 commit 601a855
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 25 deletions.
12 changes: 5 additions & 7 deletions plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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) {
} else if (setup.wValueH == HID_REPORT_TYPE_INPUT) {
if (length == sizeof(report_)) {
USB_RecvControl(&report_, length);
return true;
Expand Down Expand Up @@ -412,4 +410,4 @@ BootKeyboard_ &
BootKeyboard() {
static BootKeyboard_ obj;
return obj;
};
}
2 changes: 1 addition & 1 deletion plugins/KeyboardioHID/src/BootKeyboard/BootKeyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion plugins/KeyboardioHID/src/HID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 3 additions & 6 deletions plugins/KeyboardioHID/src/HID.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
SOFTWARE.
*/

#ifndef HID_h
#define HID_h
#pragma once

#include <stdint.h>
#include <Arduino.h>
Expand Down Expand Up @@ -97,7 +96,7 @@ class HID_ : public PluggableUSBModule {
void AppendDescriptor(HIDSubDescriptor *node);
uint8_t getLEDs() {
return setReportData.leds;
};
}

protected:
// Implementation of the PluggableUSBModule
Expand All @@ -120,7 +119,7 @@ class HID_ : public PluggableUSBModule {
uint8_t reportId;
uint8_t leds;
} setReportData;
};
}

// Replacement for global singleton.
// This function prevents static-initialization-order-fiasco
Expand All @@ -131,5 +130,3 @@ HID_ &HID();
{ 9, 0x21, 0x01, 0x01, 0, 1, 0x22, lowByte(length), highByte(length) }

#endif // USBCON

#endif // HID_h
8 changes: 2 additions & 6 deletions plugins/KeyboardioHID/src/MultiReport/Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
} 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);
Expand All @@ -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) {
} 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);
Expand Down
2 changes: 1 addition & 1 deletion plugins/KeyboardioHID/src/MultiReport/Keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Keyboard_ {

uint8_t getLEDs() {
return HID().getLEDs();
};
}

private:
HID_KeyboardReport_Data_t report_;
Expand Down
2 changes: 1 addition & 1 deletion plugins/KeyboardioHID/src/MultiReport/SystemControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 601a855

Please sign in to comment.