123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- #ifndef _USB_MAIN_H_
- #define _USB_MAIN_H_
- #include "ch.h"
- #include "hal.h"
- #define USB_DRIVER USBD1
- void init_usb_driver(USBDriver *usbp);
- void send_remote_wakeup(USBDriver *usbp);
- #define KBD_INTERFACE 0
- #define KBD_ENDPOINT 1
- #define KBD_EPSIZE 8
- #define KBD_REPORT_KEYS (KBD_EPSIZE - 2)
- #ifdef NKRO_ENABLE
- #define NKRO_INTERFACE 4
- #define NKRO_ENDPOINT 5
- #define NKRO_EPSIZE 16
- #define NKRO_REPORT_KEYS (NKRO_EPSIZE - 1)
- #endif
- void kbd_in_cb(USBDriver *usbp, usbep_t ep);
- void kbd_sof_cb(USBDriver *usbp);
- #ifdef NKRO_ENABLE
- void nkro_in_cb(USBDriver *usbp, usbep_t ep);
- #endif
- #ifdef MOUSE_ENABLE
- #define MOUSE_INTERFACE 1
- #define MOUSE_ENDPOINT 2
- #define MOUSE_EPSIZE 8
- void mouse_in_cb(USBDriver *usbp, usbep_t ep);
- #endif
- #ifdef EXTRAKEY_ENABLE
- #define EXTRA_INTERFACE 3
- #define EXTRA_ENDPOINT 4
- #define EXTRA_EPSIZE 8
- void extra_in_cb(USBDriver *usbp, usbep_t ep);
- typedef struct {
- uint8_t report_id;
- uint16_t usage;
- } __attribute__ ((packed)) report_extra_t;
- #endif
- #ifdef CONSOLE_ENABLE
- #define CONSOLE_INTERFACE 2
- #define CONSOLE_ENDPOINT 3
- #define CONSOLE_EPSIZE 16
- #define CONSOLE_QUEUE_CAPACITY 4
- #define CONSOLE_FLUSH_MS 50
- int8_t sendchar(uint8_t c);
- void console_flush_output(void);
- void console_in_cb(USBDriver *usbp, usbep_t ep);
- #endif
- void sendchar_pf(void *p, char c);
- #endif
|