aboutsummaryrefslogtreecommitdiffstats
path: root/Demos
diff options
context:
space:
mode:
Diffstat (limited to 'Demos')
-rw-r--r--Demos/Device/ClassDriver/GenericHID/GenericHID.c14
-rw-r--r--Demos/Device/ClassDriver/GenericHID/GenericHID.h3
-rw-r--r--Demos/Device/ClassDriver/Joystick/Joystick.c12
-rw-r--r--Demos/Device/ClassDriver/Joystick/Joystick.h1
-rw-r--r--Demos/Device/ClassDriver/Keyboard/Keyboard.c12
-rw-r--r--Demos/Device/ClassDriver/Keyboard/Keyboard.h1
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c12
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h1
-rw-r--r--Demos/Device/ClassDriver/Mouse/Mouse.c12
-rw-r--r--Demos/Device/ClassDriver/Mouse/Mouse.h1
-rw-r--r--Demos/Device/LowLevel/GenericHID/GenericHID.h2
-rw-r--r--Demos/Device/LowLevel/Keyboard/Keyboard.c14
-rw-r--r--Demos/Device/LowLevel/Keyboard/Keyboard.h2
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h1
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.c14
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.h2
16 files changed, 38 insertions, 66 deletions
diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c
index 13db6bf74..c27558b9e 100644
--- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c
+++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c
@@ -94,18 +94,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);
}
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
@@ -121,6 +115,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
if (!(HID_Device_ConfigureEndpoints(&Generic_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the library USB Unhandled Control Request event. */
@@ -129,8 +125,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
HID_Device_ProcessControlRequest(&Generic_HID_Interface);
}
-/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
{
HID_Device_MillisecondElapsed(&Generic_HID_Interface);
}
diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h
index 8cf0afc5d..004daf54a 100644
--- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h
+++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h
@@ -40,8 +40,6 @@
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
- #include <avr/interrupt.h>
- #include <stdbool.h>
#include <string.h>
#include "Descriptors.h"
@@ -71,6 +69,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c
index ea85aadde..b18b7ebc8 100644
--- a/Demos/Device/ClassDriver/Joystick/Joystick.c
+++ b/Demos/Device/ClassDriver/Joystick/Joystick.c
@@ -88,12 +88,6 @@ 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);
}
/** Event handler for the library USB Connection event. */
@@ -115,6 +109,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
if (!(HID_Device_ConfigureEndpoints(&Joystick_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the library USB Unhandled Control Request event. */
@@ -123,8 +119,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
HID_Device_ProcessControlRequest(&Joystick_HID_Interface);
}
-/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
{
HID_Device_MillisecondElapsed(&Joystick_HID_Interface);
}
diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.h b/Demos/Device/ClassDriver/Joystick/Joystick.h
index 493dfa072..d25ccc139 100644
--- a/Demos/Device/ClassDriver/Joystick/Joystick.h
+++ b/Demos/Device/ClassDriver/Joystick/Joystick.h
@@ -82,6 +82,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c
index 6f0bd1d1a..e609d7acb 100644
--- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c
+++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c
@@ -89,12 +89,6 @@ 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);
}
/** Event handler for the library USB Connection event. */
@@ -116,6 +110,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
if (!(HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the library USB Unhandled Control Request event. */
@@ -124,8 +120,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
HID_Device_ProcessControlRequest(&Keyboard_HID_Interface);
}
-/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
{
HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);
}
diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h
index 0f7176ce0..ebd83d5c5 100644
--- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h
+++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h
@@ -85,6 +85,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
index e21999049..5ac5b8d85 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
+++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
@@ -112,12 +112,6 @@ void SetupHardware()
Joystick_Init();
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);
}
/** Event handler for the library USB Connection event. */
@@ -142,6 +136,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the library USB Unhandled Control Request event. */
@@ -151,8 +147,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
HID_Device_ProcessControlRequest(&Mouse_HID_Interface);
}
-/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
{
HID_Device_MillisecondElapsed(&Keyboard_HID_Interface);
HID_Device_MillisecondElapsed(&Mouse_HID_Interface);
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
index 297564157..1f47c3e4b 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
@@ -89,6 +89,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c
index 32f8ca667..d54aecfaa 100644
--- a/Demos/Device/ClassDriver/Mouse/Mouse.c
+++ b/Demos/Device/ClassDriver/Mouse/Mouse.c
@@ -88,12 +88,6 @@ 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);
}
/** Event handler for the library USB WakeUp event. */
@@ -115,6 +109,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
if (!(HID_Device_ConfigureEndpoints(&Mouse_HID_Interface)))
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the library USB Unhandled Control Request event. */
@@ -123,8 +119,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
HID_Device_ProcessControlRequest(&Mouse_HID_Interface);
}
-/** ISR to keep track of each millisecond interrupt, for determining the HID class idle period remaining when set. */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
{
HID_Device_MillisecondElapsed(&Mouse_HID_Interface);
}
diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.h b/Demos/Device/ClassDriver/Mouse/Mouse.h
index 05b73c078..325bfc502 100644
--- a/Demos/Device/ClassDriver/Mouse/Mouse.h
+++ b/Demos/Device/ClassDriver/Mouse/Mouse.h
@@ -84,6 +84,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
void* ReportData, uint16_t* ReportSize);
diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.h b/Demos/Device/LowLevel/GenericHID/GenericHID.h
index c03651773..da3d4ac60 100644
--- a/Demos/Device/LowLevel/GenericHID/GenericHID.h
+++ b/Demos/Device/LowLevel/GenericHID/GenericHID.h
@@ -40,7 +40,6 @@
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
- #include <avr/interrupt.h>
#include <stdbool.h>
#include <string.h>
@@ -77,6 +76,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
void ProcessGenericHIDReport(uint8_t* DataArray);
void CreateGenericHIDReport(uint8_t* DataArray);
diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c
index f8310abb4..02f61a528 100644
--- a/Demos/Device/LowLevel/Keyboard/Keyboard.c
+++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c
@@ -85,12 +85,6 @@ void SetupHardware(void)
Joystick_Init();
LEDs_Init();
USB_Init();
-
- /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
- OCR0A = 0x7D;
- TCCR0A = (1 << WGM01);
- TCCR0B = ((1 << CS01) | (1 << CS00));
- TIMSK0 = (1 << OCIE0A);
}
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
@@ -137,6 +131,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
@@ -248,10 +244,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
}
-/** ISR for the timer 0 compare vector. This ISR fires once each millisecond, and increments the
- * scheduler elapsed idle period counter when the host has set an idle period.
- */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
{
/* One millisecond has elapsed, decrement the idle time remaining counter if it has not already elapsed */
if (IdleMSRemaining)
diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.h b/Demos/Device/LowLevel/Keyboard/Keyboard.h
index bc478f317..f319ab73b 100644
--- a/Demos/Device/LowLevel/Keyboard/Keyboard.h
+++ b/Demos/Device/LowLevel/Keyboard/Keyboard.h
@@ -40,7 +40,6 @@
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
- #include <avr/interrupt.h>
#include <avr/power.h>
#include <stdbool.h>
#include <string.h>
@@ -105,6 +104,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
void CreateKeyboardReport(USB_KeyboardReport_Data_t* ReportData);
void ProcessLEDReport(uint8_t LEDReport);
diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h
index 37cb7f651..57e152b9a 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h
@@ -102,5 +102,6 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
#endif
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c
index 48f04612b..aa95e9c0c 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.c
+++ b/Demos/Device/LowLevel/Mouse/Mouse.c
@@ -85,12 +85,6 @@ void SetupHardware(void)
LEDs_Init();
Buttons_Init();
USB_Init();
-
- /* Millisecond timer initialization, with output compare interrupt enabled for the idle timing */
- OCR0A = 0x7D;
- TCCR0A = (1 << WGM01);
- TCCR0B = ((1 << CS01) | (1 << CS00));
- TIMSK0 = (1 << OCIE0A);
}
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs and
@@ -129,6 +123,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
+ USB_Device_EnableSOFEvents();
}
/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
@@ -218,10 +214,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
}
-/** ISR for the timer 0 compare vector. This ISR fires once each millisecond, and increments the
- * scheduler elapsed idle period counter when the host has set an idle period.
- */
-ISR(TIMER0_COMPA_vect, ISR_BLOCK)
+/** Event handler for the USB device Start Of Frame event. */
+void EVENT_USB_Device_StartOfFrame(void)
{
/* One millisecond has elapsed, decrement the idle time remaining counter if it has not already elapsed */
if (IdleMSRemaining)
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.h b/Demos/Device/LowLevel/Mouse/Mouse.h
index b244ffa58..698fe478a 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.h
+++ b/Demos/Device/LowLevel/Mouse/Mouse.h
@@ -39,7 +39,6 @@
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
- #include <avr/interrupt.h>
#include <avr/power.h>
#include <stdbool.h>
#include <string.h>
@@ -105,6 +104,7 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
+ void EVENT_USB_Device_StartOfFrame(void);
void CreateMouseReport(USB_MouseReport_Data_t* ReportData);