aboutsummaryrefslogtreecommitdiff
path: root/protocol/lufa/lufa.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/lufa/lufa.c')
-rw-r--r--protocol/lufa/lufa.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c
index 09da96b2e..f485e24bf 100644
--- a/protocol/lufa/lufa.c
+++ b/protocol/lufa/lufa.c
@@ -50,7 +50,9 @@ static uint8_t keyboard_led_stats = 0;
50 50
51// TODO: impl Control Request GET_REPORT 51// TODO: impl Control Request GET_REPORT
52static report_keyboard_t keyboard_report_sent; 52static report_keyboard_t keyboard_report_sent;
53#ifdef MOUSE_ENABLE
53static report_mouse_t mouse_report_sent; 54static report_mouse_t mouse_report_sent;
55#endif
54 56
55/* Host driver */ 57/* Host driver */
56static uint8_t keyboard_leds(void); 58static uint8_t keyboard_leds(void);
@@ -171,19 +173,23 @@ void EVENT_USB_Device_ConfigurationChanged(void)
171 ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, 173 ConfigSuccess &= Endpoint_ConfigureEndpoint(KEYBOARD_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
172 KEYBOARD_EPSIZE, ENDPOINT_BANK_SINGLE); 174 KEYBOARD_EPSIZE, ENDPOINT_BANK_SINGLE);
173 175
176#ifdef MOUSE_ENABLE
174 /* Setup Mouse HID Report Endpoint */ 177 /* Setup Mouse HID Report Endpoint */
175 ConfigSuccess &= Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, 178 ConfigSuccess &= Endpoint_ConfigureEndpoint(MOUSE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
176 MOUSE_EPSIZE, ENDPOINT_BANK_SINGLE); 179 MOUSE_EPSIZE, ENDPOINT_BANK_SINGLE);
180#endif
181
182#ifdef EXTRAKEY_ENABLE
183 /* Setup Extra HID Report Endpoint */
184 ConfigSuccess &= Endpoint_ConfigureEndpoint(EXTRA_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
185 EXTRA_EPSIZE, ENDPOINT_BANK_SINGLE);
186#endif
177 187
178 /* Setup Console HID Report Endpoints */ 188 /* Setup Console HID Report Endpoints */
179 ConfigSuccess &= Endpoint_ConfigureEndpoint(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN, 189 ConfigSuccess &= Endpoint_ConfigureEndpoint(CONSOLE_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
180 CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); 190 CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
181 ConfigSuccess &= Endpoint_ConfigureEndpoint(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT, 191 ConfigSuccess &= Endpoint_ConfigureEndpoint(CONSOLE_OUT_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_OUT,
182 CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE); 192 CONSOLE_EPSIZE, ENDPOINT_BANK_SINGLE);
183
184 /* Setup Extra HID Report Endpoint */
185 ConfigSuccess &= Endpoint_ConfigureEndpoint(EXTRA_IN_EPNUM, EP_TYPE_INTERRUPT, ENDPOINT_DIR_IN,
186 EXTRA_EPSIZE, ENDPOINT_BANK_SINGLE);
187} 193}
188 194
189/* 195/*
@@ -222,15 +228,19 @@ void EVENT_USB_Device_ControlRequest(void)
222 ReportData = (uint8_t*)&keyboard_report_sent; 228 ReportData = (uint8_t*)&keyboard_report_sent;
223 ReportSize = sizeof(keyboard_report_sent); 229 ReportSize = sizeof(keyboard_report_sent);
224 break; 230 break;
231#ifdef MOUSE_ENABLE
225 case MOUSE_INTERFACE: 232 case MOUSE_INTERFACE:
226 // TODO: test/check 233 // TODO: test/check
227 ReportData = (uint8_t*)&mouse_report_sent; 234 ReportData = (uint8_t*)&mouse_report_sent;
228 ReportSize = sizeof(mouse_report_sent); 235 ReportSize = sizeof(mouse_report_sent);
229 break; 236 break;
230 case CONSOLE_INTERFACE: 237#endif
231 break; 238#ifdef EXTRAKEY_ENABLE
232 case EXTRA_INTERFACE: 239 case EXTRA_INTERFACE:
233 break; 240 break;
241#endif
242 case CONSOLE_INTERFACE:
243 break;
234 } 244 }
235 245
236 /* Write the report data to the control endpoint */ 246 /* Write the report data to the control endpoint */
@@ -258,12 +268,16 @@ void EVENT_USB_Device_ControlRequest(void)
258 /* Read in the LED report from the host */ 268 /* Read in the LED report from the host */
259 keyboard_led_stats = Endpoint_Read_8(); 269 keyboard_led_stats = Endpoint_Read_8();
260 break; 270 break;
271#ifdef MOUSE_ENABLE
261 case MOUSE_INTERFACE: 272 case MOUSE_INTERFACE:
262 break; 273 break;
263 case CONSOLE_INTERFACE: 274#endif
264 break; 275#ifdef EXTRAKEY_ENABLE
265 case EXTRA_INTERFACE: 276 case EXTRA_INTERFACE:
266 break; 277 break;
278#endif
279 case CONSOLE_INTERFACE:
280 break;
267 } 281 }
268 282
269 Endpoint_ClearOUT(); 283 Endpoint_ClearOUT();
@@ -302,6 +316,7 @@ static void send_keyboard(report_keyboard_t *report)
302 316
303static void send_mouse(report_mouse_t *report) 317static void send_mouse(report_mouse_t *report)
304{ 318{
319#ifdef MOUSE_ENABLE
305 /* Select the Mouse Report Endpoint */ 320 /* Select the Mouse Report Endpoint */
306 Endpoint_SelectEndpoint(MOUSE_IN_EPNUM); 321 Endpoint_SelectEndpoint(MOUSE_IN_EPNUM);
307 322
@@ -315,6 +330,7 @@ static void send_mouse(report_mouse_t *report)
315 Endpoint_ClearIN(); 330 Endpoint_ClearIN();
316 } 331 }
317 mouse_report_sent = *report; 332 mouse_report_sent = *report;
333#endif
318} 334}
319 335
320typedef struct { 336typedef struct {