]> git.gir.st - tmk_keyboard.git/blob - usb_keyboard_debug.h
delete unused KEY_* definitions.
[tmk_keyboard.git] / usb_keyboard_debug.h
1 #ifndef usb_serial_h__
2 #define usb_serial_h__
3
4 #include <stdint.h>
5
6 void usb_init(void); // initialize everything
7 uint8_t usb_configured(void); // is the USB port configured
8
9 int8_t usb_keyboard_press(uint8_t key, uint8_t modifier);
10 int8_t usb_keyboard_send(void);
11 extern uint8_t keyboard_modifier_keys;
12 extern uint8_t keyboard_keys[6];
13 extern volatile uint8_t keyboard_leds;
14
15 int8_t usb_debug_putchar(uint8_t c); // transmit a character
16 void usb_debug_flush_output(void); // immediately transmit any buffered output
17 #define USB_DEBUG_HID
18
19
20
21
22 // Everything below this point is only intended for usb_serial.c
23 #ifdef USB_SERIAL_PRIVATE_INCLUDE
24 #include <avr/io.h>
25 #include <avr/pgmspace.h>
26 #include <avr/interrupt.h>
27
28 #define EP_TYPE_CONTROL 0x00
29 #define EP_TYPE_BULK_IN 0x81
30 #define EP_TYPE_BULK_OUT 0x80
31 #define EP_TYPE_INTERRUPT_IN 0xC1
32 #define EP_TYPE_INTERRUPT_OUT 0xC0
33 #define EP_TYPE_ISOCHRONOUS_IN 0x41
34 #define EP_TYPE_ISOCHRONOUS_OUT 0x40
35
36 #define EP_SINGLE_BUFFER 0x02
37 #define EP_DOUBLE_BUFFER 0x06
38
39 #define EP_SIZE(s) ((s) == 64 ? 0x30 : \
40 ((s) == 32 ? 0x20 : \
41 ((s) == 16 ? 0x10 : \
42 0x00)))
43
44 #define MAX_ENDPOINT 4
45
46 #define LSB(n) (n & 255)
47 #define MSB(n) ((n >> 8) & 255)
48
49 #if defined(__AVR_AT90USB162__)
50 #define HW_CONFIG()
51 #define PLL_CONFIG() (PLLCSR = ((1<<PLLE)|(1<<PLLP0)))
52 #define USB_CONFIG() (USBCON = (1<<USBE))
53 #define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK)))
54 #elif defined(__AVR_ATmega32U4__)
55 #define HW_CONFIG() (UHWCON = 0x01)
56 #define PLL_CONFIG() (PLLCSR = 0x12)
57 #define USB_CONFIG() (USBCON = ((1<<USBE)|(1<<OTGPADE)))
58 #define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK)))
59 #elif defined(__AVR_AT90USB646__)
60 #define HW_CONFIG() (UHWCON = 0x81)
61 #define PLL_CONFIG() (PLLCSR = 0x1A)
62 #define USB_CONFIG() (USBCON = ((1<<USBE)|(1<<OTGPADE)))
63 #define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK)))
64 #elif defined(__AVR_AT90USB1286__)
65 #define HW_CONFIG() (UHWCON = 0x81)
66 #define PLL_CONFIG() (PLLCSR = 0x16)
67 #define USB_CONFIG() (USBCON = ((1<<USBE)|(1<<OTGPADE)))
68 #define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK)))
69 #endif
70
71 // standard control endpoint request types
72 #define GET_STATUS 0
73 #define CLEAR_FEATURE 1
74 #define SET_FEATURE 3
75 #define SET_ADDRESS 5
76 #define GET_DESCRIPTOR 6
77 #define GET_CONFIGURATION 8
78 #define SET_CONFIGURATION 9
79 #define GET_INTERFACE 10
80 #define SET_INTERFACE 11
81 // HID (human interface device)
82 #define HID_GET_REPORT 1
83 #define HID_GET_IDLE 2
84 #define HID_GET_PROTOCOL 3
85 #define HID_SET_REPORT 9
86 #define HID_SET_IDLE 10
87 #define HID_SET_PROTOCOL 11
88 // CDC (communication class device)
89 #define CDC_SET_LINE_CODING 0x20
90 #define CDC_GET_LINE_CODING 0x21
91 #define CDC_SET_CONTROL_LINE_STATE 0x22
92 #endif
93 #endif
Imprint / Impressum