diff --git a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c index 048477e..9672656 100644 --- a/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c +++ b/src/lufa-LUFA-170418/PolytechLille/Manette/Manette.c @@ -82,6 +82,24 @@ void POC_LEDS(){ } +void USB_LEDTask(void){ + Endpoint_SelectEndpoint(LEDS_EPADDR); + + if(Endpoint_IsOUTReceived()) + { + if(Endpoint_IsReadWriteAllowed()) + { + uint16_t LEDReport = Endpoint_Read_16_LE(); + + LEDs_SetAllLEDs(LEDReport); + } + + Endpoint_ClearOUT(); + } + +} + + int main(void) { SetupHardware(); @@ -93,9 +111,9 @@ int main(void) for (;;) { - LEDs_SetAllLEDs(0xFF); HID_Device_USBTask(&Joystick_HID_Interface); USB_USBTask(); + USB_LEDTask(); } } @@ -153,6 +171,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) bool ConfigSuccess = true; ConfigSuccess &= HID_Device_ConfigureEndpoints(&Joystick_HID_Interface); + ConfigSuccess &= Endpoint_ConfigureEndpoint(LEDS_EPADDR, EP_TYPE_INTERRUPT, LEDS_EPSIZE, 1); + ConfigSuccess &= Endpoint_ConfigureEndpoint(VIBRATORS_EPADDR, EP_TYPE_INTERRUPT, VIBRATORS_EPSIZE, 1); USB_Device_EnableSOFEvents(); -- libgit2 0.21.2