Satisfy cpplint

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
f/driver/keyboardiohid
Michael Richters 3 years ago
parent 5659368d76
commit 05cb04b3ce
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -147,11 +147,11 @@ bool BootKeyboard_::setup(USBSetup& setup) {
if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) { if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) {
if (request == HID_GET_REPORT) { if (request == HID_GET_REPORT) {
// TODO: HID_GetReport(); // TODO(anyone): HID_GetReport();
return true; return true;
} }
if (request == HID_GET_PROTOCOL) { if (request == HID_GET_PROTOCOL) {
// TODO improve // TODO(anyone) improve
#ifdef __AVR__ #ifdef __AVR__
UEDATX = protocol; UEDATX = protocol;
#endif #endif
@ -161,7 +161,7 @@ bool BootKeyboard_::setup(USBSetup& setup) {
return true; return true;
} }
if (request == HID_GET_IDLE) { if (request == HID_GET_IDLE) {
// TODO improve // TODO(anyone) improve
#ifdef __AVR__ #ifdef __AVR__
UEDATX = idle; UEDATX = idle;
#endif #endif
@ -212,10 +212,8 @@ bool BootKeyboard_::setup(USBSetup& setup) {
// ------------------------------------------------------------ */ // ------------------------------------------------------------ */
return true; return true;
} }
} } else if (setup.wValueH == HID_REPORT_TYPE_INPUT) {
// Input (set HID report) // Input (set HID report)
else if (setup.wValueH == HID_REPORT_TYPE_INPUT) {
if (length == sizeof(report_)) { if (length == sizeof(report_)) {
USB_RecvControl(&report_, length); USB_RecvControl(&report_, length);
return true; return true;

@ -45,7 +45,7 @@ typedef union {
class BootKeyboard_ : public PluggableUSBModule { class BootKeyboard_ : public PluggableUSBModule {
public: public:
BootKeyboard_(uint8_t protocol_ = HID_REPORT_PROTOCOL); explicit BootKeyboard_(uint8_t protocol_ = HID_REPORT_PROTOCOL);
size_t press(uint8_t k); size_t press(uint8_t k);
void begin(); void begin();
void end(); void end();

@ -140,8 +140,12 @@ int USB_SendControl(uint8_t x, const void* y, uint8_t z);
#define ARCH_HAS_CONFIGURABLE_EP_SIZES #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_IN(uint8_t buffer_size) {
constexpr uint16_t EP_TYPE_INTERRUPT_OUT(uint8_t buffer_size) { return EPDesc(USB_TRX_OUT, USB_EP_ATTR_INT, buffer_size).val; } 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;
}

@ -132,15 +132,15 @@ bool HID_::setup(USBSetup& setup) {
if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) { if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) {
if (request == HID_GET_REPORT) { if (request == HID_GET_REPORT) {
// TODO: HID_GetReport(); // TODO(anyone): HID_GetReport();
return true; return true;
} }
if (request == HID_GET_PROTOCOL) { if (request == HID_GET_PROTOCOL) {
// TODO: Send8(protocol); // TODO(anyone): Send8(protocol);
return true; return true;
} }
if (request == HID_GET_IDLE) { if (request == HID_GET_IDLE) {
// TODO: Send8(idle); // TODO(anyone): Send8(idle);
} }
} }

@ -16,8 +16,7 @@
SOFTWARE. SOFTWARE.
*/ */
#ifndef HID_h #pragma once
#define HID_h
#include <stdint.h> #include <stdint.h>
#include <Arduino.h> #include <Arduino.h>
@ -97,7 +96,7 @@ class HID_ : public PluggableUSBModule {
void AppendDescriptor(HIDSubDescriptor* node); void AppendDescriptor(HIDSubDescriptor* node);
uint8_t getLEDs() { uint8_t getLEDs() {
return setReportData.leds; return setReportData.leds;
}; }
protected: protected:
// Implementation of the PluggableUSBModule // 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) } #define D_HIDREPORT(length) { 9, 0x21, 0x01, 0x01, 0, 1, 0x22, lowByte(length), highByte(length) }
#endif // USBCON #endif // USBCON
#endif // HID_h

@ -236,10 +236,8 @@ size_t Keyboard_::press(uint8_t k) {
uint8_t bit = 1 << (uint8_t(k) % 8); uint8_t bit = 1 << (uint8_t(k) % 8);
report_.keys[k / 8] |= bit; report_.keys[k / 8] |= bit;
return 1; return 1;
} } else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) {
// It's a modifier key // It's a modifier key
else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) {
// Convert key into bitfield (0 - 7) // Convert key into bitfield (0 - 7)
k = k - HID_KEYBOARD_FIRST_MODIFIER; k = k - HID_KEYBOARD_FIRST_MODIFIER;
report_.modifiers |= (1 << k); report_.modifiers |= (1 << k);
@ -256,10 +254,8 @@ size_t Keyboard_::release(uint8_t k) {
uint8_t bit = 1 << (k % 8); uint8_t bit = 1 << (k % 8);
report_.keys[k / 8] &= ~bit; report_.keys[k / 8] &= ~bit;
return 1; return 1;
} } else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) {
// It's a modifier key // It's a modifier key
else if (k >= HID_KEYBOARD_FIRST_MODIFIER && k <= HID_KEYBOARD_LAST_MODIFIER) {
// Convert key into bitfield (0 - 7) // Convert key into bitfield (0 - 7)
k = k - HID_KEYBOARD_FIRST_MODIFIER; k = k - HID_KEYBOARD_FIRST_MODIFIER;
report_.modifiers &= ~(1 << k); report_.modifiers &= ~(1 << k);

@ -65,7 +65,7 @@ class Keyboard_ {
uint8_t getLEDs() { uint8_t getLEDs() {
return HID().getLEDs(); return HID().getLEDs();
}; }
private: private:
HID_KeyboardReport_Data_t report_; HID_KeyboardReport_Data_t report_;

@ -27,7 +27,7 @@ THE SOFTWARE.
#include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h" #include "kaleidoscope/driver/hid/keyboardio/usb/DescriptorPrimitives.h"
static const uint8_t system_control_hid_descriptor_[] PROGMEM = { 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, ...) */ /* System Control (Power Down, Sleep, Wakeup, ...) */
D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, /* USAGE_PAGE (Generic Desktop) */ D_USAGE_PAGE, D_PAGE_GENERIC_DESKTOP, /* USAGE_PAGE (Generic Desktop) */
D_USAGE, 0x80, /* USAGE (System Control) */ D_USAGE, 0x80, /* USAGE (System Control) */

@ -97,11 +97,11 @@ bool SingleAbsoluteMouse_::setup(USBSetup& setup) {
if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) { if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE) {
if (request == HID_GET_REPORT) { if (request == HID_GET_REPORT) {
// TODO: HID_GetReport(); // TODO(anyone): HID_GetReport();
return true; return true;
} }
if (request == HID_GET_PROTOCOL) { if (request == HID_GET_PROTOCOL) {
// TODO: Send8(protocol); // TODO(anyone): Send8(protocol);
return true; return true;
} }
} }

@ -48,6 +48,6 @@ class SingleAbsoluteMouse_ : public PluggableUSBModule, public AbsoluteMouseAPI
uint8_t protocol; uint8_t protocol;
uint8_t idle; uint8_t idle;
virtual inline void sendReport(void* data, int length) override; inline void sendReport(void* data, int length) override;
}; };
extern SingleAbsoluteMouse_ SingleAbsoluteMouse; extern SingleAbsoluteMouse_ SingleAbsoluteMouse;

Loading…
Cancel
Save