Commit c84ba5c097fa5f482b1a6fc4f1a691d4b86b9efb

Authored by gperson
1 parent 70c40cb9

le joystick fonctionne, reste a faire en sorte que le bouton fonctionne correcte…

…ment car pour linstant il s'actionne quand le joystick bouge
src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c
@@ -140,6 +140,62 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = @@ -140,6 +140,62 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
140 .EndpointSize = JOYSTICK_EPSIZE, 140 .EndpointSize = JOYSTICK_EPSIZE,
141 .PollingIntervalMS = 0x05 141 .PollingIntervalMS = 0x05
142 } 142 }
  143 +/* .HID_Interface1 =
  144 + {
  145 + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
  146 +
  147 + .InterfaceNumber = INTERFACE_ID_Joystick,
  148 + .AlternateSetting = 0x00,
  149 +
  150 + .TotalEndpoints = 1,
  151 +
  152 + .Class = HID_CSCP_HIDClass,
  153 + .SubClass = HID_CSCP_NonBootSubclass,
  154 + .Protocol = HID_CSCP_NonBootProtocol,
  155 +
  156 + .InterfaceStrIndex = NO_DESCRIPTOR
  157 + },
  158 +
  159 + .HID_ReportOUTEndpoint1 =
  160 + {
  161 + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
  162 +
  163 + .EndpointAddress = JOYSTICK_EPADDR,
  164 + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
  165 + .EndpointSize = JOYSTICK_EPSIZE,
  166 + .PollingIntervalMS = 0x05
  167 +
  168 + },
  169 +
  170 +
  171 + .HID_Interface2 =
  172 + {
  173 + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
  174 +
  175 + .InterfaceNumber = INTERFACE_ID_Joystick,
  176 + .AlternateSetting = 0x00,
  177 +
  178 + .TotalEndpoints = 1,
  179 +
  180 + .Class = HID_CSCP_HIDClass,
  181 + .SubClass = HID_CSCP_NonBootSubclass,
  182 + .Protocol = HID_CSCP_NonBootProtocol,
  183 +
  184 + .InterfaceStrIndex = NO_DESCRIPTOR
  185 + },
  186 +
  187 + .HID_ReportOUTEndpoint2 =
  188 + {
  189 + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
  190 +
  191 + .EndpointAddress = JOYSTICK_EPADDR,
  192 + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
  193 + .EndpointSize = JOYSTICK_EPSIZE,
  194 + .PollingIntervalMS = 0x05
  195 +
  196 + },
  197 +
  198 +*/
143 }; 199 };
144 200
145 /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests 201 /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.h
@@ -54,6 +54,8 @@ @@ -54,6 +54,8 @@
54 USB_Descriptor_Interface_t HID_Interface; 54 USB_Descriptor_Interface_t HID_Interface;
55 USB_HID_Descriptor_HID_t HID_JoystickHID; 55 USB_HID_Descriptor_HID_t HID_JoystickHID;
56 USB_Descriptor_Endpoint_t HID_ReportINEndpoint; 56 USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
  57 + // HID_Interface1;HID_ReportOUTEndpoint1;
  58 + // HID_Interface2;HID_ReportOUTEndpoint2;
57 } USB_Descriptor_Configuration_t; 59 } USB_Descriptor_Configuration_t;
58 60
59 /** Enum for the device interface descriptor IDs within the device. Each interface descriptor 61 /** Enum for the device interface descriptor IDs within the device. Each interface descriptor
src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c
@@ -166,12 +166,14 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn @@ -166,12 +166,14 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
166 USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData; 166 USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;
167 167
168 uint8_t JoyStatus_LCL = Joystick_GetStatus(); 168 uint8_t JoyStatus_LCL = Joystick_GetStatus();
169 - //uint8_t ButtonStatus_LCL = Buttons_GetStatus_HAUT(); // poir les boutons 169 + uint8_t ButtonStatus_LCL = Buttons_GetStatus_HAUT(); // poir les boutons
170 170
171 171
172 JoystickReport->X = JoyStatus_LCL & 0xF0; 172 JoystickReport->X = JoyStatus_LCL & 0xF0;
173 JoystickReport->Y = JoyStatus_LCL & 0x0F; 173 JoystickReport->Y = JoyStatus_LCL & 0x0F;
174 - 174 + if (JoyStatus_LCL & BUTTONS_SEL)
  175 + { JoystickReport->Button |= ( 1<<1);}
  176 +
175 177
176 // if (JoyStatus_LCL & JOY_LEFT) 178 // if (JoyStatus_LCL & JOY_LEFT)
177 // JoystickReport->X = -100; 179 // JoystickReport->X = -100;
src/lufa-LUFA-170418/PolytechLille/Manette/Manette.h
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 int8_t X; /**< Current absolute joystick X position, as a signed 8-bit integer */ 60 int8_t X; /**< Current absolute joystick X position, as a signed 8-bit integer */
61 int8_t Y; /**< Current absolute joystick Y position, as a signed 8-bit integer */ 61 int8_t Y; /**< Current absolute joystick Y position, as a signed 8-bit integer */
62 int8_t Z; /**< Current absolute joystick Z position, as a signed 8-bit integer */ 62 int8_t Z; /**< Current absolute joystick Z position, as a signed 8-bit integer */
63 - uint8_t Button; /**< Bit mask of the currently pressed joystick buttons */ 63 +uint8_t Button; /**< Bit mask of the currently pressed joystick buttons */
64 } USB_JoystickReport_Data_t; 64 } USB_JoystickReport_Data_t;
65 65
66 /* Macros: */ 66 /* Macros: */