summaryrefslogtreecommitdiff
path: root/TERES-HID
diff options
context:
space:
mode:
Diffstat (limited to 'TERES-HID')
-rw-r--r--TERES-HID/Descriptors.c2
-rw-r--r--TERES-HID/KeyboardMouse.c33
2 files changed, 28 insertions, 7 deletions
diff --git a/TERES-HID/Descriptors.c b/TERES-HID/Descriptors.c
index c91e2e0..213e230 100644
--- a/TERES-HID/Descriptors.c
+++ b/TERES-HID/Descriptors.c
@@ -238,7 +238,7 @@ USB_STRING_DESCRIPTOR(L"Olimex Ltd.");
* Descriptor.
*/
const USB_Descriptor_String_t PROGMEM ProductString =
-USB_STRING_DESCRIPTOR(L"TERES Keyboard+Touchpad");
+USB_STRING_DESCRIPTOR(L"TERES Keyboard+Touchpad (drv)");
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
diff --git a/TERES-HID/KeyboardMouse.c b/TERES-HID/KeyboardMouse.c
index f0ed997..5327834 100644
--- a/TERES-HID/KeyboardMouse.c
+++ b/TERES-HID/KeyboardMouse.c
@@ -283,6 +283,27 @@ EVENT_USB_Device_StartOfFrame(void)
HID_Device_MillisecondElapsed(&Mouse_HID_Interface);
}
+void
+reset_key(USB_KeyboardReport_Data_t *report)
+{
+ keyc = 0;
+ report->Modifier = 0;
+
+ for (int x = 0; x < 6; x++)
+ report->KeyCode[x] = 0;
+}
+
+void
+add_key(USB_KeyboardReport_Data_t * report, uint8_t key)
+{
+ if (key == 0)
+ return;
+ report->KeyCode[keyc] = key;
+ if (keyc < 5)
+ keyc++;
+}
+
+
/** HID class driver callback function for the creation of HID reports to the host.
*
* \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
@@ -312,12 +333,7 @@ CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *
uint8_t x = 0;
uint8_t fn = 0;
- keyc = 0; // reset keys
- KeyboardReport->Modifier = 0;
-
- for (x = 0; x < 6; x++)
- KeyboardReport->KeyCode[x] = 0;
-
+ reset_key( KeyboardReport );
if (itsDone) {
itsDone = false;
@@ -607,6 +623,7 @@ CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *
*ReportSize = sizeof(USB_KeyboardReport_Data_t);
return true; // return false;
}
+
if (HIDInterfaceInfo == &Mouse_HID_Interface) {
USB_WheelMouseReport_Data_t *MouseReport =
(USB_WheelMouseReport_Data_t *) ReportData;
@@ -723,6 +740,8 @@ CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *
*ReportSize = sizeof(USB_WheelMouseReport_Data_t);
return true;
}
+
+ return false;
}
@@ -766,6 +785,8 @@ ISR(ADC_vect)
mouse = 0;
} else
oldbutton = button;
+
+ mouse=0; // temporary fix: disable button
}