Commit 9d00e40db87ad851a70631183233b104101b298f

Authored by gperson
1 parent 5a6dca56

Les boutons et le joystick marchent ! Youpi!

src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c
@@ -52,7 +52,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] = @@ -52,7 +52,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] =
52 * Max physical X/Y/Z Axis values (used to determine resolution): 1 52 * Max physical X/Y/Z Axis values (used to determine resolution): 1
53 * Buttons: 2 53 * Buttons: 2
54 */ 54 */
55 - HID_DESCRIPTOR_JOYSTICK(-100, 100, -1, 1, 2) 55 + HID_DESCRIPTOR_JOYSTICK(0, 15, -1, 1, 6)
56 }; 56 };
57 57
58 /** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall 58 /** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
@@ -94,7 +94,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = @@ -94,7 +94,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
94 .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, 94 .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
95 95
96 .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), 96 .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
97 - .TotalInterfaces = 1, 97 + .TotalInterfaces = 3,
98 98
99 .ConfigurationNumber = 1, 99 .ConfigurationNumber = 1,
100 .ConfigurationStrIndex = NO_DESCRIPTOR, 100 .ConfigurationStrIndex = NO_DESCRIPTOR,
@@ -162,7 +162,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = @@ -162,7 +162,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
162 162
163 .EndpointAddress = LEDS_EPADDR, 163 .EndpointAddress = LEDS_EPADDR,
164 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), 164 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
165 - .EndpointSize = JOYSTICK_EPSIZE, 165 + .EndpointSize = LEDS_EPSIZE,
166 .PollingIntervalMS = 0x05 166 .PollingIntervalMS = 0x05
167 167
168 }, 168 },
@@ -190,7 +190,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = @@ -190,7 +190,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
190 190
191 .EndpointAddress = VIBRATORS_EPADDR, 191 .EndpointAddress = VIBRATORS_EPADDR,
192 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), 192 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
193 - .EndpointSize = JOYSTICK_EPSIZE, 193 + .EndpointSize = VIBRATORS_EPSIZE,
194 .PollingIntervalMS = 0x05 194 .PollingIntervalMS = 0x05
195 195
196 }, 196 },
src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c
@@ -175,9 +175,9 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn @@ -175,9 +175,9 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
175 uint8_t ButtonStatus_LCL = Buttons_GetStatus_HAUT(); // poir les boutons 175 uint8_t ButtonStatus_LCL = Buttons_GetStatus_HAUT(); // poir les boutons
176 176
177 177
178 - JoystickReport->X = JoyStatus_LCL & 0xF0;  
179 - JoystickReport->Y = (JoyStatus_LCL & 0x0F)<<4;  
180 - if (JoyStatus_LCL & BUTTONS_HAUT) 178 + JoystickReport->X = JoyStatus_LCL >> 4;
  179 + JoystickReport->Y = JoyStatus_LCL & 0x0F;
  180 + if (ButtonStatus_LCL & BUTTONS_HAUT)
181 { JoystickReport->Button |= ( 1<<0);} 181 { JoystickReport->Button |= ( 1<<0);}
182 182
183 183