diff --git a/src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Buttons.h b/src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Buttons.h index 812cf79..2861a44 100644 --- a/src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Buttons.h +++ b/src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Buttons.h @@ -71,27 +71,162 @@ /* Public Interface - May be used in end-application: */ /* Macros: */ /** Button mask for the first button on the board. */ - #define BUTTONS_BUTTON1 (1 << 7) + #define BUTTONS_SEL (1 << 5) //PB5 + #define BUTTONS_STOP (1 << 7) //PB7 + #define BUTTONS_BAS (1 << 5) //PF5 + #define BUTTONS_DROITE (1 << 4) //PF4 + #define BUTTONS_GAUCHE (1 << 1) //PF1 + #define BUTTONS_HAUT (1 << 0) //PF0 + /* Inline Functions: */ #if !defined(__DOXYGEN__) - static inline void Buttons_Init(void) + //BUTTON SEL + // + + static inline void Buttons_Init_SEL(void) + { + DDRB &= ~BUTTONS_SEL; + PORTB |= BUTTONS_SEL; + } + + static inline void Buttons_Disable_SEL(void) + { + DDRB &= ~BUTTONS_SEL; + PORTB &= ~BUTTONS_SEL; + } + + + + // BUTTON STOP + + static inline void Buttons_Init_STOP(void) + { + DDRB &= ~BUTTONS_STOP; + PORTB |= BUTTONS_STOP; + } + + + // BUTTON STOP + + static inline void Buttons_Disable_STOP(void) + { + DDRB &= ~BUTTONS_STOP; + PORTB |= BUTTONS_STOP; + } + + + + + //BUTTON BAS + + + static inline void Buttons_Init_BAS(void) + { + DDRF &= ~BUTTONS_BAS; + PORTF |= BUTTONS_BAS; + } + + static inline void Buttons_Disable_BAS(void) + { + DDRF &= ~BUTTONS_BAS; + PORTF &= ~BUTTONS_BAS; + } + + //BUTTON DROITE + + static inline void Buttons_Init_DROITE(void) + { + DDRF &= ~BUTTONS_DROITE; + PORTF |= BUTTONS_DROITE; + } + + static inline void Buttons_Disable_DROITE(void) + { + DDRF &= ~BUTTONS_DROITE; + PORTF &= ~BUTTONS_DROITE; + } + + //BUTTON GAUCHE + + static inline void Buttons_Init_GAUCHE(void) + { + DDRF &= ~BUTTONS_GAUCHE; + PORTF |= BUTTONS_GAUCHE; + } + + static inline void Buttons_Disable_GAUCHE(void) + + { + DDRF &= ~BUTTONS_GAUCHE; + PORTF &= ~BUTTONS_GAUCHE; + } + + //BUTTON HAUT + + static inline void Buttons_Init_HAUT(void) + { + DDRF &= ~BUTTONS_HAUT; + + PORTF |= BUTTONS_HAUT; + } + + static inline void Buttons_Disable_HAUT(void) + { + DDRF &= ~BUTTONS_HAUT; + PORTF &= ~BUTTONS_HAUT; + } + + + //SEL + + static inline uint8_t Buttons_GetStatus_V(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Buttons_GetStatus_V(void) { - DDRD &= ~BUTTONS_BUTTON1; - PORTD |= BUTTONS_BUTTON1; + return ((PINB & BUTTONS_SEL) ^ BUTTONS_SEL); } - static inline void Buttons_Disable(void) + //STOP + + static inline uint8_t Buttons_GetStatus_STOP(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Buttons_GetStatus_STOP(void) + { + return ((PINB & BUTTONS_STOP) ^ BUTTONS_STOP); + } + //BAS + + static inline uint8_t Buttons_GetStatus_BAS(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Buttons_GetStatus_BAS(void) + { + return ((PINF & BUTTONS_BAS) ^ BUTTONS_BAS); + } + + //DROITE + + static inline uint8_t Buttons_GetStatus_DROITE(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Buttons_GetStatus_DROITE(void) { - DDRD &= ~BUTTONS_BUTTON1; - PORTD &= ~BUTTONS_BUTTON1; + return ((PINF & BUTTONS_DROITE) ^ BUTTONS_DROITE); } + + //GAUCHE - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; - static inline uint8_t Buttons_GetStatus(void) + static inline uint8_t Buttons_GetStatus_GAUCHE(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Buttons_GetStatus_GAUCHE(void) { - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); + return ((PINF & BUTTONS_GAUCHE) ^ BUTTONS_GAUCHE); } + + //HAUT + + static inline uint8_t Buttons_GetStatus_HAUT(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Buttons_GetStatus_HAUT(void) + { + return ((PINF & BUTTONS_HAUT) ^ BUTTONS_HAUT); + } + + + #endif /* Disable C linkage for C++ Compilers: */ diff --git a/src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Joystick.h b/src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Joystick.h index 259c674..b75c90e 100644 --- a/src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Joystick.h +++ b/src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Joystick.h @@ -71,26 +71,27 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ - #define JOY_MASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4)) + #define JOY_MASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) ) // (1 << 4)) #endif /* Public Interface - May be used in end-application: */ /* Macros: */ /** Mask for the joystick being pushed in the left direction. */ - #define JOY_LEFT (1 << 2) + #define JOY_V (1 << 2) /** Mask for the joystick being pushed in the upward direction. */ - #define JOY_UP (1 << 3) - - /** Mask for the joystick being pushed in the right direction. */ - #define JOY_RIGHT (1 << 0) - - /** Mask for the joystick being pushed in the downward direction. */ - #define JOY_DOWN (1 << 1) - - /** Mask for the joystick being pushed inward. */ - #define JOY_PRESS (1 << 4) - + #define JOY_H (1 << 3) + + +// ** Mask for the joystick being pushed in the right direction. +// #define JOY_RIGHT (1 << 0) +// +// /** Mask for the joystick being pushed in the downward direction. +// #define JOY_DOWN (1 << 1) +// + // /** Mask for the joystick being pushed inward. + // #define JOY_PRESS (1 << 4) + /* Inline Functions: */ #if !defined(__DOXYGEN__) static inline void Joystick_Init(void) @@ -104,6 +105,9 @@ DDRD &= ~JOY_MASK; PORTD &= ~JOY_MASK; } + + + static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; static inline uint8_t Joystick_GetStatus(void) diff --git a/src/lufa-LUFA-170418/LUFA/Drivers/Board/Buttons.h b/src/lufa-LUFA-170418/LUFA/Drivers/Board/Buttons.h index 00ebe8c..41db85b 100644 --- a/src/lufa-LUFA-170418/LUFA/Drivers/Board/Buttons.h +++ b/src/lufa-LUFA-170418/LUFA/Drivers/Board/Buttons.h @@ -98,6 +98,8 @@ static inline uint_reg_t Buttons_GetStatus(void) { return 0; } #elif (BOARD == BOARD_USBKEY) #include "AVR8/USBKEY/Buttons.h" + #elif (BOARD == BOARD_PINGUI) + #include "AVR8/PINGUI/Buttons.h" #elif (BOARD == BOARD_STK525) #include "AVR8/STK525/Buttons.h" #elif (BOARD == BOARD_STK526) diff --git a/src/lufa-LUFA-170418/LUFA/Drivers/Board/Joystick.h b/src/lufa-LUFA-170418/LUFA/Drivers/Board/Joystick.h index 0d0fe89..0848890 100644 --- a/src/lufa-LUFA-170418/LUFA/Drivers/Board/Joystick.h +++ b/src/lufa-LUFA-170418/LUFA/Drivers/Board/Joystick.h @@ -122,8 +122,11 @@ #include "UC3/EVK1101/Joystick.h" #elif (BOARD == BOARD_EVK1100) #include "UC3/EVK1100/Joystick.h" - #else - #include "Board/Joystick.h" + #elif (BOARD == BOARD_PINGUI) + #include "AVR8/PINGUI/Joystick.h" + #elif + #include "BOARD/Joystick.h" + #endif /* Pseudo-Functions for Doxygen: */ diff --git a/src/lufa-LUFA-170418/LUFA/Drivers/Board/LEDs.h b/src/lufa-LUFA-170418/LUFA/Drivers/Board/LEDs.h index ba0b1bb..0cf6cb3 100644 --- a/src/lufa-LUFA-170418/LUFA/Drivers/Board/LEDs.h +++ b/src/lufa-LUFA-170418/LUFA/Drivers/Board/LEDs.h @@ -59,7 +59,12 @@ * directory. Otherwise, it will include the appropriate built-in board driver header file. If the BOARD value * is set to \c BOARD_NONE, this driver is silently disabled. * - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. + * For possible \c BOARD makefile values, see \ref Group_BoardTypes.static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t Buttons_GetStatus(void) + { + return ((PINF & BUTTONS_V) ^ BUTTONS_V); + } + * * \note To make code as compatible as possible, it is assumed that all boards carry a minimum of four LEDs. If * a board contains less than four LEDs, the remaining LED masks are defined to 0 so as to have no effect. @@ -211,8 +216,10 @@ #include "AVR8/POLOLUMICRO/LEDs.h" #elif (BOARD == BOARD_XPLAINED_MINI) #include "AVR8/XPLAINED_MINI/LEDs.h" + #elif (BOARD == BOARD_PINGUI) + #include "AVR8/PINGUI/LEDs.h" #else - #include "Board/LEDs.h" + #include "BOARD/LEDs.h" #endif /* Preprocessor Checks: */ diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/.Manette.c.swp b/src/lufa-LUFA-170418/PolytechLille/Manette/.Manette.c.swp deleted file mode 100644 index dd9acb3..0000000 Binary files a/src/lufa-LUFA-170418/PolytechLille/Manette/.Manette.c.swp and /dev/null differ diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/Makefile b/src/lufa-LUFA-170418/PolytechLille/Manette/Makefile index cbff916..e4af82b 100644 --- a/src/lufa-LUFA-170418/PolytechLille/Manette/Makefile +++ b/src/lufa-LUFA-170418/PolytechLille/Manette/Makefile @@ -13,7 +13,7 @@ #at90usb1287 MCU = atmega32u4 ARCH = AVR8 -BOARD = NONE +BOARD = PINGUI F_CPU = 16000000 F_USB = $(F_CPU) OPTIMIZATION = s diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c index 376a70a..def135a 100644 --- a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c +++ b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c @@ -102,8 +102,13 @@ void SetupHardware(void) /* Hardware Initialization */ Joystick_Init(); LEDs_Init(); - Buttons_Init(); USB_Init(); + Buttons_Init_HAUT(); + Buttons_Init_BAS(); + Buttons_Init_DROITE(); + Buttons_Init_GAUCHE(); + Buttons_Init_STOP(); + Buttons_Init_SEL(); } /** Event handler for the library USB Connection event. */ @@ -161,7 +166,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData; uint8_t JoyStatus_LCL = Joystick_GetStatus(); - uint8_t ButtonStatus_LCL = Buttons_GetStatus(); + uint8_t ButtonStatus_LCL = Buttons_GetStatus_HAUT(); if (JoyStatus_LCL & JOY_UP) JoystickReport->Y = -100; @@ -173,10 +178,10 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn else if (JoyStatus_LCL & JOY_RIGHT) JoystickReport->X = 100; - if (JoyStatus_LCL & JOY_PRESS) +/* if (JoyStatus_LCL & JOY_PRESS) JoystickReport->Button |= (1 << 1); - - if (ButtonStatus_LCL & BUTTONS_BUTTON1) +*/ + if (ButtonStatus_LCL & BUTTONS_HAUT) JoystickReport->Button |= (1 << 0); *ReportSize = sizeof(USB_JoystickReport_Data_t); @@ -202,3 +207,9 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI + + + + + + -- libgit2 0.21.2