|
|
@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#include "host_driver.h"
|
|
|
|
#include "host_driver.h"
|
|
|
|
#include "vusb.h"
|
|
|
|
#include "vusb.h"
|
|
|
|
#include "bootloader.h"
|
|
|
|
#include "bootloader.h"
|
|
|
|
|
|
|
|
#include <util/delay.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static uint8_t vusb_keyboard_leds = 0;
|
|
|
|
static uint8_t vusb_keyboard_leds = 0;
|
|
|
@ -46,9 +47,12 @@ typedef struct {
|
|
|
|
|
|
|
|
|
|
|
|
static keyboard_report_t keyboard_report; // sent to PC
|
|
|
|
static keyboard_report_t keyboard_report; // sent to PC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define VUSB_TRANSFER_KEYBOARD_MAX_TRIES 10
|
|
|
|
|
|
|
|
|
|
|
|
/* transfer keyboard report from buffer */
|
|
|
|
/* transfer keyboard report from buffer */
|
|
|
|
void vusb_transfer_keyboard(void)
|
|
|
|
void vusb_transfer_keyboard(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
for (int i = 0; i < VUSB_TRANSFER_KEYBOARD_MAX_TRIES; i++) {
|
|
|
|
if (usbInterruptIsReady()) {
|
|
|
|
if (usbInterruptIsReady()) {
|
|
|
|
if (kbuf_head != kbuf_tail) {
|
|
|
|
if (kbuf_head != kbuf_tail) {
|
|
|
|
usbSetInterrupt((void *)&kbuf[kbuf_tail], sizeof(report_keyboard_t));
|
|
|
|
usbSetInterrupt((void *)&kbuf[kbuf_tail], sizeof(report_keyboard_t));
|
|
|
@ -59,9 +63,10 @@ void vusb_transfer_keyboard(void)
|
|
|
|
print(")\n");
|
|
|
|
print(")\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
usbPoll();
|
|
|
|
usbPoll();
|
|
|
|
vusb_transfer_keyboard();
|
|
|
|
_delay_ms(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|