forked from arti/vt1200
Distils public docs into reference/keyboard-mouse/PROTOCOL.md for the level-1 Keyboard (27) / Mouse (26) device tests: - keyboard: 4800 8N1 RS-423, self-test via FD -> 01 00 00 00 (errors 3D/3E) - mouse: 4800 8O1 RS-232, self-test via 'T' -> 4-byte report (errors 3D/3E, >=0x20 fatal) - separate ports: DUART2 A=keyboard, B=mouse (NOT daisy-chained) MAME already has an LK201 device (src/mame/dec/lk201.cpp/.h) but no DEC mouse.
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
#ifndef CONFIG_H
|
|
#define CONFIG_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#define HID_REPORT_SIZE 8
|
|
#define HID_REPORT_FIRST_KEY 2
|
|
|
|
/* A node for the list of keys currently down */
|
|
struct key_down {
|
|
sys_dnode_t node;
|
|
/* LK201 keycode. */
|
|
int keycode;
|
|
/* Timestamp from k_uptime_get() when the key was first pressed. */
|
|
int64_t time;
|
|
/* True if the key has been held long enough to trigger auto-repeat. */
|
|
bool repeating;
|
|
/* False if the key hasn't been sent yet.
|
|
* This should only happen when the keyboard was locked. */
|
|
bool sent;
|
|
/* True if the host has disabled auto-repeat for this keypress via
|
|
* a Temporary Auto-Repeat Inhibit command. */
|
|
bool inhibit_auto_repeat;
|
|
};
|
|
|
|
enum event_source {
|
|
EVT_HOST, /* A message from the terminal. */
|
|
EVT_KEYBOARD, /* A HID report from the Bluetooth keyboard. */
|
|
EVT_METRONOME, /* The 1 ms auto-repeat timer has triggered. */
|
|
};
|
|
|
|
/* An event for the main thread's event queue. */
|
|
struct event {
|
|
enum event_source source;
|
|
/* Number of used bytes in buf. Always 0 for EVT_METRONOME. */
|
|
uint8_t size;
|
|
/* Message from host (EVT_HOST) or HID report (EVT_KEYBOARD). */
|
|
uint8_t buf[HID_REPORT_SIZE];
|
|
};
|
|
|
|
#endif /* CONFIG_H */
|