aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-06-02 10:54:32 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-06-02 10:54:32 +0000
commit7c5444b89a49df7cb671b0b041567990d2a3012e (patch)
tree481a5b56d9f360773112b00761aa430d8121d976 /Demos/Device
parent74b7c07e96562158de294f92baed4c83b4fce970 (diff)
downloadlufa-7c5444b89a49df7cb671b0b041567990d2a3012e.tar.gz
lufa-7c5444b89a49df7cb671b0b041567990d2a3012e.tar.bz2
lufa-7c5444b89a49df7cb671b0b041567990d2a3012e.zip
Removed new Start of Frame event from the library; performance suffered far too much and it was only useful in one of the standard classes (HID). Altered HID demos to use the previous method of tracking millisecond periods via a hardware timer rather than the SOF events.
Fixed MIDI class driver blocking on unread events to the host.
Diffstat (limited to 'Demos/Device')
-rw-r--r--Demos/Device/CDC/CDC.h1
-rw-r--r--Demos/Device/DualCDC/DualCDC.h3
-rw-r--r--Demos/Device/GenericHID/GenericHID.c13
-rw-r--r--Demos/Device/GenericHID/GenericHID.h1
-rw-r--r--Demos/Device/Joystick/Joystick.c13
-rw-r--r--Demos/Device/Joystick/Joystick.h1
-rw-r--r--Demos/Device/Keyboard/Keyboard.c13
-rw-r--r--Demos/Device/Keyboard/Keyboard.h1
-rw-r--r--Demos/Device/KeyboardMouse/KeyboardMouse.c21
-rw-r--r--Demos/Device/KeyboardMouse/KeyboardMouse.h1
-rw-r--r--Demos/Device/Mouse/Mouse.c13
-rw-r--r--Demos/Device/Mouse/Mouse.h1
-rw-r--r--Demos/Device/RNDISEthernet/RNDISEthernet.h1
-rw-r--r--Demos/Device/USBtoSerial/USBtoSerial.h1
14 files changed, 56 insertions, 28 deletions
diff --git a/Demos/Device/CDC/CDC.h b/Demos/Device/CDC/CDC.h
index b487813b0..dc4033448 100644
--- a/Demos/Device/CDC/CDC.h
+++ b/Demos/Device/CDC/CDC.h
@@ -64,6 +64,5 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
#endif
diff --git a/Demos/Device/DualCDC/DualCDC.h b/Demos/Device/DualCDC/DualCDC.h
index 3c1e29612..fc782ee5a 100644
--- a/Demos/Device/DualCDC/DualCDC.h
+++ b/Demos/Device/DualCDC/DualCDC.h
@@ -64,6 +64,5 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
-
+
#endif
diff --git a/Demos/Device/GenericHID/GenericHID.c b/Demos/Device/GenericHID/GenericHID.c
index 4dfb8e455..9c8023a5c 100644
--- a/Demos/Device/GenericHID/GenericHID.c
+++ b/Demos/Device/GenericHID/GenericHID.c
@@ -40,7 +40,7 @@ USB_ClassInfo_HID_t Generic_HID_Interface =
.ReportOUTEndpointNumber = GENERIC_OUT_EPNUM,
.ReportOUTEndpointSize = GENERIC_EPSIZE,
- .ReportBufferSize = GENERIC_REPORT_SIZE,
+ .ReportINBufferSize = GENERIC_REPORT_SIZE,
.UsingReportProtocol = true,
};
@@ -70,6 +70,12 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
USB_Init();
+
+ /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
+ OCR0A = ((F_CPU / 64) / 1000);
+ TCCR0A = (1 << WGM01);
+ TCCR0B = ((1 << CS01) | (1 << CS00));
+ TIMSK0 = (1 << OCIE0A);
}
void EVENT_USB_Connect(void)
@@ -95,9 +101,10 @@ void EVENT_USB_UnhandledControlPacket(void)
USB_HID_ProcessControlPacket(&Generic_HID_Interface);
}
-void EVENT_USB_StartOfFrame(void)
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
- USB_HID_RegisterStartOfFrame(&Generic_HID_Interface);
+ if (Generic_HID_Interface.IdleMSRemaining)
+ Generic_HID_Interface.IdleMSRemaining--;
}
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
diff --git a/Demos/Device/GenericHID/GenericHID.h b/Demos/Device/GenericHID/GenericHID.h
index 27426431c..94a09af93 100644
--- a/Demos/Device/GenericHID/GenericHID.h
+++ b/Demos/Device/GenericHID/GenericHID.h
@@ -64,7 +64,6 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo,
diff --git a/Demos/Device/Joystick/Joystick.c b/Demos/Device/Joystick/Joystick.c
index e073a87fd..d5c20737d 100644
--- a/Demos/Device/Joystick/Joystick.c
+++ b/Demos/Device/Joystick/Joystick.c
@@ -37,7 +37,7 @@ USB_ClassInfo_HID_t Joystick_HID_Interface =
.ReportINEndpointNumber = JOYSTICK_EPNUM,
.ReportINEndpointSize = JOYSTICK_EPSIZE,
- .ReportBufferSize = sizeof(USB_JoystickReport_Data_t),
+ .ReportINBufferSize = sizeof(USB_JoystickReport_Data_t),
.UsingReportProtocol = true,
};
@@ -69,6 +69,12 @@ void SetupHardware(void)
LEDs_Init();
Buttons_Init();
USB_Init();
+
+ /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
+ OCR0A = ((F_CPU / 64) / 1000);
+ TCCR0A = (1 << WGM01);
+ TCCR0B = ((1 << CS01) | (1 << CS00));
+ TIMSK0 = (1 << OCIE0A);
}
void EVENT_USB_Connect(void)
@@ -94,9 +100,10 @@ void EVENT_USB_UnhandledControlPacket(void)
USB_HID_ProcessControlPacket(&Joystick_HID_Interface);
}
-void EVENT_USB_StartOfFrame(void)
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
- USB_HID_RegisterStartOfFrame(&Joystick_HID_Interface);
+ if (Joystick_HID_Interface.IdleMSRemaining)
+ Joystick_HID_Interface.IdleMSRemaining--;
}
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
diff --git a/Demos/Device/Joystick/Joystick.h b/Demos/Device/Joystick/Joystick.h
index 461d0d0cc..164c58ea2 100644
--- a/Demos/Device/Joystick/Joystick.h
+++ b/Demos/Device/Joystick/Joystick.h
@@ -75,7 +75,6 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo,
diff --git a/Demos/Device/Keyboard/Keyboard.c b/Demos/Device/Keyboard/Keyboard.c
index d8893bfaa..d506657a6 100644
--- a/Demos/Device/Keyboard/Keyboard.c
+++ b/Demos/Device/Keyboard/Keyboard.c
@@ -41,7 +41,7 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
.ReportOUTEndpointNumber = KEYBOARD_LEDS_EPNUM,
.ReportOUTEndpointSize = KEYBOARD_EPSIZE,
- .ReportBufferSize = sizeof(USB_KeyboardReport_Data_t),
+ .ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
.IdleCount = 500,
};
@@ -73,6 +73,12 @@ void SetupHardware()
LEDs_Init();
Buttons_Init();
USB_Init();
+
+ /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
+ OCR0A = ((F_CPU / 64) / 1000);
+ TCCR0A = (1 << WGM01);
+ TCCR0B = ((1 << CS01) | (1 << CS00));
+ TIMSK0 = (1 << OCIE0A);
}
void EVENT_USB_Connect(void)
@@ -98,9 +104,10 @@ void EVENT_USB_UnhandledControlPacket(void)
USB_HID_ProcessControlPacket(&Keyboard_HID_Interface);
}
-void EVENT_USB_StartOfFrame(void)
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
- USB_HID_RegisterStartOfFrame(&Keyboard_HID_Interface);
+ if (Keyboard_HID_Interface.IdleMSRemaining)
+ Keyboard_HID_Interface.IdleMSRemaining--;
}
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
diff --git a/Demos/Device/Keyboard/Keyboard.h b/Demos/Device/Keyboard/Keyboard.h
index eeb7be9b7..9cfc9aba4 100644
--- a/Demos/Device/Keyboard/Keyboard.h
+++ b/Demos/Device/Keyboard/Keyboard.h
@@ -78,7 +78,6 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo,
diff --git a/Demos/Device/KeyboardMouse/KeyboardMouse.c b/Demos/Device/KeyboardMouse/KeyboardMouse.c
index 8f6a573a6..71a8375aa 100644
--- a/Demos/Device/KeyboardMouse/KeyboardMouse.c
+++ b/Demos/Device/KeyboardMouse/KeyboardMouse.c
@@ -41,7 +41,7 @@ USB_ClassInfo_HID_t Keyboard_HID_Interface =
.ReportOUTEndpointNumber = KEYBOARD_OUT_EPNUM,
.ReportOUTEndpointSize = HID_EPSIZE,
- .ReportBufferSize = sizeof(USB_KeyboardReport_Data_t),
+ .ReportINBufferSize = sizeof(USB_KeyboardReport_Data_t),
.IdleCount = 500,
};
@@ -53,7 +53,7 @@ USB_ClassInfo_HID_t Mouse_HID_Interface =
.ReportINEndpointNumber = MOUSE_IN_EPNUM,
.ReportINEndpointSize = HID_EPSIZE,
- .ReportBufferSize = sizeof(USB_MouseReport_Data_t),
+ .ReportINBufferSize = sizeof(USB_MouseReport_Data_t),
.ReportOUTEndpointNumber = 0,
.ReportOUTEndpointSize = 0,
@@ -85,7 +85,13 @@ void SetupHardware()
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
- USB_Init();
+ USB_Init();
+
+ /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
+ OCR0A = ((F_CPU / 64) / 1000);
+ TCCR0A = (1 << WGM01);
+ TCCR0B = ((1 << CS01) | (1 << CS00));
+ TIMSK0 = (1 << OCIE0A);
}
void EVENT_USB_Connect(void)
@@ -115,10 +121,13 @@ void EVENT_USB_UnhandledControlPacket(void)
USB_HID_ProcessControlPacket(&Mouse_HID_Interface);
}
-void EVENT_USB_StartOfFrame(void)
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
- USB_HID_RegisterStartOfFrame(&Keyboard_HID_Interface);
- USB_HID_RegisterStartOfFrame(&Mouse_HID_Interface);
+ if (Keyboard_HID_Interface.IdleMSRemaining)
+ Keyboard_HID_Interface.IdleMSRemaining--;
+
+ if (Mouse_HID_Interface.IdleMSRemaining)
+ Mouse_HID_Interface.IdleMSRemaining--;
}
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
diff --git a/Demos/Device/KeyboardMouse/KeyboardMouse.h b/Demos/Device/KeyboardMouse/KeyboardMouse.h
index a5c3c5db2..c18c6e1af 100644
--- a/Demos/Device/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/KeyboardMouse/KeyboardMouse.h
@@ -82,7 +82,6 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo,
diff --git a/Demos/Device/Mouse/Mouse.c b/Demos/Device/Mouse/Mouse.c
index 57c1aa114..01ead0012 100644
--- a/Demos/Device/Mouse/Mouse.c
+++ b/Demos/Device/Mouse/Mouse.c
@@ -37,7 +37,7 @@ USB_ClassInfo_HID_t Mouse_HID_Interface =
.ReportINEndpointNumber = MOUSE_EPNUM,
.ReportINEndpointSize = MOUSE_EPSIZE,
- .ReportBufferSize = sizeof(USB_MouseReport_Data_t),
+ .ReportINBufferSize = sizeof(USB_MouseReport_Data_t),
};
int main(void)
@@ -67,6 +67,12 @@ void SetupHardware(void)
LEDs_Init();
Buttons_Init();
USB_Init();
+
+ /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
+ OCR0A = ((F_CPU / 64) / 1000);
+ TCCR0A = (1 << WGM01);
+ TCCR0B = ((1 << CS01) | (1 << CS00));
+ TIMSK0 = (1 << OCIE0A);
}
void EVENT_USB_Connect(void)
@@ -92,9 +98,10 @@ void EVENT_USB_UnhandledControlPacket(void)
USB_HID_ProcessControlPacket(&Mouse_HID_Interface);
}
-void EVENT_USB_StartOfFrame(void)
+ISR(TIMER0_COMPA_vect, ISR_BLOCK)
{
- USB_HID_RegisterStartOfFrame(&Mouse_HID_Interface);
+ if (Mouse_HID_Interface.IdleMSRemaining)
+ Mouse_HID_Interface.IdleMSRemaining--;
}
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData)
diff --git a/Demos/Device/Mouse/Mouse.h b/Demos/Device/Mouse/Mouse.h
index 5c8049590..9134e6772 100644
--- a/Demos/Device/Mouse/Mouse.h
+++ b/Demos/Device/Mouse/Mouse.h
@@ -77,7 +77,6 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
uint16_t CALLBACK_USB_HID_CreateNextHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo, void* ReportData);
void CALLBACK_USB_HID_ProcessReceivedHIDReport(USB_ClassInfo_HID_t* HIDInterfaceInfo,
diff --git a/Demos/Device/RNDISEthernet/RNDISEthernet.h b/Demos/Device/RNDISEthernet/RNDISEthernet.h
index bc5004205..f0247ce81 100644
--- a/Demos/Device/RNDISEthernet/RNDISEthernet.h
+++ b/Demos/Device/RNDISEthernet/RNDISEthernet.h
@@ -71,7 +71,6 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
void CALLBACK_USB_RNDIS_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_t* RNDISInterfaceInfo);
diff --git a/Demos/Device/USBtoSerial/USBtoSerial.h b/Demos/Device/USBtoSerial/USBtoSerial.h
index 7ff796e70..bc8d98398 100644
--- a/Demos/Device/USBtoSerial/USBtoSerial.h
+++ b/Demos/Device/USBtoSerial/USBtoSerial.h
@@ -66,7 +66,6 @@
void EVENT_USB_Disconnect(void);
void EVENT_USB_ConfigurationChanged(void);
void EVENT_USB_UnhandledControlPacket(void);
- void EVENT_USB_StartOfFrame(void);
void EVENT_USB_CDC_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo);