Mark build test makefiles as being incompatible with parallel make builds, as they...
[pub/USBasp.git] / Demos / Device / ClassDriver / Mouse / Mouse.c
index f972644..00cadb4 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2011.
+     Copyright (C) Dean Camera, 2012.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2012  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -48,11 +48,12 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
                .Config =
                        {
                                .InterfaceNumber              = 0,
-
-                               .ReportINEndpointNumber       = MOUSE_EPNUM,
-                               .ReportINEndpointSize         = MOUSE_EPSIZE,
-                               .ReportINEndpointDoubleBank   = false,
-
+                               .ReportINEndpoint             =
+                                       {
+                                               .Address              = MOUSE_EPADDR,
+                                               .Size                 = MOUSE_EPSIZE,
+                                               .Banks                = 1,
+                                       },
                                .PrevReportINBuffer           = PrevMouseHIDReportBuffer,
                                .PrevReportINBufferSize       = sizeof(PrevMouseHIDReportBuffer),
                        },
@@ -67,7 +68,7 @@ int main(void)
        SetupHardware();
 
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-       GlobalInterruptEnable();
+       sei();
 
        for (;;)
        {
@@ -79,35 +80,13 @@ int main(void)
 /** Configures the board hardware and chip peripherals for the demo's functionality. */
 void SetupHardware(void)
 {
-       #if (ARCH == ARCH_AVR8)
-               /* Disable watchdog if enabled by bootloader/fuses */
-               MCUSR &= ~(1 << WDRF);
-               wdt_disable();
-
-               /* Disable clock division */
-               clock_prescale_set(clock_div_1);
-       #elif (ARCH == ARCH_UC3)
-               /* Initialize interrupt subsystem */
-               INTC_Init();
-               INTC_RegisterGroupHandler(AVR32_USBB_IRQ, AVR32_INTC_INT0, USB_GEN_vect);
-
-               /* Select slow startup, external high frequency crystal attached to OSC0 */
-               AVR32_PM.OSCCTRL0.startup = 6;
-               AVR32_PM.OSCCTRL0.mode    = 7;
-               AVR32_PM.MCCTRL.osc0en    = true;
-               while (!(AVR32_PM.POSCSR.osc0rdy));
-
-               /* Switch CPU core to use OSC0 as the system clock */
-               AVR32_PM.MCCTRL.mcsel     = 1;
-
-               /* Start PLL1 to feed into the USB generic clock module */
-               AVR32_PM.PLL[1].pllmul    = (F_USB / F_CPU) ? (((F_USB / F_CPU) - 1) / 2) : 0;
-               AVR32_PM.PLL[1].plldiv    = 0;
-               AVR32_PM.PLL[1].pllosc    = 0;  
-               AVR32_PM.PLL[1].pllen     = true;
-               while (!(AVR32_PM.POSCSR.lock1));       
-       #endif
-       
+       /* Disable watchdog if enabled by bootloader/fuses */
+       MCUSR &= ~(1 << WDRF);
+       wdt_disable();
+
+       /* Disable clock division */
+       clock_prescale_set(clock_div_1);
+
        /* Hardware Initialization */
        Joystick_Init();
        LEDs_Init();
@@ -157,7 +136,7 @@ void EVENT_USB_Device_StartOfFrame(void)
  *  \param[in,out] ReportID    Report ID requested by the host if non-zero, otherwise callback should set to the generated report ID
  *  \param[in]     ReportType  Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature
  *  \param[out]    ReportData  Pointer to a buffer where the created report should be stored
- *  \param[out]    ReportSize  Number of bytes written in the report (or zero if no report is to be sent
+ *  \param[out]    ReportSize  Number of bytes written in the report (or zero if no report is to be sent)
  *
  *  \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
  */
@@ -169,8 +148,8 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
 {
        USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
 
-       uint_reg_t JoyStatus_LCL    = Joystick_GetStatus();
-       uint_reg_t ButtonStatus_LCL = Buttons_GetStatus();
+       uint8_t JoyStatus_LCL    = Joystick_GetStatus();
+       uint8_t ButtonStatus_LCL = Buttons_GetStatus();
 
        if (JoyStatus_LCL & JOY_UP)
          MouseReport->Y = -1;