diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c b/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c index 8468ecc..961c14a 100644 --- a/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c +++ b/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c @@ -140,6 +140,62 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = .EndpointSize = JOYSTICK_EPSIZE, .PollingIntervalMS = 0x05 } +/* .HID_Interface1 = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_Joystick, + .AlternateSetting = 0x00, + + .TotalEndpoints = 1, + + .Class = HID_CSCP_HIDClass, + .SubClass = HID_CSCP_NonBootSubclass, + .Protocol = HID_CSCP_NonBootProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .HID_ReportOUTEndpoint1 = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = JOYSTICK_EPADDR, + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = JOYSTICK_EPSIZE, + .PollingIntervalMS = 0x05 + + }, + + + .HID_Interface2 = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_Joystick, + .AlternateSetting = 0x00, + + .TotalEndpoints = 1, + + .Class = HID_CSCP_HIDClass, + .SubClass = HID_CSCP_NonBootSubclass, + .Protocol = HID_CSCP_NonBootProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .HID_ReportOUTEndpoint2 = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = JOYSTICK_EPADDR, + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = JOYSTICK_EPSIZE, + .PollingIntervalMS = 0x05 + + }, + +*/ }; /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.h b/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.h index 9de5562..468642c 100644 --- a/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.h +++ b/src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.h @@ -54,6 +54,8 @@ USB_Descriptor_Interface_t HID_Interface; USB_HID_Descriptor_HID_t HID_JoystickHID; USB_Descriptor_Endpoint_t HID_ReportINEndpoint; + // HID_Interface1;HID_ReportOUTEndpoint1; + // HID_Interface2;HID_ReportOUTEndpoint2; } USB_Descriptor_Configuration_t; /** Enum for the device interface descriptor IDs within the device. Each interface descriptor diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c index e9085e3..28ba1a9 100644 --- a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c +++ b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c @@ -166,12 +166,14 @@ 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_HAUT(); // poir les boutons + uint8_t ButtonStatus_LCL = Buttons_GetStatus_HAUT(); // poir les boutons JoystickReport->X = JoyStatus_LCL & 0xF0; JoystickReport->Y = JoyStatus_LCL & 0x0F; - + if (JoyStatus_LCL & BUTTONS_SEL) + { JoystickReport->Button |= ( 1<<1);} + // if (JoyStatus_LCL & JOY_LEFT) // JoystickReport->X = -100; diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.h b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.h index e6e61bc..afb1a50 100644 --- a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.h +++ b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.h @@ -60,7 +60,7 @@ int8_t X; /**< Current absolute joystick X position, as a signed 8-bit integer */ int8_t Y; /**< Current absolute joystick Y position, as a signed 8-bit integer */ int8_t Z; /**< Current absolute joystick Z position, as a signed 8-bit integer */ - uint8_t Button; /**< Bit mask of the currently pressed joystick buttons */ +uint8_t Button; /**< Bit mask of the currently pressed joystick buttons */ } USB_JoystickReport_Data_t; /* Macros: */ -- libgit2 0.21.2