mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-15 12:29:26 +01:00
[HID] Now HID extends directly PluggableUSBListNode
This avoid duplicate instatiation of callback and save a considerable amount of flash.
This commit is contained in:
parent
5aeff8ec25
commit
5e14b1fe37
@ -36,6 +36,8 @@ HIDDescriptor _hidInterface;
|
|||||||
static HIDDescriptorListNode* rootNode = NULL;
|
static HIDDescriptorListNode* rootNode = NULL;
|
||||||
static uint16_t sizeof_hidReportDescriptor = 0;
|
static uint16_t sizeof_hidReportDescriptor = 0;
|
||||||
static uint8_t modules_count = 0;
|
static uint8_t modules_count = 0;
|
||||||
|
static uint8_t epType[] = { EP_TYPE_INTERRUPT_IN };
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
//================================================================================
|
//================================================================================
|
||||||
// Driver
|
// Driver
|
||||||
@ -132,18 +134,14 @@ bool HID_Setup(USBSetup& setup, uint8_t i)
|
|||||||
|
|
||||||
HID_::HID_(void)
|
HID_::HID_(void)
|
||||||
{
|
{
|
||||||
static uint8_t endpointType[1];
|
setup = &HID_Setup;
|
||||||
endpointType[0] = EP_TYPE_INTERRUPT_IN;
|
getInterface = &HID_GetInterface;
|
||||||
|
getDescriptor = &HID_GetDescriptor;
|
||||||
|
numEndpoints = 1;
|
||||||
|
numInterfaces = 1;
|
||||||
|
endpointType = epType;
|
||||||
|
|
||||||
static PUSBListNode node;
|
HID_ENDPOINT_INT = PluggableUSB.addFunction(this, &HID_INTERFACE);
|
||||||
node.setup = &HID_Setup,
|
|
||||||
node.getInterface = &HID_GetInterface,
|
|
||||||
node.getDescriptor = &HID_GetDescriptor,
|
|
||||||
node.numEndpoints = 1,
|
|
||||||
node.numInterfaces = 1,
|
|
||||||
node.endpointType = endpointType,
|
|
||||||
|
|
||||||
HID_ENDPOINT_INT = PluggableUSB.addFunction(&node, &HID_INTERFACE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int HID_::begin(void)
|
int HID_::begin(void)
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include "PluggableUSB.h"
|
||||||
|
|
||||||
#if defined(USBCON)
|
#if defined(USBCON)
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ public:
|
|||||||
uint16_t length;
|
uint16_t length;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HID_
|
class HID_ : public PUSBListNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HID_(void);
|
HID_(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user