summaryrefslogtreecommitdiffstats
path: root/app/consumer.c
diff options
context:
space:
mode:
authorroot <root@lamia.panaceas.james.local>2015-06-13 13:08:23 +0100
committerroot <root@lamia.panaceas.james.local>2015-06-13 13:08:23 +0100
commitcd568297a41e5a6f2e130de82c07b6b789d34f4b (patch)
treea8ac2021e11d8a33d178fa521bde323c819e4c8d /app/consumer.c
parent162fcd3f8d879615dc39181daea95ef6fcb83752 (diff)
downloadtims_keyboard-cd568297a41e5a6f2e130de82c07b6b789d34f4b.tar.gz
tims_keyboard-cd568297a41e5a6f2e130de82c07b6b789d34f4b.tar.bz2
tims_keyboard-cd568297a41e5a6f2e130de82c07b6b789d34f4b.zip
add usb wakeup support, all keys up on bad data, and resend for parity errors
Diffstat (limited to 'app/consumer.c')
-rw-r--r--app/consumer.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/consumer.c b/app/consumer.c
index 79d25bb..b1b6290 100644
--- a/app/consumer.c
+++ b/app/consumer.c
@@ -99,13 +99,15 @@ consumer_send (uint16_t keys)
/*Last byte is the power wakeup stuff that we don't yet support */
uint8_t buf[CONSUMER_EP_TXN_SIZE] = { keys & 0xff, keys >> 8 };
- usbd_ep_write_packet (usbd_dev, CONSUMER_EP, buf, sizeof (buf));
+ if (!usb_is_suspended)
+ usbd_ep_write_packet (usbd_dev, CONSUMER_EP, buf, sizeof (buf));
}
+static uint16_t keys;
+
void
consumer_dispatch (int bit, int updown)
{
- static uint16_t keys;
if (updown)
keys |= bit;
@@ -117,7 +119,14 @@ consumer_dispatch (int bit, int updown)
printf ("CNS> %02x %02x\r\n", keys & 0xff, keys >> 8);
#endif
- consumer_send (keys);
+ usb_wakeup_host();
+ consumer_send (keys);
+}
+void
+consumer_error (void)
+{
+ keys = 0;
+ consumer_send (keys);
}