]> git.gir.st - tmk_keyboard.git/blob - converter/adb_usb/adb_blargg.h
Add ADB protocol files from blargg's work
[tmk_keyboard.git] / converter / adb_usb / adb_blargg.h
1 // Basic support for ADB keyboard
2
3 #ifndef ADB_BLARGG_H
4 #define ADB_BLARGG_H
5
6 #include <stdint.h>
7 #include <stdbool.h>
8
9 // Sets up ADB bus. Doesn't send anything to keyboard.
10 void adb_host_init( void );
11
12 // Receives key press event from keyboard.
13 // 0xKKFF: one key changed state
14 // 0xKKKK: two keys changed state
15 enum { adb_host_nothing = 0 }; // no keys changed state
16 enum { adb_host_error = 0xFFFE }; // receive error
17 uint16_t adb_host_kbd_recv( void );
18
19 // Current state of keyboard modifiers and a few other keys
20 // Returns adb_host_nothing if keyboard didn't respond.
21 // Returns adb_host_error if error receiving.
22 uint16_t adb_host_kbd_modifiers( void );
23
24 // Sends command and two bytes of data to keyboard
25 void adb_host_listen( uint8_t cmd, uint8_t data_h, uint8_t data_l );
26
27 // Sets keyboard LEDs. Note that bits are inverted here, so 1 means off, 0 means on.
28 void adb_host_kbd_led( uint8_t led );
29
30 // State of power switch (false = pressed), or true if unsupported
31 bool adb_host_psw( void );
32
33
34 // Legacy support
35 #define ADB_POWER 0x7F
36 #define ADB_CAPS 0x39
37
38 #endif
Imprint / Impressum