Commit ed65270aa24d38308e8880d59e8eb81532908397
1 parent
5be8c2c2
Ajout des drivers pour les boutons, et le debut des leds
Showing
8 changed files
with
195 additions
and
33 deletions
Show diff stats
src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Buttons.h
@@ -71,27 +71,162 @@ | @@ -71,27 +71,162 @@ | ||
71 | /* Public Interface - May be used in end-application: */ | 71 | /* Public Interface - May be used in end-application: */ |
72 | /* Macros: */ | 72 | /* Macros: */ |
73 | /** Button mask for the first button on the board. */ | 73 | /** Button mask for the first button on the board. */ |
74 | - #define BUTTONS_BUTTON1 (1 << 7) | 74 | + #define BUTTONS_SEL (1 << 5) //PB5 |
75 | + #define BUTTONS_STOP (1 << 7) //PB7 | ||
76 | + #define BUTTONS_BAS (1 << 5) //PF5 | ||
77 | + #define BUTTONS_DROITE (1 << 4) //PF4 | ||
78 | + #define BUTTONS_GAUCHE (1 << 1) //PF1 | ||
79 | + #define BUTTONS_HAUT (1 << 0) //PF0 | ||
80 | + | ||
75 | 81 | ||
76 | /* Inline Functions: */ | 82 | /* Inline Functions: */ |
77 | #if !defined(__DOXYGEN__) | 83 | #if !defined(__DOXYGEN__) |
78 | - static inline void Buttons_Init(void) | 84 | + //BUTTON SEL |
85 | + // | ||
86 | + | ||
87 | + static inline void Buttons_Init_SEL(void) | ||
88 | + { | ||
89 | + DDRB &= ~BUTTONS_SEL; | ||
90 | + PORTB |= BUTTONS_SEL; | ||
91 | + } | ||
92 | + | ||
93 | + static inline void Buttons_Disable_SEL(void) | ||
94 | + { | ||
95 | + DDRB &= ~BUTTONS_SEL; | ||
96 | + PORTB &= ~BUTTONS_SEL; | ||
97 | + } | ||
98 | + | ||
99 | + | ||
100 | + | ||
101 | + // BUTTON STOP | ||
102 | + | ||
103 | + static inline void Buttons_Init_STOP(void) | ||
104 | + { | ||
105 | + DDRB &= ~BUTTONS_STOP; | ||
106 | + PORTB |= BUTTONS_STOP; | ||
107 | + } | ||
108 | + | ||
109 | + | ||
110 | + // BUTTON STOP | ||
111 | + | ||
112 | + static inline void Buttons_Disable_STOP(void) | ||
113 | + { | ||
114 | + DDRB &= ~BUTTONS_STOP; | ||
115 | + PORTB |= BUTTONS_STOP; | ||
116 | + } | ||
117 | + | ||
118 | + | ||
119 | + | ||
120 | + | ||
121 | + //BUTTON BAS | ||
122 | + | ||
123 | + | ||
124 | + static inline void Buttons_Init_BAS(void) | ||
125 | + { | ||
126 | + DDRF &= ~BUTTONS_BAS; | ||
127 | + PORTF |= BUTTONS_BAS; | ||
128 | + } | ||
129 | + | ||
130 | + static inline void Buttons_Disable_BAS(void) | ||
131 | + { | ||
132 | + DDRF &= ~BUTTONS_BAS; | ||
133 | + PORTF &= ~BUTTONS_BAS; | ||
134 | + } | ||
135 | + | ||
136 | + //BUTTON DROITE | ||
137 | + | ||
138 | + static inline void Buttons_Init_DROITE(void) | ||
139 | + { | ||
140 | + DDRF &= ~BUTTONS_DROITE; | ||
141 | + PORTF |= BUTTONS_DROITE; | ||
142 | + } | ||
143 | + | ||
144 | + static inline void Buttons_Disable_DROITE(void) | ||
145 | + { | ||
146 | + DDRF &= ~BUTTONS_DROITE; | ||
147 | + PORTF &= ~BUTTONS_DROITE; | ||
148 | + } | ||
149 | + | ||
150 | + //BUTTON GAUCHE | ||
151 | + | ||
152 | + static inline void Buttons_Init_GAUCHE(void) | ||
153 | + { | ||
154 | + DDRF &= ~BUTTONS_GAUCHE; | ||
155 | + PORTF |= BUTTONS_GAUCHE; | ||
156 | + } | ||
157 | + | ||
158 | + static inline void Buttons_Disable_GAUCHE(void) | ||
159 | + | ||
160 | + { | ||
161 | + DDRF &= ~BUTTONS_GAUCHE; | ||
162 | + PORTF &= ~BUTTONS_GAUCHE; | ||
163 | + } | ||
164 | + | ||
165 | + //BUTTON HAUT | ||
166 | + | ||
167 | + static inline void Buttons_Init_HAUT(void) | ||
168 | + { | ||
169 | + DDRF &= ~BUTTONS_HAUT; | ||
170 | + | ||
171 | + PORTF |= BUTTONS_HAUT; | ||
172 | + } | ||
173 | + | ||
174 | + static inline void Buttons_Disable_HAUT(void) | ||
175 | + { | ||
176 | + DDRF &= ~BUTTONS_HAUT; | ||
177 | + PORTF &= ~BUTTONS_HAUT; | ||
178 | + } | ||
179 | + | ||
180 | + | ||
181 | + //SEL | ||
182 | + | ||
183 | + static inline uint8_t Buttons_GetStatus_V(void) ATTR_WARN_UNUSED_RESULT; | ||
184 | + static inline uint8_t Buttons_GetStatus_V(void) | ||
79 | { | 185 | { |
80 | - DDRD &= ~BUTTONS_BUTTON1; | ||
81 | - PORTD |= BUTTONS_BUTTON1; | 186 | + return ((PINB & BUTTONS_SEL) ^ BUTTONS_SEL); |
82 | } | 187 | } |
83 | 188 | ||
84 | - static inline void Buttons_Disable(void) | 189 | + //STOP |
190 | + | ||
191 | + static inline uint8_t Buttons_GetStatus_STOP(void) ATTR_WARN_UNUSED_RESULT; | ||
192 | + static inline uint8_t Buttons_GetStatus_STOP(void) | ||
193 | + { | ||
194 | + return ((PINB & BUTTONS_STOP) ^ BUTTONS_STOP); | ||
195 | + } | ||
196 | + //BAS | ||
197 | + | ||
198 | + static inline uint8_t Buttons_GetStatus_BAS(void) ATTR_WARN_UNUSED_RESULT; | ||
199 | + static inline uint8_t Buttons_GetStatus_BAS(void) | ||
200 | + { | ||
201 | + return ((PINF & BUTTONS_BAS) ^ BUTTONS_BAS); | ||
202 | + } | ||
203 | + | ||
204 | + //DROITE | ||
205 | + | ||
206 | + static inline uint8_t Buttons_GetStatus_DROITE(void) ATTR_WARN_UNUSED_RESULT; | ||
207 | + static inline uint8_t Buttons_GetStatus_DROITE(void) | ||
85 | { | 208 | { |
86 | - DDRD &= ~BUTTONS_BUTTON1; | ||
87 | - PORTD &= ~BUTTONS_BUTTON1; | 209 | + return ((PINF & BUTTONS_DROITE) ^ BUTTONS_DROITE); |
88 | } | 210 | } |
211 | + | ||
212 | + //GAUCHE | ||
89 | 213 | ||
90 | - static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; | ||
91 | - static inline uint8_t Buttons_GetStatus(void) | 214 | + static inline uint8_t Buttons_GetStatus_GAUCHE(void) ATTR_WARN_UNUSED_RESULT; |
215 | + static inline uint8_t Buttons_GetStatus_GAUCHE(void) | ||
92 | { | 216 | { |
93 | - return ((PIND & BUTTONS_BUTTON1) ^ BUTTONS_BUTTON1); | 217 | + return ((PINF & BUTTONS_GAUCHE) ^ BUTTONS_GAUCHE); |
94 | } | 218 | } |
219 | + | ||
220 | + //HAUT | ||
221 | + | ||
222 | + static inline uint8_t Buttons_GetStatus_HAUT(void) ATTR_WARN_UNUSED_RESULT; | ||
223 | + static inline uint8_t Buttons_GetStatus_HAUT(void) | ||
224 | + { | ||
225 | + return ((PINF & BUTTONS_HAUT) ^ BUTTONS_HAUT); | ||
226 | + } | ||
227 | + | ||
228 | + | ||
229 | + | ||
95 | #endif | 230 | #endif |
96 | 231 | ||
97 | /* Disable C linkage for C++ Compilers: */ | 232 | /* Disable C linkage for C++ Compilers: */ |
src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Joystick.h
@@ -71,26 +71,27 @@ | @@ -71,26 +71,27 @@ | ||
71 | /* Private Interface - For use in library only: */ | 71 | /* Private Interface - For use in library only: */ |
72 | #if !defined(__DOXYGEN__) | 72 | #if !defined(__DOXYGEN__) |
73 | /* Macros: */ | 73 | /* Macros: */ |
74 | - #define JOY_MASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4)) | 74 | + #define JOY_MASK ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) ) // (1 << 4)) |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | /* Public Interface - May be used in end-application: */ | 77 | /* Public Interface - May be used in end-application: */ |
78 | /* Macros: */ | 78 | /* Macros: */ |
79 | /** Mask for the joystick being pushed in the left direction. */ | 79 | /** Mask for the joystick being pushed in the left direction. */ |
80 | - #define JOY_LEFT (1 << 2) | 80 | + #define JOY_V (1 << 2) |
81 | 81 | ||
82 | /** Mask for the joystick being pushed in the upward direction. */ | 82 | /** Mask for the joystick being pushed in the upward direction. */ |
83 | - #define JOY_UP (1 << 3) | ||
84 | - | ||
85 | - /** Mask for the joystick being pushed in the right direction. */ | ||
86 | - #define JOY_RIGHT (1 << 0) | ||
87 | - | ||
88 | - /** Mask for the joystick being pushed in the downward direction. */ | ||
89 | - #define JOY_DOWN (1 << 1) | ||
90 | - | ||
91 | - /** Mask for the joystick being pushed inward. */ | ||
92 | - #define JOY_PRESS (1 << 4) | ||
93 | - | 83 | + #define JOY_H (1 << 3) |
84 | + | ||
85 | + | ||
86 | +// ** Mask for the joystick being pushed in the right direction. | ||
87 | +// #define JOY_RIGHT (1 << 0) | ||
88 | +// | ||
89 | +// /** Mask for the joystick being pushed in the downward direction. | ||
90 | +// #define JOY_DOWN (1 << 1) | ||
91 | +// | ||
92 | + // /** Mask for the joystick being pushed inward. | ||
93 | + // #define JOY_PRESS (1 << 4) | ||
94 | + | ||
94 | /* Inline Functions: */ | 95 | /* Inline Functions: */ |
95 | #if !defined(__DOXYGEN__) | 96 | #if !defined(__DOXYGEN__) |
96 | static inline void Joystick_Init(void) | 97 | static inline void Joystick_Init(void) |
@@ -104,6 +105,9 @@ | @@ -104,6 +105,9 @@ | ||
104 | DDRD &= ~JOY_MASK; | 105 | DDRD &= ~JOY_MASK; |
105 | PORTD &= ~JOY_MASK; | 106 | PORTD &= ~JOY_MASK; |
106 | } | 107 | } |
108 | + | ||
109 | + | ||
110 | + | ||
107 | 111 | ||
108 | static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; | 112 | static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT; |
109 | static inline uint8_t Joystick_GetStatus(void) | 113 | static inline uint8_t Joystick_GetStatus(void) |
src/lufa-LUFA-170418/LUFA/Drivers/Board/Buttons.h
@@ -98,6 +98,8 @@ | @@ -98,6 +98,8 @@ | ||
98 | static inline uint_reg_t Buttons_GetStatus(void) { return 0; } | 98 | static inline uint_reg_t Buttons_GetStatus(void) { return 0; } |
99 | #elif (BOARD == BOARD_USBKEY) | 99 | #elif (BOARD == BOARD_USBKEY) |
100 | #include "AVR8/USBKEY/Buttons.h" | 100 | #include "AVR8/USBKEY/Buttons.h" |
101 | + #elif (BOARD == BOARD_PINGUI) | ||
102 | + #include "AVR8/PINGUI/Buttons.h" | ||
101 | #elif (BOARD == BOARD_STK525) | 103 | #elif (BOARD == BOARD_STK525) |
102 | #include "AVR8/STK525/Buttons.h" | 104 | #include "AVR8/STK525/Buttons.h" |
103 | #elif (BOARD == BOARD_STK526) | 105 | #elif (BOARD == BOARD_STK526) |
src/lufa-LUFA-170418/LUFA/Drivers/Board/Joystick.h
@@ -122,8 +122,11 @@ | @@ -122,8 +122,11 @@ | ||
122 | #include "UC3/EVK1101/Joystick.h" | 122 | #include "UC3/EVK1101/Joystick.h" |
123 | #elif (BOARD == BOARD_EVK1100) | 123 | #elif (BOARD == BOARD_EVK1100) |
124 | #include "UC3/EVK1100/Joystick.h" | 124 | #include "UC3/EVK1100/Joystick.h" |
125 | - #else | ||
126 | - #include "Board/Joystick.h" | 125 | + #elif (BOARD == BOARD_PINGUI) |
126 | + #include "AVR8/PINGUI/Joystick.h" | ||
127 | + #elif | ||
128 | + #include "BOARD/Joystick.h" | ||
129 | + | ||
127 | #endif | 130 | #endif |
128 | 131 | ||
129 | /* Pseudo-Functions for Doxygen: */ | 132 | /* Pseudo-Functions for Doxygen: */ |
src/lufa-LUFA-170418/LUFA/Drivers/Board/LEDs.h
@@ -59,7 +59,12 @@ | @@ -59,7 +59,12 @@ | ||
59 | * directory. Otherwise, it will include the appropriate built-in board driver header file. If the BOARD value | 59 | * directory. Otherwise, it will include the appropriate built-in board driver header file. If the BOARD value |
60 | * is set to \c BOARD_NONE, this driver is silently disabled. | 60 | * is set to \c BOARD_NONE, this driver is silently disabled. |
61 | * | 61 | * |
62 | - * For possible \c BOARD makefile values, see \ref Group_BoardTypes. | 62 | + * For possible \c BOARD makefile values, see \ref Group_BoardTypes.static inline uint8_t Buttons_GetStatus(void) ATTR_WARN_UNUSED_RESULT; |
63 | + static inline uint8_t Buttons_GetStatus(void) | ||
64 | + { | ||
65 | + return ((PINF & BUTTONS_V) ^ BUTTONS_V); | ||
66 | + } | ||
67 | + | ||
63 | * | 68 | * |
64 | * \note To make code as compatible as possible, it is assumed that all boards carry a minimum of four LEDs. If | 69 | * \note To make code as compatible as possible, it is assumed that all boards carry a minimum of four LEDs. If |
65 | * a board contains less than four LEDs, the remaining LED masks are defined to 0 so as to have no effect. | 70 | * 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 @@ | @@ -211,8 +216,10 @@ | ||
211 | #include "AVR8/POLOLUMICRO/LEDs.h" | 216 | #include "AVR8/POLOLUMICRO/LEDs.h" |
212 | #elif (BOARD == BOARD_XPLAINED_MINI) | 217 | #elif (BOARD == BOARD_XPLAINED_MINI) |
213 | #include "AVR8/XPLAINED_MINI/LEDs.h" | 218 | #include "AVR8/XPLAINED_MINI/LEDs.h" |
219 | + #elif (BOARD == BOARD_PINGUI) | ||
220 | + #include "AVR8/PINGUI/LEDs.h" | ||
214 | #else | 221 | #else |
215 | - #include "Board/LEDs.h" | 222 | + #include "BOARD/LEDs.h" |
216 | #endif | 223 | #endif |
217 | 224 | ||
218 | /* Preprocessor Checks: */ | 225 | /* Preprocessor Checks: */ |
src/lufa-LUFA-170418/PolytechLille/Manette/.Manette.c.swp deleted
No preview for this file type
src/lufa-LUFA-170418/PolytechLille/Manette/Makefile
src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c
@@ -102,8 +102,13 @@ void SetupHardware(void) | @@ -102,8 +102,13 @@ void SetupHardware(void) | ||
102 | /* Hardware Initialization */ | 102 | /* Hardware Initialization */ |
103 | Joystick_Init(); | 103 | Joystick_Init(); |
104 | LEDs_Init(); | 104 | LEDs_Init(); |
105 | - Buttons_Init(); | ||
106 | USB_Init(); | 105 | USB_Init(); |
106 | + Buttons_Init_HAUT(); | ||
107 | + Buttons_Init_BAS(); | ||
108 | + Buttons_Init_DROITE(); | ||
109 | + Buttons_Init_GAUCHE(); | ||
110 | + Buttons_Init_STOP(); | ||
111 | + Buttons_Init_SEL(); | ||
107 | } | 112 | } |
108 | 113 | ||
109 | /** Event handler for the library USB Connection event. */ | 114 | /** Event handler for the library USB Connection event. */ |
@@ -161,7 +166,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | @@ -161,7 +166,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | ||
161 | USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData; | 166 | USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData; |
162 | 167 | ||
163 | uint8_t JoyStatus_LCL = Joystick_GetStatus(); | 168 | uint8_t JoyStatus_LCL = Joystick_GetStatus(); |
164 | - uint8_t ButtonStatus_LCL = Buttons_GetStatus(); | 169 | + uint8_t ButtonStatus_LCL = Buttons_GetStatus_HAUT(); |
165 | 170 | ||
166 | if (JoyStatus_LCL & JOY_UP) | 171 | if (JoyStatus_LCL & JOY_UP) |
167 | JoystickReport->Y = -100; | 172 | JoystickReport->Y = -100; |
@@ -173,10 +178,10 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | @@ -173,10 +178,10 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | ||
173 | else if (JoyStatus_LCL & JOY_RIGHT) | 178 | else if (JoyStatus_LCL & JOY_RIGHT) |
174 | JoystickReport->X = 100; | 179 | JoystickReport->X = 100; |
175 | 180 | ||
176 | - if (JoyStatus_LCL & JOY_PRESS) | 181 | +/* if (JoyStatus_LCL & JOY_PRESS) |
177 | JoystickReport->Button |= (1 << 1); | 182 | JoystickReport->Button |= (1 << 1); |
178 | - | ||
179 | - if (ButtonStatus_LCL & BUTTONS_BUTTON1) | 183 | +*/ |
184 | + if (ButtonStatus_LCL & BUTTONS_HAUT) | ||
180 | JoystickReport->Button |= (1 << 0); | 185 | JoystickReport->Button |= (1 << 0); |
181 | 186 | ||
182 | *ReportSize = sizeof(USB_JoystickReport_Data_t); | 187 | *ReportSize = sizeof(USB_JoystickReport_Data_t); |
@@ -202,3 +207,9 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI | @@ -202,3 +207,9 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI | ||
202 | 207 | ||
203 | 208 | ||
204 | 209 | ||
210 | + | ||
211 | + | ||
212 | + | ||
213 | + | ||
214 | + | ||
215 | + |