]>
git.gir.st - tmk_keyboard.git/blob - usb_extra.c
1 #include <avr/interrupt.h>
5 int8_t usb_extra_send(uint8_t report_id
, uint8_t bits
)
7 uint8_t intr_state
, timeout
;
9 if (!usb_configured()) return -1;
12 UENUM
= EXTRA_ENDPOINT
;
13 timeout
= UDFNUML
+ 50;
15 // are we ready to transmit?
16 if (UEINTX
& (1<<RWAL
)) break;
18 // has the USB gone offline?
19 if (!usb_configured()) return -1;
20 // have we waited too long?
21 if (UDFNUML
== timeout
) return -1;
22 // get ready to try checking again
25 UENUM
= EXTRA_ENDPOINT
;
36 int8_t usb_extra_audio_send(uint8_t bits
)
38 return usb_extra_send(1, bits
);
41 int8_t usb_extra_system_send(uint8_t bits
)
43 return usb_extra_send(2, bits
);