Commit 52ecdeed93eac3be255eae0fce82064f961a5a02

Authored by root
1 parent 569a7df7

Communication avec libusb OK!

Showing 1 changed file with 21 additions and 1 deletions   Show diff stats
src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c
... ... @@ -82,6 +82,24 @@ void POC_LEDS(){
82 82 }
83 83  
84 84  
  85 +void USB_LEDTask(void){
  86 + Endpoint_SelectEndpoint(LEDS_EPADDR);
  87 +
  88 + if(Endpoint_IsOUTReceived())
  89 + {
  90 + if(Endpoint_IsReadWriteAllowed())
  91 + {
  92 + uint16_t LEDReport = Endpoint_Read_16_LE();
  93 +
  94 + LEDs_SetAllLEDs(LEDReport);
  95 + }
  96 +
  97 + Endpoint_ClearOUT();
  98 + }
  99 +
  100 +}
  101 +
  102 +
85 103 int main(void)
86 104 {
87 105 SetupHardware();
... ... @@ -93,9 +111,9 @@ int main(void)
93 111  
94 112 for (;;)
95 113 {
96   - LEDs_SetAllLEDs(0xFF);
97 114 HID_Device_USBTask(&Joystick_HID_Interface);
98 115 USB_USBTask();
  116 + USB_LEDTask();
99 117 }
100 118 }
101 119  
... ... @@ -153,6 +171,8 @@ void EVENT_USB_Device_ConfigurationChanged(void)
153 171 bool ConfigSuccess = true;
154 172  
155 173 ConfigSuccess &= HID_Device_ConfigureEndpoints(&Joystick_HID_Interface);
  174 + ConfigSuccess &= Endpoint_ConfigureEndpoint(LEDS_EPADDR, EP_TYPE_INTERRUPT, LEDS_EPSIZE, 1);
  175 + ConfigSuccess &= Endpoint_ConfigureEndpoint(VIBRATORS_EPADDR, EP_TYPE_INTERRUPT, VIBRATORS_EPSIZE, 1);
156 176  
157 177 USB_Device_EnableSOFEvents();
158 178  
... ...