Commit d491a2d57eb4ef99b7a356de15f7a75766ff643d

Authored by gperson
1 parent c84ba5c0

correction de l'ajout des interfaces pour les leds et vibreurs, les interfaces o…

…nt leur id definie, leur taille aussi, et sont bien definis dans le descriptors.h aussi. correction de certaines erreurs de typo (qui me semblauient avoir ete corrigees precedemment mais apparemment pas )
src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Buttons.h
@@ -168,7 +168,7 @@ @@ -168,7 +168,7 @@
168 { 168 {
169 DDRF &= ~BUTTONS_HAUT; 169 DDRF &= ~BUTTONS_HAUT;
170 170
171 - PORTF |= BUTTONS_HAUT; 171 + //PORTF |= BUTTONS_HAUT; pas besoin, ne sert que pour le port b apparemment faudrait enlever cette ligne pour tous les boutons sauf pour le port B
172 } 172 }
173 173
174 static inline void Buttons_Disable_HAUT(void) 174 static inline void Buttons_Disable_HAUT(void)
src/lufa-LUFA-170418/LUFA/Drivers/Board/AVR8/PINGUI/Joystick.h
@@ -139,12 +139,12 @@ @@ -139,12 +139,12 @@
139 static inline uint8_t Joystick_GetStatus(void) 139 static inline uint8_t Joystick_GetStatus(void)
140 { 140 {
141 adc_init(joy_X_ADC); 141 adc_init(joy_X_ADC);
142 - uinit8_t Xquatrebits = adc_read(); 142 + uint8_t Xquatrebits = adc_read();
143 Xquatrebits&=0xF0; //pour les quatres bits de poids fort pour axe X 143 Xquatrebits&=0xF0; //pour les quatres bits de poids fort pour axe X
144 - adc_init(joy_Y_ADC);  
145 - uinit8_t Yquatrebits = adc_read(); 144 + adc_int(joy_Y_ADC);
  145 + uint8_t Yquatrebits = adc_read();
146 Yquatrebits&=0xF0; 146 Yquatrebits&=0xF0;
147 - Yquatrebits=Yquatrebits>>4 //pour les quatres bits de poids faible pour axe Y, on place en fort et on decale de 4 bits into le poids faible 147 + Yquatrebits=Yquatrebits>>4; //pour les quatres bits de poids faible pour axe Y, on place en fort et on decale de 4 bits into le poids faible
148 return (uint8_t)(Xquatrebits+Yquatrebits); 148 return (uint8_t)(Xquatrebits+Yquatrebits);
149 } 149 }
150 #endif 150 #endif
src/lufa-LUFA-170418/PolytechLille/Manette/Descriptors.c
@@ -139,12 +139,12 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = @@ -139,12 +139,12 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
139 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), 139 .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
140 .EndpointSize = JOYSTICK_EPSIZE, 140 .EndpointSize = JOYSTICK_EPSIZE,
141 .PollingIntervalMS = 0x05 141 .PollingIntervalMS = 0x05
142 - }  
143 -/* .HID_Interface1 = 142 + },
  143 + .HID_Interface1 =
144 { 144 {
145 .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, 145 .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
146 146
147 - .InterfaceNumber = INTERFACE_ID_Joystick, 147 + .InterfaceNumber = INTERFACE_ID_LEDS,
148 .AlternateSetting = 0x00, 148 .AlternateSetting = 0x00,
149 149
150 .TotalEndpoints = 1, 150 .TotalEndpoints = 1,
@@ -160,7 +160,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = @@ -160,7 +160,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
160 { 160 {
161 .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, 161 .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
162 162
163 - .EndpointAddress = JOYSTICK_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 = JOYSTICK_EPSIZE,
166 .PollingIntervalMS = 0x05 166 .PollingIntervalMS = 0x05
@@ -172,7 +172,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = @@ -172,7 +172,7 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
172 { 172 {
173 .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, 173 .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
174 174
175 - .InterfaceNumber = INTERFACE_ID_Joystick, 175 + .InterfaceNumber = INTERFACE_ID_VIBRATORS,
176 .AlternateSetting = 0x00, 176 .AlternateSetting = 0x00,
177 177
178 .TotalEndpoints = 1, 178 .TotalEndpoints = 1,
@@ -188,14 +188,14 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = @@ -188,14 +188,14 @@ const USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
188 { 188 {
189 .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, 189 .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
190 190
191 - .EndpointAddress = JOYSTICK_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 = JOYSTICK_EPSIZE,
194 .PollingIntervalMS = 0x05 194 .PollingIntervalMS = 0x05
195 195
196 }, 196 },
197 197
198 -*/ 198 +
199 }; 199 };
200 200
201 /** 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,8 +54,11 @@ @@ -54,8 +54,11 @@
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_Interface_t HID_Interface1;
  58 + USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint1;
  59 + USB_Descriptor_Interface_t HID_Interface2;
  60 + USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint2;
  61 +
59 } USB_Descriptor_Configuration_t; 62 } USB_Descriptor_Configuration_t;
60 63
61 /** Enum for the device interface descriptor IDs within the device. Each interface descriptor 64 /** Enum for the device interface descriptor IDs within the device. Each interface descriptor
@@ -65,6 +68,8 @@ @@ -65,6 +68,8 @@
65 enum InterfaceDescriptors_t 68 enum InterfaceDescriptors_t
66 { 69 {
67 INTERFACE_ID_Joystick = 0, /**< Joystick interface desciptor ID */ 70 INTERFACE_ID_Joystick = 0, /**< Joystick interface desciptor ID */
  71 + INTERFACE_ID_LEDS = 6,
  72 + INTERFACE_ID_VIBRATORS = 7,
68 }; 73 };
69 74
70 /** Enum for the device string descriptor IDs within the device. Each string descriptor should 75 /** Enum for the device string descriptor IDs within the device. Each string descriptor should
@@ -81,9 +86,12 @@ @@ -81,9 +86,12 @@
81 /* Macros: */ 86 /* Macros: */
82 /** Endpoint address of the Joystick HID reporting IN endpoint. */ 87 /** Endpoint address of the Joystick HID reporting IN endpoint. */
83 #define JOYSTICK_EPADDR (ENDPOINT_DIR_IN | 1) 88 #define JOYSTICK_EPADDR (ENDPOINT_DIR_IN | 1)
84 - 89 + #define LEDS_EPADDR (ENDPOINT_DIR_IN | 6)
  90 + #define VIBRATORS_EPADDR (ENDPOINT_DIR_IN | 7)
85 /** Size in bytes of the Joystick HID reporting IN endpoint. */ 91 /** Size in bytes of the Joystick HID reporting IN endpoint. */
86 #define JOYSTICK_EPSIZE 8 92 #define JOYSTICK_EPSIZE 8
  93 + #define LEDS_EPSIZE 2
  94 + #define VIBRATORS_EPSIZE 1
87 95
88 /* Function Prototypes: */ 96 /* Function Prototypes: */
89 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, 97 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c
@@ -171,8 +171,8 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn @@ -171,8 +171,8 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
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 - if (JoyStatus_LCL & BUTTONS_SEL)  
175 - { JoystickReport->Button |= ( 1<<1);} 174 + if (JoyStatus_LCL & BUTTONS_HAUT)
  175 + { JoystickReport->Button |= ( 1<<0);}
176 176
177 177
178 // if (JoyStatus_LCL & JOY_LEFT) 178 // if (JoyStatus_LCL & JOY_LEFT)