fixed PrintHex in Kbd example

This commit is contained in:
Oleg Mazurov 2013-08-14 14:02:42 -06:00
parent 64cdcf51f4
commit 4d91186cd1
8 changed files with 40 additions and 40 deletions

2
BTD.h
View file

@ -28,7 +28,7 @@
#define PS3MOVE_PID 0x03D5 // Motion controller
#define IOGEAR_GBU521_VID 0x0A5C // The IOGEAR GBU521 dongle does not presents itself correctly, so we have to check for it manually
#define IOGEAR_GBU521_PID 0x4500
#define IOGEAR_GBU521_PID 0x21e8
/* Bluetooth dongle data taken from descriptors */
#define BULK_MAXPKTSIZE 64 // max size for ACL data

12
adk.cpp
View file

@ -335,16 +335,16 @@ uint8_t ADK::SndData(uint16_t nbytes, uint8_t *dataptr) {
void ADK::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
Notify(PSTR("Endpoint descriptor:"), 0x80);
Notify(PSTR("\r\nLength:\t\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
Notify(PSTR("\r\nType:\t\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
Notify(PSTR("\r\nAddress:\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
Notify(PSTR("\r\nAttributes:\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
Notify(PSTR("\r\n"), 0x80);
}

View file

@ -334,16 +334,16 @@ uint8_t ACM::SendBreak(uint16_t duration) {
void ACM::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
Notify(PSTR("Endpoint descriptor:"), 0x80);
Notify(PSTR("\r\nLength:\t\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
Notify(PSTR("\r\nType:\t\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
Notify(PSTR("\r\nAddress:\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
Notify(PSTR("\r\nAttributes:\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
Notify(PSTR("\r\n"), 0x80);
}

View file

@ -326,16 +326,16 @@ uint8_t FTDI::SndData(uint16_t nbytes, uint8_t *dataptr) {
void FTDI::PrintEndpointDescriptor(const USB_ENDPOINT_DESCRIPTOR* ep_ptr) {
Notify(PSTR("Endpoint descriptor:"), 0x80);
Notify(PSTR("\r\nLength:\t\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
PrintHex<uint8_t > (ep_ptr->bLength, 0x80);
Notify(PSTR("\r\nType:\t\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
PrintHex<uint8_t > (ep_ptr->bDescriptorType, 0x80);
Notify(PSTR("\r\nAddress:\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
PrintHex<uint8_t > (ep_ptr->bEndpointAddress, 0x80);
Notify(PSTR("\r\nAttributes:\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
PrintHex<uint8_t > (ep_ptr->bmAttributes, 0x80);
Notify(PSTR("\r\nMaxPktSize:\t"), 0x80);
D_PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
PrintHex<uint16_t > (ep_ptr->wMaxPacketSize, 0x80);
Notify(PSTR("\r\nPoll Intrv:\t"), 0x80);
D_PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
PrintHex<uint8_t > (ep_ptr->bInterval, 0x80);
Notify(PSTR("\r\n"), 0x80);
}

View file

@ -175,19 +175,19 @@ template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTO
void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc) {
Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80);
Notify(PSTR("bDescLength:\t\t"), 0x80);
D_PrintHex<uint8_t > (pDesc->bLength, 0x80);
PrintHex<uint8_t > (pDesc->bLength, 0x80);
Notify(PSTR("\r\nbDescriptorType:\t"), 0x80);
D_PrintHex<uint8_t > (pDesc->bDescriptorType, 0x80);
PrintHex<uint8_t > (pDesc->bDescriptorType, 0x80);
Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80);
D_PrintHex<uint16_t > (pDesc->bcdHID, 0x80);
PrintHex<uint16_t > (pDesc->bcdHID, 0x80);
Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80);
D_PrintHex<uint8_t > (pDesc->bCountryCode, 0x80);
PrintHex<uint8_t > (pDesc->bCountryCode, 0x80);
Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80);
D_PrintHex<uint8_t > (pDesc->bNumDescriptors, 0x80);
PrintHex<uint8_t > (pDesc->bNumDescriptors, 0x80);
//Notify(PSTR("\r\nbDescrType:\t\t"));
//PrintHex<uint8_t>(pDesc->bDescrType);
@ -199,10 +199,10 @@ void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::PrintHidDescrip
HID_CLASS_DESCRIPTOR_LEN_AND_TYPE *pLT = (HID_CLASS_DESCRIPTOR_LEN_AND_TYPE*)&(pDesc->bDescrType);
Notify(PSTR("\r\nbDescrType:\t\t"), 0x80);
D_PrintHex<uint8_t > (pLT[i].bDescrType, 0x80);
PrintHex<uint8_t > (pLT[i].bDescrType, 0x80);
Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80);
D_PrintHex<uint16_t > (pLT[i].wDescriptorLength, 0x80);
PrintHex<uint16_t > (pLT[i].wDescriptorLength, 0x80);
}
Notify(PSTR("\r\n"), 0x80);
}

View file

@ -37,7 +37,7 @@ void KbdRptParser::PrintKey(uint8_t m, uint8_t key)
Serial.print((mod.bmLeftGUI == 1) ? "G" : " ");
Serial.print(" >");
D_PrintHex<uint8_t>(key, 0x80);
PrintHex<uint8_t>(key, 0x80);
Serial.print("< ");
Serial.print((mod.bmRightCtrl == 1) ? "C" : " ");

View file

@ -63,22 +63,22 @@ void JoystickReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t
void JoystickEvents::OnGamePadChanged(const GamePadEventData *evt)
{
Serial.print("X: ");
D_PrintHex<uint8_t>(evt->X, 0x80);
PrintHex<uint8_t>(evt->X, 0x80);
Serial.print("\tY: ");
D_PrintHex<uint8_t>(evt->Y, 0x80);
PrintHex<uint8_t>(evt->Y, 0x80);
Serial.print("\tZ: ");
D_PrintHex<uint8_t>(evt->Z1, 0x80);
PrintHex<uint8_t>(evt->Z1, 0x80);
Serial.print("\tZ: ");
D_PrintHex<uint8_t>(evt->Z2, 0x80);
PrintHex<uint8_t>(evt->Z2, 0x80);
Serial.print("\tRz: ");
D_PrintHex<uint8_t>(evt->Rz, 0x80);
PrintHex<uint8_t>(evt->Rz, 0x80);
Serial.println("");
}
void JoystickEvents::OnHatSwitch(uint8_t hat)
{
Serial.print("Hat Switch: ");
D_PrintHex<uint8_t>(hat, 0x80);
PrintHex<uint8_t>(hat, 0x80);
Serial.println("");
}

View file

@ -26,18 +26,18 @@ void JoystickReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t
void JoystickEvents::OnGamePadChanged(const GamePadEventData *evt)
{
Serial.print("X: ");
D_PrintHex<uint16_t>(evt->x, 0x80);
PrintHex<uint16_t>(evt->x, 0x80);
Serial.print(" Y: ");
D_PrintHex<uint16_t>(evt->y, 0x80);
PrintHex<uint16_t>(evt->y, 0x80);
Serial.print(" Hat Switch: ");
D_PrintHex<uint8_t>(evt->hat, 0x80);
PrintHex<uint8_t>(evt->hat, 0x80);
Serial.print(" Twist: ");
D_PrintHex<uint8_t>(evt->twist, 0x80);
PrintHex<uint8_t>(evt->twist, 0x80);
Serial.print(" Slider: ");
D_PrintHex<uint8_t>(evt->slider, 0x80);
PrintHex<uint8_t>(evt->slider, 0x80);
Serial.print(" Buttons A: ");
D_PrintHex<uint8_t>(evt->buttons_a, 0x80);
PrintHex<uint8_t>(evt->buttons_a, 0x80);
Serial.print(" Buttons B: ");
D_PrintHex<uint8_t>(evt->buttons_b, 0x80);
PrintHex<uint8_t>(evt->buttons_b, 0x80);
Serial.println("");
}