Commit 93cb7e9780979196f7b563006494784c7c4d1655
1 parent
a072f3c2
Les quatre boutons gauche, haut, droite et gauche fonctionnent, moyennant la des…
…activation d'un registre dans le setup_hardware
Showing
3 changed files
with
26 additions
and
14 deletions
Show diff stats
src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Buttons.h
@@ -124,7 +124,7 @@ | @@ -124,7 +124,7 @@ | ||
124 | static inline void Buttons_Init_BAS(void) | 124 | static inline void Buttons_Init_BAS(void) |
125 | { | 125 | { |
126 | DDRF &= ~BUTTONS_BAS; | 126 | DDRF &= ~BUTTONS_BAS; |
127 | - PORTF |= BUTTONS_BAS; | 127 | + //PORTF |= BUTTONS_BAS; |
128 | } | 128 | } |
129 | 129 | ||
130 | static inline void Buttons_Disable_BAS(void) | 130 | static inline void Buttons_Disable_BAS(void) |
@@ -138,7 +138,7 @@ | @@ -138,7 +138,7 @@ | ||
138 | static inline void Buttons_Init_DROITE(void) | 138 | static inline void Buttons_Init_DROITE(void) |
139 | { | 139 | { |
140 | DDRF &= ~BUTTONS_DROITE; | 140 | DDRF &= ~BUTTONS_DROITE; |
141 | - PORTF |= BUTTONS_DROITE; | 141 | + //PORTF |= BUTTONS_DROITE; |
142 | } | 142 | } |
143 | 143 | ||
144 | static inline void Buttons_Disable_DROITE(void) | 144 | static inline void Buttons_Disable_DROITE(void) |
@@ -152,7 +152,7 @@ | @@ -152,7 +152,7 @@ | ||
152 | static inline void Buttons_Init_GAUCHE(void) | 152 | static inline void Buttons_Init_GAUCHE(void) |
153 | { | 153 | { |
154 | DDRF &= ~BUTTONS_GAUCHE; | 154 | DDRF &= ~BUTTONS_GAUCHE; |
155 | - PORTF |= BUTTONS_GAUCHE; | 155 | + // PORTF |= BUTTONS_GAUCHE; |
156 | } | 156 | } |
157 | 157 | ||
158 | static inline void Buttons_Disable_GAUCHE(void) | 158 | static inline void Buttons_Disable_GAUCHE(void) |
@@ -198,7 +198,7 @@ | @@ -198,7 +198,7 @@ | ||
198 | static inline uint8_t Buttons_GetStatus_BAS(void) ATTR_WARN_UNUSED_RESULT; | 198 | static inline uint8_t Buttons_GetStatus_BAS(void) ATTR_WARN_UNUSED_RESULT; |
199 | static inline uint8_t Buttons_GetStatus_BAS(void) | 199 | static inline uint8_t Buttons_GetStatus_BAS(void) |
200 | { | 200 | { |
201 | - return ((PINF & BUTTONS_BAS) ^ BUTTONS_BAS); | 201 | + return (PINF & BUTTONS_BAS) ; |
202 | } | 202 | } |
203 | 203 | ||
204 | //DROITE | 204 | //DROITE |
@@ -206,7 +206,7 @@ | @@ -206,7 +206,7 @@ | ||
206 | static inline uint8_t Buttons_GetStatus_DROITE(void) ATTR_WARN_UNUSED_RESULT; | 206 | static inline uint8_t Buttons_GetStatus_DROITE(void) ATTR_WARN_UNUSED_RESULT; |
207 | static inline uint8_t Buttons_GetStatus_DROITE(void) | 207 | static inline uint8_t Buttons_GetStatus_DROITE(void) |
208 | { | 208 | { |
209 | - return ((PINF & BUTTONS_DROITE) ^ BUTTONS_DROITE); | 209 | + return (PINF & BUTTONS_DROITE) ; |
210 | } | 210 | } |
211 | 211 | ||
212 | //GAUCHE | 212 | //GAUCHE |
@@ -214,8 +214,9 @@ | @@ -214,8 +214,9 @@ | ||
214 | static inline uint8_t Buttons_GetStatus_GAUCHE(void) ATTR_WARN_UNUSED_RESULT; | 214 | static inline uint8_t Buttons_GetStatus_GAUCHE(void) ATTR_WARN_UNUSED_RESULT; |
215 | static inline uint8_t Buttons_GetStatus_GAUCHE(void) | 215 | static inline uint8_t Buttons_GetStatus_GAUCHE(void) |
216 | { | 216 | { |
217 | - return ((PINF & BUTTONS_GAUCHE) ^ BUTTONS_GAUCHE); | 217 | + return (PINF & BUTTONS_GAUCHE); |
218 | } | 218 | } |
219 | +//Seul le bouton haut est fonctionnel, il faut changer les init et les return de chaque bouton (sauf le bouton du joystick) de la meme maniere | ||
219 | 220 | ||
220 | //HAUT | 221 | //HAUT |
221 | 222 |
src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c
@@ -149,9 +149,9 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = | @@ -149,9 +149,9 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = | ||
149 | 149 | ||
150 | .TotalEndpoints = 1, | 150 | .TotalEndpoints = 1, |
151 | 151 | ||
152 | - .Class = HID_CSCP_HIDClass, | ||
153 | - .SubClass = HID_CSCP_NonBootSubclass, | ||
154 | - .Protocol = HID_CSCP_NonBootProtocol, | 152 | + .Class = USB_CSCP_VendorSpecificClass, |
153 | + .SubClass = 0, | ||
154 | + .Protocol = 0, | ||
155 | 155 | ||
156 | .InterfaceStrIndex = NO_DESCRIPTOR | 156 | .InterfaceStrIndex = NO_DESCRIPTOR |
157 | }, | 157 | }, |
@@ -177,9 +177,9 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = | @@ -177,9 +177,9 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = | ||
177 | 177 | ||
178 | .TotalEndpoints = 1, | 178 | .TotalEndpoints = 1, |
179 | 179 | ||
180 | - .Class = HID_CSCP_HIDClass, | ||
181 | - .SubClass = HID_CSCP_NonBootSubclass, | ||
182 | - .Protocol = HID_CSCP_NonBootProtocol, | 180 | + .Class = USB_CSCP_VendorSpecificClass, |
181 | + .SubClass = 0, | ||
182 | + .Protocol = 0, | ||
183 | 183 | ||
184 | .InterfaceStrIndex = NO_DESCRIPTOR | 184 | .InterfaceStrIndex = NO_DESCRIPTOR |
185 | }, | 185 | }, |
src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c
@@ -115,6 +115,8 @@ void SetupHardware(void) | @@ -115,6 +115,8 @@ void SetupHardware(void) | ||
115 | Buttons_Init_GAUCHE(); | 115 | Buttons_Init_GAUCHE(); |
116 | Buttons_Init_STOP(); | 116 | Buttons_Init_STOP(); |
117 | Buttons_Init_SEL(); | 117 | Buttons_Init_SEL(); |
118 | + MCUCR|=(1<<JTD); | ||
119 | + MCUCR|=(1<<JTD); | ||
118 | } | 120 | } |
119 | 121 | ||
120 | /** Event handler for the library USB Connection event. */ | 122 | /** Event handler for the library USB Connection event. */ |
@@ -172,13 +174,22 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | @@ -172,13 +174,22 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn | ||
172 | USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData; | 174 | USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData; |
173 | 175 | ||
174 | uint8_t JoyStatus_LCL = Joystick_GetStatus(); | 176 | uint8_t JoyStatus_LCL = Joystick_GetStatus(); |
175 | - uint8_t ButtonStatus_LCL = Buttons_GetStatus_HAUT(); // poir les boutons | 177 | + uint8_t ButtonStatus_LCL_HAUT = Buttons_GetStatus_HAUT(); // poir bouton_haut |
178 | + uint8_t ButtonStatus_LCL_GAUCHE = Buttons_GetStatus_GAUCHE(); //pour bouton_gauche | ||
176 | 179 | ||
180 | + uint8_t ButtonStatus_LCL_BAS = Buttons_GetStatus_BAS(); | ||
181 | + uint8_t ButtonStatus_LCL_DROITE = Buttons_GetStatus_DROITE(); | ||
177 | 182 | ||
178 | JoystickReport->X = JoyStatus_LCL >> 4; | 183 | JoystickReport->X = JoyStatus_LCL >> 4; |
179 | JoystickReport->Y = JoyStatus_LCL & 0x0F; | 184 | JoystickReport->Y = JoyStatus_LCL & 0x0F; |
180 | - if (ButtonStatus_LCL & BUTTONS_HAUT) | 185 | + if (ButtonStatus_LCL_HAUT & BUTTONS_HAUT) |
181 | { JoystickReport->Button |= ( 1<<0);} | 186 | { JoystickReport->Button |= ( 1<<0);} |
187 | + if (ButtonStatus_LCL_GAUCHE & BUTTONS_GAUCHE) | ||
188 | + { JoystickReport->Button |= ( 1<<1);} | ||
189 | + if (ButtonStatus_LCL_BAS & BUTTONS_BAS) | ||
190 | + { JoystickReport->Button |= ( 1<<2);} | ||
191 | + if (ButtonStatus_LCL_DROITE & BUTTONS_DROITE) | ||
192 | + { JoystickReport->Button |= ( 1<<3);} | ||
182 | 193 | ||
183 | 194 | ||
184 | // if (JoyStatus_LCL & JOY_LEFT) | 195 | // if (JoyStatus_LCL & JOY_LEFT) |