You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

adb_blargg.h 1.1KB

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