Commit 813e00af16fd17e4722f8eb5fb62ccfaf28ba83a

Authored by rguillom
1 parent 1bbb7756

Partie 3 : Descriptors et PAD : quelques modifications, notamment la taille des EP

Partie 1 : fonctions enum_periph + config_periph revisitées
+ ajout fonction liberer_interfaces
+ mise de côté de la structure tab_pa
+ commentaires et fix
lufa-master/PolytechLille/PAD/Descriptors.c
@@ -133,7 +133,7 @@ const USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor @@ -133,7 +133,7 @@ const USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor
133 { 133 {
134 .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, 134 .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
135 135
136 - .InterfaceNumber = INTERFACE_ID_InterfaceIN, //pas sur mais presque 136 + .InterfaceNumber = INTERFACE_ID_InterfaceIN
137 .AlternateSetting = 0x00, 137 .AlternateSetting = 0x00,
138 138
139 .TotalEndpoints = 2, 139 .TotalEndpoints = 2,
@@ -151,7 +151,7 @@ const USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor @@ -151,7 +151,7 @@ const USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor
151 151
152 .EndpointAddress = KEYBOARD_IN_Bout_EPADDR, 152 .EndpointAddress = KEYBOARD_IN_Bout_EPADDR,
153 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), 153 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
154 - .EndpointSize = KEYBOARD_EPSIZE, 154 + .EndpointSize = BOUTONS_EPSIZE,
155 .PollingIntervalMS = 0x05 155 .PollingIntervalMS = 0x05
156 }, 156 },
157 157
@@ -161,7 +161,7 @@ const USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor @@ -161,7 +161,7 @@ const USB_Descriptor_Configuration_t PROGMEM RelayBoard_ConfigurationDescriptor
161 161
162 .EndpointAddress = KEYBOARD_IN_Joy_EPADDR, 162 .EndpointAddress = KEYBOARD_IN_Joy_EPADDR,
163 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), 163 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
164 - .EndpointSize = KEYBOARD_EPSIZE, 164 + .EndpointSize = JOYSTICK_EPSIZE,
165 .PollingIntervalMS = 0x05 165 .PollingIntervalMS = 0x05
166 } 166 }
167 }; 167 };
lufa-master/PolytechLille/PAD/Descriptors.h
@@ -94,6 +94,8 @@ @@ -94,6 +94,8 @@
94 94
95 /** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */ 95 /** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
96 #define KEYBOARD_EPSIZE 8 96 #define KEYBOARD_EPSIZE 8
  97 + #define BOUTONS_EPSIZE 8
  98 + #define JOYSTICK_EPSIZE 16
97 99
98 100
99 /* Function Prototypes: */ 101 /* Function Prototypes: */
lufa-master/PolytechLille/PAD/PAD.c
@@ -86,8 +86,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) @@ -86,8 +86,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
86 bool ConfigSuccess = true; 86 bool ConfigSuccess = true;
87 87
88 /* Setup HID Report Endpoints */ //MODIFS ICI 88 /* Setup HID Report Endpoints */ //MODIFS ICI
89 - ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_Bout_EPADDR, EP_TYPE_INTERRUPT, KEYBOARD_EPSIZE, 1);  
90 - ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_Joy_EPADDR, EP_TYPE_INTERRUPT, KEYBOARD_EPSIZE, 1); 89 + ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_Bout_EPADDR, EP_TYPE_INTERRUPT, BOUTONS_EPSIZE, 1);
  90 + ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_Joy_EPADDR, EP_TYPE_INTERRUPT, JOYSTICK_EPSIZE, 1);
91 ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPADDR, EP_TYPE_INTERRUPT, KEYBOARD_EPSIZE, 1); 91 ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_OUT_EPADDR, EP_TYPE_INTERRUPT, KEYBOARD_EPSIZE, 1);
92 92
93 /* Turn on Start-of-Frame events for tracking HID report period expiry */ 93 /* Turn on Start-of-Frame events for tracking HID report period expiry */