From 9d00e40db87ad851a70631183233b104101b298f Mon Sep 17 00:00:00 2001 From: gperson Date: Wed, 9 Dec 2020 11:00:55 +0100 Subject: [PATCH] Les boutons et le joystick marchent ! Youpi! --- src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c | 8 ++++---- src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c b/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c index a96047e..d22187e 100644 --- a/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c +++ b/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c @@ -52,7 +52,7 @@ const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] = * Max physical X/Y/Z Axis values (used to determine resolution): 1 * Buttons: 2 */ - HID_DESCRIPTOR_JOYSTICK(-100, 100, -1, 1, 2) + HID_DESCRIPTOR_JOYSTICK(0, 15, -1, 1, 6) }; /** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall @@ -94,7 +94,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), - .TotalInterfaces = 1, + .TotalInterfaces = 3, .ConfigurationNumber = 1, .ConfigurationStrIndex = NO_DESCRIPTOR, @@ -162,7 +162,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = LEDS_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = JOYSTICK_EPSIZE, + .EndpointSize = LEDS_EPSIZE, .PollingIntervalMS = 0x05 }, @@ -190,7 +190,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointAddress = VIBRATORS_EPADDR, .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), - .EndpointSize = JOYSTICK_EPSIZE, + .EndpointSize = VIBRATORS_EPSIZE, .PollingIntervalMS = 0x05 }, diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c index a6853c0..9649a4a 100644 --- a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c +++ b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c @@ -175,9 +175,9 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn uint8_t ButtonStatus_LCL = Buttons_GetStatus_HAUT(); // poir les boutons - JoystickReport->X = JoyStatus_LCL & 0xF0; - JoystickReport->Y = (JoyStatus_LCL & 0x0F)<<4; - if (JoyStatus_LCL & BUTTONS_HAUT) + JoystickReport->X = JoyStatus_LCL >> 4; + JoystickReport->Y = JoyStatus_LCL & 0x0F; + if (ButtonStatus_LCL & BUTTONS_HAUT) { JoystickReport->Button |= ( 1<<0);} -- libgit2 0.21.2