summaryrefslogtreecommitdiffstats
path: root/app/crypto.c
diff options
context:
space:
mode:
authorroot <root@lamia.panaceas.james.local>2016-08-20 14:04:59 +0100
committerroot <root@lamia.panaceas.james.local>2016-08-20 14:04:59 +0100
commitb063a2da3024a2e3175e1ba9b0a87cb6c7470765 (patch)
treef5c90c4119b091876a3f53acf4e581316eec4926 /app/crypto.c
parentbc832d6d342922a828aebb997d1d9c6626898487 (diff)
downloadcandlestick-b063a2da3024a2e3175e1ba9b0a87cb6c7470765.tar.gz
candlestick-b063a2da3024a2e3175e1ba9b0a87cb6c7470765.tar.bz2
candlestick-b063a2da3024a2e3175e1ba9b0a87cb6c7470765.zip
candlestick
Diffstat (limited to 'app/crypto.c')
-rw-r--r--app/crypto.c77
1 files changed, 0 insertions, 77 deletions
diff --git a/app/crypto.c b/app/crypto.c
deleted file mode 100644
index a725def..0000000
--- a/app/crypto.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "project.h"
-#include "../common/vendor_req.h"
-
-
-static int key_send_timer = 0;
-static int start_key_send = 0;
-
-int
-crypto_control (uint8_t request, uint16_t value, uint16_t index, void *buf,
- size_t len)
-{
- (void) index;
- (void) buf;
- (void) len;
-
-
- switch (request)
- {
-
- case VENDOR_REQ_KEYPRESS:
- send_ascii (value);
- return 1;
- case VENDOR_REQ_SET_KEY:
- state_init ();
- key_set (buf, len);
- return 1;
- case VENDOR_REQ_SEND_KEY:
-
- if (!value)
- start_key_send = 1;
- else
- key_send_timer = value;
- return 1;
- case VENDOR_REQ_CLEAR_KEY:
- key_wipe ();
- return 1;
- }
-
- return 0;
-}
-
-int
-vendor_control_request (usbd_device * usbd_dev, struct usb_setup_data *req,
- uint8_t ** buf, uint16_t * len,
- int (**complete) (usbd_device * usbd_dev,
- struct usb_setup_data * req))
-{
- (void) usbd_dev;
- (void) complete;
-
- if (req->bmRequestType !=
- (USB_REQ_TYPE_OUT | USB_REQ_TYPE_VENDOR | USB_REQ_TYPE_DEVICE))
- return 0;
-
- return crypto_control (req->bRequest, req->wValue, req->wIndex, *buf, *len);
-}
-
-void
-crypto_tick (void)
-{
- if (!key_send_timer)
- return;
- key_send_timer--;
-
- if (!key_send_timer)
- start_key_send = 1;
-}
-
-void
-crypto_poll (void)
-{
- if (start_key_send)
- {
- start_key_send = 0;
- key_send ();
- }
-}