projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added new RNDISHost Host LowLevel demo. Fixed misnamed Pipe_SetPipeToken() macro...
[pub/USBasp.git]
/
Demos
/
Device
/
ClassDriver
/
Mouse
/
Mouse.c
diff --git
a/Demos/Device/ClassDriver/Mouse/Mouse.c
b/Demos/Device/ClassDriver/Mouse/Mouse.c
index
d261013
..
36ef71b
100644
(file)
--- a/
Demos/Device/ClassDriver/Mouse/Mouse.c
+++ b/
Demos/Device/ClassDriver/Mouse/Mouse.c
@@
-47,13
+47,14
@@
USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
{
\r
.Config =
\r
{
\r
{
\r
.Config =
\r
{
\r
- .InterfaceNumber = 0,
\r
+ .InterfaceNumber
= 0,
\r
\r
\r
- .ReportINEndpointNumber = MOUSE_EPNUM,
\r
- .ReportINEndpointSize = MOUSE_EPSIZE,
\r
+ .ReportINEndpointNumber = MOUSE_EPNUM,
\r
+ .ReportINEndpointSize = MOUSE_EPSIZE,
\r
+ .ReportINEndpointDoubleBank = false,
\r
\r
\r
- .PrevReportINBuffer = PrevMouseHIDReportBuffer,
\r
- .PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
\r
+ .PrevReportINBuffer
= PrevMouseHIDReportBuffer,
\r
+ .PrevReportINBufferSize
= sizeof(PrevMouseHIDReportBuffer),
\r
},
\r
};
\r
\r
},
\r
};
\r
\r
@@
-88,12
+89,6
@@
void SetupHardware(void)
LEDs_Init();
\r
Buttons_Init();
\r
USB_Init();
\r
LEDs_Init();
\r
Buttons_Init();
\r
USB_Init();
\r
-
\r
- /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
\r
- OCR0A = ((F_CPU / 64) / 1000);
\r
- TCCR0A = (1 << WGM01);
\r
- TCCR0B = ((1 << CS01) | (1 << CS00));
\r
- TIMSK0 = (1 << OCIE0A);
\r
}
\r
\r
/** Event handler for the library USB WakeUp event. */
\r
}
\r
\r
/** Event handler for the library USB WakeUp event. */
\r
@@
-115,16
+110,18
@@
void EVENT_USB_Device_ConfigurationChanged(void)
\r
if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface)))
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
\r
if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface)))
\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
\r
+
\r
+ USB_Device_EnableSOFEvents();
\r
}
\r
\r
/** Event handler for the library USB Unhandled Control Request event. */
\r
}
\r
\r
/** Event handler for the library USB Unhandled Control Request event. */
\r
-void EVENT_USB_Device_
Device_
UnhandledControlRequest(void)
\r
+void EVENT_USB_Device_UnhandledControlRequest(void)
\r
{
\r
HID_Device_ProcessControlRequest(&Mouse_HID_Interface);
\r
}
\r
\r
{
\r
HID_Device_ProcessControlRequest(&Mouse_HID_Interface);
\r
}
\r
\r
-/**
ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when se
t. */
\r
-
ISR(TIMER0_COMPA_vect, ISR_BLOCK
)
\r
+/**
Event handler for the USB device Start Of Frame even
t. */
\r
+
void EVENT_USB_Device_StartOfFrame(void
)
\r
{
\r
HID_Device_MillisecondElapsed(&Mouse_HID_Interface);
\r
}
\r
{
\r
HID_Device_MillisecondElapsed(&Mouse_HID_Interface);
\r
}
\r
@@
-139,7
+136,7
@@
ISR(TIMER0_COMPA_vect, ISR_BLOCK)
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
\r
*/
\r
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
\r
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
\r
*/
\r
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
\r
- void* ReportData, uint16_t* ReportSize)
\r
+
const uint8_t ReportType,
void* ReportData, uint16_t* ReportSize)
\r
{
\r
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
\r
\r
{
\r
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
\r
\r
@@
-151,10
+148,10
@@
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
else if (JoyStatus_LCL & JOY_DOWN)
\r
MouseReport->Y = 1;
\r
\r
else if (JoyStatus_LCL & JOY_DOWN)
\r
MouseReport->Y = 1;
\r
\r
- if (JoyStatus_LCL & JOY_RIGHT)
\r
- MouseReport->X = 1;
\r
- else if (JoyStatus_LCL & JOY_LEFT)
\r
+ if (JoyStatus_LCL & JOY_LEFT)
\r
MouseReport->X = -1;
\r
MouseReport->X = -1;
\r
+ else if (JoyStatus_LCL & JOY_RIGHT)
\r
+ MouseReport->X = 1;
\r
\r
if (JoyStatus_LCL & JOY_PRESS)
\r
MouseReport->Button = (1 << 0);
\r
\r
if (JoyStatus_LCL & JOY_PRESS)
\r
MouseReport->Button = (1 << 0);
\r