CI: Build on Arch (bleeding-ege) and Ubuntu (stable) AVR-GCC toolchains.
[pub/USBasp.git] / Demos / Host / LowLevel / JoystickHostWithParser / JoystickHostWithParser.c
index b38fcf0..61f3e2a 100644 (file)
@@ -1,13 +1,13 @@
 /*
              LUFA Library
 /*
              LUFA Library
-     Copyright (C) Dean Camera, 2011.
+     Copyright (C) Dean Camera, 2018.
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
 
   dean [at] fourwalledcubicle [dot] com
            www.lufa-lib.org
 */
 
 /*
-  Copyright 2011  Dean Camera (dean [at] fourwalledcubicle [dot] com)
+  Copyright 2018  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
 
   Permission to use, copy, modify, distribute, and sell this
   software and its documentation for any purpose is hereby granted
@@ -18,7 +18,7 @@
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission.
 
-  The author disclaim all warranties with regard to this
+  The author disclaims all warranties with regard to this
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
   software, including all implied warranties of merchantability
   and fitness.  In no event shall the author be liable for any
   special, indirect or consequential damages or any damages
@@ -46,7 +46,7 @@ int main(void)
        puts_P(PSTR(ESC_FG_CYAN "Joystick HID Parser Host Demo running.\r\n" ESC_FG_WHITE));
 
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
        puts_P(PSTR(ESC_FG_CYAN "Joystick HID Parser Host Demo running.\r\n" ESC_FG_WHITE));
 
        LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-       sei();
+       GlobalInterruptEnable();
 
        for (;;)
        {
 
        for (;;)
        {
@@ -59,12 +59,14 @@ int main(void)
 /** Configures the board hardware and chip peripherals for the demo's functionality. */
 void SetupHardware(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);
        /* Disable watchdog if enabled by bootloader/fuses */
        MCUSR &= ~(1 << WDRF);
        wdt_disable();
 
        /* Disable clock division */
        clock_prescale_set(clock_div_1);
+#endif
 
        /* Hardware Initialization */
        Serial_Init(9600, false);
 
        /* Hardware Initialization */
        Serial_Init(9600, false);
@@ -99,7 +101,7 @@ void EVENT_USB_Host_DeviceUnattached(void)
 void EVENT_USB_Host_DeviceEnumerationComplete(void)
 {
        puts_P(PSTR("Getting Config Data.\r\n"));
 void EVENT_USB_Host_DeviceEnumerationComplete(void)
 {
        puts_P(PSTR("Getting Config Data.\r\n"));
-       
+
        uint8_t ErrorCode;
 
        /* Get and process the configuration descriptor data */
        uint8_t ErrorCode;
 
        /* Get and process the configuration descriptor data */
@@ -179,7 +181,7 @@ void JoystickHost_Task(void)
 {
        if (USB_HostState != HOST_STATE_Configured)
          return;
 {
        if (USB_HostState != HOST_STATE_Configured)
          return;
-       
+
        /* Select and unfreeze joystick data pipe */
        Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE);
        Pipe_Unfreeze();
        /* Select and unfreeze joystick data pipe */
        Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE);
        Pipe_Unfreeze();
@@ -268,3 +270,4 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
        /* Display the button information on the board LEDs */
        LEDs_SetAllLEDs(LEDMask);
 }
        /* Display the button information on the board LEDs */
        LEDs_SetAllLEDs(LEDMask);
 }
+