mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Janitorial, whitespace fixes. No new code.
This commit is contained in:
parent
b8fb19fb90
commit
f1af9b08ec
54 changed files with 1370 additions and 1310 deletions
5
BTD.h
5
BTD.h
|
@ -262,12 +262,15 @@ public:
|
||||||
virtual bool isReady() {
|
virtual bool isReady() {
|
||||||
return bPollEnable;
|
return bPollEnable;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by the USB core to check what this driver support.
|
* Used by the USB core to check what this driver support.
|
||||||
* @param klass The device's USB class.
|
* @param klass The device's USB class.
|
||||||
* @return Returns true if the device's USB class matches this driver.
|
* @return Returns true if the device's USB class matches this driver.
|
||||||
*/
|
*/
|
||||||
virtual boolean DEVCLASSOK(uint8_t klass) { return (klass == USB_CLASS_WIRELESS_CTRL); }
|
virtual boolean DEVCLASSOK(uint8_t klass) {
|
||||||
|
return (klass == USB_CLASS_WIRELESS_CTRL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by the USB core to check what this driver support.
|
* Used by the USB core to check what this driver support.
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
|
|
||||||
BTHID::BTHID(BTD *p, bool pair, const char *pin) :
|
BTHID::BTHID(BTD *p, bool pair, const char *pin) :
|
||||||
pBtd(p), // pointer to USB class instance - mandatory
|
pBtd(p), // pointer to USB class instance - mandatory
|
||||||
protocolMode(HID_BOOT_PROTOCOL)
|
protocolMode(HID_BOOT_PROTOCOL) {
|
||||||
{
|
|
||||||
for(uint8_t i = 0; i < NUM_PARSERS; i++)
|
for(uint8_t i = 0; i < NUM_PARSERS; i++)
|
||||||
pRptParser[i] = NULL;
|
pRptParser[i] = NULL;
|
||||||
|
|
||||||
|
@ -376,6 +375,7 @@ void BTHID::Run() {
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* HID Commands */
|
/* HID Commands */
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
void BTHID::setProtocol() {
|
void BTHID::setProtocol() {
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
|
|
1
BTHID.h
1
BTHID.h
|
@ -48,6 +48,7 @@ public:
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
/** Used this to disconnect any of the controllers. */
|
/** Used this to disconnect any of the controllers. */
|
||||||
virtual void disconnect();
|
virtual void disconnect();
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
HIDReportParser *GetReportParser(uint8_t id) {
|
HIDReportParser *GetReportParser(uint8_t id) {
|
||||||
|
|
1
PS3BT.h
1
PS3BT.h
|
@ -143,6 +143,7 @@ public:
|
||||||
* @param value See: ::LED enum.
|
* @param value See: ::LED enum.
|
||||||
*/
|
*/
|
||||||
void setLedRaw(uint8_t value);
|
void setLedRaw(uint8_t value);
|
||||||
|
|
||||||
/** Turn all LEDs off. */
|
/** Turn all LEDs off. */
|
||||||
void setLedOff() {
|
void setLedOff() {
|
||||||
setLedRaw(0);
|
setLedRaw(0);
|
||||||
|
|
1
PS3USB.h
1
PS3USB.h
|
@ -220,6 +220,7 @@ public:
|
||||||
* @param value See: ::LED enum.
|
* @param value See: ::LED enum.
|
||||||
*/
|
*/
|
||||||
void setLedRaw(uint8_t value);
|
void setLedRaw(uint8_t value);
|
||||||
|
|
||||||
/** Turn all LEDs off. */
|
/** Turn all LEDs off. */
|
||||||
void setLedOff() {
|
void setLedOff() {
|
||||||
setLedRaw(0);
|
setLedRaw(0);
|
||||||
|
|
4
SPP.cpp
4
SPP.cpp
|
@ -723,18 +723,22 @@ bool SPP::checkFcs(uint8_t *data, uint8_t fcs) {
|
||||||
|
|
||||||
/* Serial commands */
|
/* Serial commands */
|
||||||
#if defined(ARDUINO) && ARDUINO >=100
|
#if defined(ARDUINO) && ARDUINO >=100
|
||||||
|
|
||||||
size_t SPP::write(uint8_t data) {
|
size_t SPP::write(uint8_t data) {
|
||||||
return write(&data, 1);
|
return write(&data, 1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void SPP::write(uint8_t data) {
|
void SPP::write(uint8_t data) {
|
||||||
write(&data, 1);
|
write(&data, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO) && ARDUINO >=100
|
#if defined(ARDUINO) && ARDUINO >=100
|
||||||
|
|
||||||
size_t SPP::write(const uint8_t *data, size_t size) {
|
size_t SPP::write(const uint8_t *data, size_t size) {
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void SPP::write(const uint8_t *data, size_t size) {
|
void SPP::write(const uint8_t *data, size_t size) {
|
||||||
#endif
|
#endif
|
||||||
for(uint8_t i = 0; i < size; i++) {
|
for(uint8_t i = 0; i < size; i++) {
|
||||||
|
|
1
SPP.h
1
SPP.h
|
@ -98,6 +98,7 @@ public:
|
||||||
* @return Return the number of bytes ready to be read.
|
* @return Return the number of bytes ready to be read.
|
||||||
*/
|
*/
|
||||||
virtual int available(void);
|
virtual int available(void);
|
||||||
|
|
||||||
/** Send out all bytes in the buffer. */
|
/** Send out all bytes in the buffer. */
|
||||||
virtual void flush(void) {
|
virtual void flush(void) {
|
||||||
send();
|
send();
|
||||||
|
|
5
Usb.cpp
5
Usb.cpp
|
@ -229,8 +229,8 @@ uint8_t USB::InTransfer(EpInfo *pep, uint16_t nak_limit, uint16_t *nbytesptr, ui
|
||||||
*nbytesptr = 0;
|
*nbytesptr = 0;
|
||||||
regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
|
regWr(rHCTL, (pep->bmRcvToggle) ? bmRCVTOG1 : bmRCVTOG0); //set toggle value
|
||||||
|
|
||||||
while (1) // use a 'return' to exit this loop
|
// use a 'break' to exit this loop
|
||||||
{
|
while(1) {
|
||||||
rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS.
|
rcode = dispatchPkt(tokIN, pep->epAddr, nak_limit); //IN packet to EP-'endpoint'. Function takes care of NAKS.
|
||||||
if(rcode == hrTOGERR) {
|
if(rcode == hrTOGERR) {
|
||||||
// yes, we flip it wrong here so that next time it is actually correct!
|
// yes, we flip it wrong here so that next time it is actually correct!
|
||||||
|
@ -807,4 +807,3 @@ uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(USB_METHODS_INLINE)
|
#endif // defined(USB_METHODS_INLINE)
|
||||||
|
|
||||||
|
|
41
UsbCore.h
41
UsbCore.h
|
@ -104,14 +104,38 @@ typedef MAX3421e<P10, P9> MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega
|
||||||
|
|
||||||
class USBDeviceConfig {
|
class USBDeviceConfig {
|
||||||
public:
|
public:
|
||||||
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed) { return 0; }
|
|
||||||
virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {return 0; }
|
virtual uint8_t Init(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
virtual uint8_t Release() { return 0; }
|
return 0;
|
||||||
virtual uint8_t Poll() { return 0; }
|
}
|
||||||
virtual uint8_t GetAddress() { return 0; }
|
|
||||||
virtual void ResetHubPort(uint8_t port) { return; } // Note used for hubs only!
|
virtual uint8_t ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||||
virtual boolean VIDPIDOK(uint16_t vid, uint16_t pid) { return false; }
|
return 0;
|
||||||
virtual boolean DEVCLASSOK(uint8_t klass) { return false; }
|
}
|
||||||
|
|
||||||
|
virtual uint8_t Release() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint8_t Poll() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual uint8_t GetAddress() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void ResetHubPort(uint8_t port) {
|
||||||
|
return;
|
||||||
|
} // Note used for hubs only!
|
||||||
|
|
||||||
|
virtual boolean VIDPIDOK(uint16_t vid, uint16_t pid) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual boolean DEVCLASSOK(uint8_t klass) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* USB Setup Packet Structure */
|
/* USB Setup Packet Structure */
|
||||||
|
@ -251,4 +275,3 @@ inline uint8_t USB::setConf(uint8_t addr, uint8_t ep, uint8_t conf_value) {
|
||||||
#endif // defined(USB_METHODS_INLINE)
|
#endif // defined(USB_METHODS_INLINE)
|
||||||
|
|
||||||
#endif /* USBCORE_H */
|
#endif /* USBCORE_H */
|
||||||
|
|
||||||
|
|
1
Wii.cpp
1
Wii.cpp
|
@ -878,6 +878,7 @@ void WII::setLedRaw(uint8_t value) {
|
||||||
HIDBuffer[2] = value | (HIDBuffer[2] & 0x01); // Keep the rumble bit
|
HIDBuffer[2] = value | (HIDBuffer[2] & 0x01); // Keep the rumble bit
|
||||||
HID_Command(HIDBuffer, 3);
|
HID_Command(HIDBuffer, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WII::setLedOff(LED a) {
|
void WII::setLedOff(LED a) {
|
||||||
HIDBuffer[1] = 0x11;
|
HIDBuffer[1] = 0x11;
|
||||||
HIDBuffer[2] &= ~(pgm_read_byte(&LEDS[(uint8_t)a]));
|
HIDBuffer[2] &= ~(pgm_read_byte(&LEDS[(uint8_t)a]));
|
||||||
|
|
7
Wii.h
7
Wii.h
|
@ -85,6 +85,7 @@ public:
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/** @name Wii Controller functions */
|
/** @name Wii Controller functions */
|
||||||
|
|
||||||
/** Call this to start the paring sequence with a controller */
|
/** Call this to start the paring sequence with a controller */
|
||||||
void pair(void) {
|
void pair(void) {
|
||||||
if(pBtd)
|
if(pBtd)
|
||||||
|
@ -147,6 +148,7 @@ public:
|
||||||
* @param value See: ::LED enum.
|
* @param value See: ::LED enum.
|
||||||
*/
|
*/
|
||||||
void setLedRaw(uint8_t value);
|
void setLedRaw(uint8_t value);
|
||||||
|
|
||||||
/** Turn all LEDs off. */
|
/** Turn all LEDs off. */
|
||||||
void setLedOff() {
|
void setLedOff() {
|
||||||
setLedRaw(0);
|
setLedRaw(0);
|
||||||
|
@ -180,6 +182,7 @@ public:
|
||||||
* @return The battery level in the range 0-255.
|
* @return The battery level in the range 0-255.
|
||||||
*/
|
*/
|
||||||
uint8_t getBatteryLevel();
|
uint8_t getBatteryLevel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Wiimote state.
|
* Return the Wiimote state.
|
||||||
* @return See: http://wiibrew.org/wiki/Wiimote#0x20:_Status.
|
* @return See: http://wiibrew.org/wiki/Wiimote#0x20:_Status.
|
||||||
|
@ -211,20 +214,24 @@ public:
|
||||||
/* IMU Data, might be usefull if you need to do something more advanced than just calculating the angle */
|
/* IMU Data, might be usefull if you need to do something more advanced than just calculating the angle */
|
||||||
|
|
||||||
/**@{*/
|
/**@{*/
|
||||||
|
|
||||||
/** Pitch and roll calculated from the accelerometer inside the Wiimote. */
|
/** Pitch and roll calculated from the accelerometer inside the Wiimote. */
|
||||||
double getWiimotePitch() {
|
double getWiimotePitch() {
|
||||||
return (atan2(accYwiimote, accZwiimote) + PI) * RAD_TO_DEG;
|
return (atan2(accYwiimote, accZwiimote) + PI) * RAD_TO_DEG;
|
||||||
};
|
};
|
||||||
|
|
||||||
double getWiimoteRoll() {
|
double getWiimoteRoll() {
|
||||||
return (atan2(accXwiimote, accZwiimote) + PI) * RAD_TO_DEG;
|
return (atan2(accXwiimote, accZwiimote) + PI) * RAD_TO_DEG;
|
||||||
};
|
};
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
/**@{*/
|
/**@{*/
|
||||||
|
|
||||||
/** Pitch and roll calculated from the accelerometer inside the Nunchuck. */
|
/** Pitch and roll calculated from the accelerometer inside the Nunchuck. */
|
||||||
double getNunchuckPitch() {
|
double getNunchuckPitch() {
|
||||||
return (atan2(accYnunchuck, accZnunchuck) + PI) * RAD_TO_DEG;
|
return (atan2(accYnunchuck, accZnunchuck) + PI) * RAD_TO_DEG;
|
||||||
};
|
};
|
||||||
|
|
||||||
double getNunchuckRoll() {
|
double getNunchuckRoll() {
|
||||||
return (atan2(accXnunchuck, accZnunchuck) + PI) * RAD_TO_DEG;
|
return (atan2(accXnunchuck, accZnunchuck) + PI) * RAD_TO_DEG;
|
||||||
};
|
};
|
||||||
|
|
|
@ -111,6 +111,7 @@ class AddressPoolImpl : public AddressPool {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns thePool index for a given address
|
// Returns thePool index for a given address
|
||||||
|
|
||||||
uint8_t FindAddressIndex(uint8_t address = 0) {
|
uint8_t FindAddressIndex(uint8_t address = 0) {
|
||||||
for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) {
|
for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++) {
|
||||||
if(thePool[i].address.devAddress == address)
|
if(thePool[i].address.devAddress == address)
|
||||||
|
@ -120,6 +121,7 @@ class AddressPoolImpl : public AddressPool {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns thePool child index for a given parent
|
// Returns thePool child index for a given parent
|
||||||
|
|
||||||
uint8_t FindChildIndex(UsbDeviceAddress addr, uint8_t start = 1) {
|
uint8_t FindChildIndex(UsbDeviceAddress addr, uint8_t start = 1) {
|
||||||
for(uint8_t i = (start < 1 || start >= MAX_DEVICES_ALLOWED) ? 1 : start; i < MAX_DEVICES_ALLOWED; i++) {
|
for(uint8_t i = (start < 1 || start >= MAX_DEVICES_ALLOWED) ? 1 : start; i < MAX_DEVICES_ALLOWED; i++) {
|
||||||
if(thePool[i].address.bmParent == addr.bmAddress)
|
if(thePool[i].address.bmParent == addr.bmAddress)
|
||||||
|
@ -129,6 +131,7 @@ class AddressPoolImpl : public AddressPool {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Frees address entry specified by index parameter
|
// Frees address entry specified by index parameter
|
||||||
|
|
||||||
void FreeAddressByIndex(uint8_t index) {
|
void FreeAddressByIndex(uint8_t index) {
|
||||||
// Zero field is reserved and should not be affected
|
// Zero field is reserved and should not be affected
|
||||||
if(index == 0)
|
if(index == 0)
|
||||||
|
@ -148,6 +151,7 @@ class AddressPoolImpl : public AddressPool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializes the whole address pool at once
|
// Initializes the whole address pool at once
|
||||||
|
|
||||||
void InitAllAddresses() {
|
void InitAllAddresses() {
|
||||||
for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++)
|
for(uint8_t i = 1; i < MAX_DEVICES_ALLOWED; i++)
|
||||||
InitEntry(i);
|
InitEntry(i);
|
||||||
|
@ -172,6 +176,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns a pointer to a specified address entry
|
// Returns a pointer to a specified address entry
|
||||||
|
|
||||||
virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) {
|
virtual UsbDevice* GetUsbDevicePtr(uint8_t addr) {
|
||||||
if(!addr)
|
if(!addr)
|
||||||
return thePool;
|
return thePool;
|
||||||
|
@ -182,6 +187,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Performs an operation specified by pfunc for each addressed device
|
// Performs an operation specified by pfunc for each addressed device
|
||||||
|
|
||||||
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc) {
|
void ForEachUsbDevice(UsbDeviceHandleFunc pfunc) {
|
||||||
if(!pfunc)
|
if(!pfunc)
|
||||||
return;
|
return;
|
||||||
|
@ -192,6 +198,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Allocates new address
|
// Allocates new address
|
||||||
|
|
||||||
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) {
|
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0) {
|
||||||
/* if (parent != 0 && port == 0)
|
/* if (parent != 0 && port == 0)
|
||||||
USB_HOST_SERIAL.println("PRT:0"); */
|
USB_HOST_SERIAL.println("PRT:0"); */
|
||||||
|
@ -243,6 +250,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Empties pool entry
|
// Empties pool entry
|
||||||
|
|
||||||
virtual void FreeAddress(uint8_t addr) {
|
virtual void FreeAddress(uint8_t addr) {
|
||||||
// if the root hub is disconnected all the addresses should be initialized
|
// if the root hub is disconnected all the addresses should be initialized
|
||||||
if(addr == 0x41) {
|
if(addr == 0x41) {
|
||||||
|
|
3
cdcacm.h
3
cdcacm.h
|
@ -114,8 +114,7 @@ typedef struct {
|
||||||
uint8_t bDataBits; // Data bits (5, 6, 7, 8 or 16)
|
uint8_t bDataBits; // Data bits (5, 6, 7, 8 or 16)
|
||||||
} LINE_CODING;
|
} LINE_CODING;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
uint8_t bmRequestType; // 0xa1 for class-specific notifications
|
uint8_t bmRequestType; // 0xa1 for class-specific notifications
|
||||||
uint8_t bNotification;
|
uint8_t bNotification;
|
||||||
uint16_t wValue;
|
uint16_t wValue;
|
||||||
|
|
|
@ -208,5 +208,3 @@ Fail:
|
||||||
// //}
|
// //}
|
||||||
// return rcode;
|
// return rcode;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,10 @@ class ConfigDescParser : public USBReadParser {
|
||||||
void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc);
|
void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetOR(void) { UseOr = true; }
|
|
||||||
|
void SetOR(void) {
|
||||||
|
UseOr = true;
|
||||||
|
}
|
||||||
ConfigDescParser(UsbConfigXtracter *xtractor);
|
ConfigDescParser(UsbConfigXtracter *xtractor);
|
||||||
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset);
|
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset);
|
||||||
};
|
};
|
||||||
|
@ -75,7 +78,6 @@ UseOr(false) {
|
||||||
theSkipper.Initialize(&theBuffer);
|
theSkipper.Initialize(&theBuffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
|
template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
|
||||||
void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) {
|
void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::Parse(const uint16_t len, const uint8_t *pbuf, const uint16_t &offset) {
|
||||||
uint16_t cntdn = (uint16_t)len;
|
uint16_t cntdn = (uint16_t)len;
|
||||||
|
|
1
hid.cpp
1
hid.cpp
|
@ -1,6 +1,7 @@
|
||||||
#include "hid.h"
|
#include "hid.h"
|
||||||
|
|
||||||
//get HID report descriptor
|
//get HID report descriptor
|
||||||
|
|
||||||
/* WRONG! Endpoint is _ALWAYS_ ZERO for HID! We want the _INTERFACE_ value here!
|
/* WRONG! Endpoint is _ALWAYS_ ZERO for HID! We want the _INTERFACE_ value here!
|
||||||
uint8_t HID::GetReportDescr(uint8_t ep, USBReadParser *parser) {
|
uint8_t HID::GetReportDescr(uint8_t ep, USBReadParser *parser) {
|
||||||
const uint8_t constBufLen = 64;
|
const uint8_t constBufLen = 64;
|
||||||
|
|
1
hid.h
1
hid.h
|
@ -140,7 +140,6 @@ public:
|
||||||
virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) = 0;
|
virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class HID : public USBDeviceConfig, public UsbConfigXtracter {
|
class HID : public USBDeviceConfig, public UsbConfigXtracter {
|
||||||
protected:
|
protected:
|
||||||
USB *pUsb; // USB class instance pointer
|
USB *pUsb; // USB class instance pointer
|
||||||
|
|
|
@ -126,8 +126,7 @@ public:
|
||||||
itemPrefix(0),
|
itemPrefix(0),
|
||||||
rptSize(0),
|
rptSize(0),
|
||||||
rptCount(0),
|
rptCount(0),
|
||||||
pfUsage(NULL)
|
pfUsage(NULL) {
|
||||||
{
|
|
||||||
theBuffer.pValue = varBuffer;
|
theBuffer.pValue = varBuffer;
|
||||||
valParser.Initialize(&theBuffer);
|
valParser.Initialize(&theBuffer);
|
||||||
theSkipper.Initialize(&theBuffer);
|
theSkipper.Initialize(&theBuffer);
|
||||||
|
|
1
macros.h
1
macros.h
|
@ -63,6 +63,7 @@
|
||||||
* Debug macros: Strings are stored in progmem (flash) instead of RAM.
|
* Debug macros: Strings are stored in progmem (flash) instead of RAM.
|
||||||
*/
|
*/
|
||||||
#define USBTRACE(s) (Notify(PSTR(s), 0x80))
|
#define USBTRACE(s) (Notify(PSTR(s), 0x80))
|
||||||
|
#define USBTRACE1(s,l) (Notify(PSTR(s), l))
|
||||||
#define USBTRACE2(s,r) (Notify(PSTR(s), 0x80), D_PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80))
|
#define USBTRACE2(s,r) (Notify(PSTR(s), 0x80), D_PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80))
|
||||||
#define USBTRACE3(s,r,l) (Notify(PSTR(s), l), D_PrintHex((r), l), Notify(PSTR("\r\n"), l))
|
#define USBTRACE3(s,r,l) (Notify(PSTR(s), l), D_PrintHex((r), l), Notify(PSTR("\r\n"), l))
|
||||||
|
|
||||||
|
|
|
@ -224,11 +224,13 @@ inline void Max_LCD::command(uint8_t value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ARDUINO) && ARDUINO >=100
|
#if defined(ARDUINO) && ARDUINO >=100
|
||||||
|
|
||||||
inline size_t Max_LCD::write(uint8_t value) {
|
inline size_t Max_LCD::write(uint8_t value) {
|
||||||
LCD_sendchar(value);
|
LCD_sendchar(value);
|
||||||
return 1; // Assume success
|
return 1; // Assume success
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
inline void Max_LCD::write(uint8_t value) {
|
inline void Max_LCD::write(uint8_t value) {
|
||||||
LCD_sendchar(value);
|
LCD_sendchar(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,7 @@ e-mail : support@circuitsathome.com
|
||||||
#define LCD_5x10DOTS 0x04
|
#define LCD_5x10DOTS 0x04
|
||||||
#define LCD_5x8DOTS 0x00
|
#define LCD_5x8DOTS 0x00
|
||||||
|
|
||||||
class Max_LCD : public Print
|
class Max_LCD : public Print {
|
||||||
{
|
|
||||||
USB *pUsb;
|
USB *pUsb;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -64,6 +64,7 @@ void E_Notify(double d, int lvl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
|
|
||||||
void NotifyFailGetDevDescr(void) {
|
void NotifyFailGetDevDescr(void) {
|
||||||
Notify(PSTR("\r\ngetDevDescr "), 0x80);
|
Notify(PSTR("\r\ngetDevDescr "), 0x80);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +72,7 @@ void NotifyFailGetDevDescr(void) {
|
||||||
void NotifyFailSetDevTblEntry(void) {
|
void NotifyFailSetDevTblEntry(void) {
|
||||||
Notify(PSTR("\r\nsetDevTblEn "), 0x80);
|
Notify(PSTR("\r\nsetDevTblEn "), 0x80);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyFailGetConfDescr(void) {
|
void NotifyFailGetConfDescr(void) {
|
||||||
Notify(PSTR("\r\ngetConf "), 0x80);
|
Notify(PSTR("\r\ngetConf "), 0x80);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,19 @@ e-mail : support@circuitsathome.com
|
||||||
extern int UsbDEBUGlvl;
|
extern int UsbDEBUGlvl;
|
||||||
|
|
||||||
// This parser does absolutely nothing with the data, just swallows it.
|
// This parser does absolutely nothing with the data, just swallows it.
|
||||||
|
|
||||||
template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
|
template <class BASE_CLASS, class LEN_TYPE, class OFFSET_TYPE>
|
||||||
class SinkParser : public BASE_CLASS {
|
class SinkParser : public BASE_CLASS {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SinkParser() {};
|
SinkParser() {
|
||||||
void Initialize() {};
|
};
|
||||||
void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) {};
|
|
||||||
|
void Initialize() {
|
||||||
|
};
|
||||||
|
|
||||||
|
void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) {
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
6
usbhub.h
6
usbhub.h
|
@ -195,10 +195,14 @@ public:
|
||||||
virtual uint8_t Release();
|
virtual uint8_t Release();
|
||||||
virtual uint8_t Poll();
|
virtual uint8_t Poll();
|
||||||
virtual void ResetHubPort(uint8_t port);
|
virtual void ResetHubPort(uint8_t port);
|
||||||
|
|
||||||
virtual uint8_t GetAddress() {
|
virtual uint8_t GetAddress() {
|
||||||
return bAddress;
|
return bAddress;
|
||||||
};
|
};
|
||||||
virtual boolean DEVCLASSOK(uint8_t klass) { return (klass == 0x09); }
|
|
||||||
|
virtual boolean DEVCLASSOK(uint8_t klass) {
|
||||||
|
return (klass == 0x09);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue