#ifdef SERIAL_MOUSE_ENABLE | #ifdef SERIAL_MOUSE_ENABLE | ||||
#include "serial_mouse.h" | #include "serial_mouse.h" | ||||
#endif | #endif | ||||
#ifdef ADB_MOUSE_ENABLE | |||||
#include "adb.h" | |||||
#endif | |||||
#ifdef MATRIX_HAS_GHOST | #ifdef MATRIX_HAS_GHOST | ||||
#ifdef SERIAL_MOUSE_ENABLE | #ifdef SERIAL_MOUSE_ENABLE | ||||
serial_mouse_init(); | serial_mouse_init(); | ||||
#endif | #endif | ||||
#ifdef ADB_MOUSE_ENABLE | |||||
adb_mouse_init(); | |||||
#endif | |||||
#ifdef BOOTMAGIC_ENABLE | #ifdef BOOTMAGIC_ENABLE | ||||
serial_mouse_task(); | serial_mouse_task(); | ||||
#endif | #endif | ||||
#ifdef ADB_MOUSE_ENABLE | |||||
adb_mouse_task(); | |||||
#endif | |||||
// update LED | // update LED | ||||
if (led_status != host_keyboard_leds()) { | if (led_status != host_keyboard_leds()) { | ||||
led_status = host_keyboard_leds(); | led_status = host_keyboard_leds(); |
SRC += $(PROTOCOL_DIR)/serial_uart.c | SRC += $(PROTOCOL_DIR)/serial_uart.c | ||||
endif | endif | ||||
ifdef ADB_MOUSE_ENABLE | |||||
OPT_DEFS += -DADB_MOUSE_ENABLE -DMOUSE_ENABLE | |||||
endif | |||||
# Search Path | # Search Path | ||||
VPATH += $(TMK_DIR)/protocol | VPATH += $(TMK_DIR)/protocol |
static inline void send_byte(uint8_t data); | static inline void send_byte(uint8_t data); | ||||
static inline uint16_t wait_data_lo(uint16_t us); | static inline uint16_t wait_data_lo(uint16_t us); | ||||
static inline uint16_t wait_data_hi(uint16_t us); | static inline uint16_t wait_data_hi(uint16_t us); | ||||
static inline uint16_t adb_host_dev_recv(uint8_t device); | |||||
void adb_host_init(void) | void adb_host_init(void) | ||||
// | // | ||||
// [from Apple IIgs Hardware Reference Second Edition] | // [from Apple IIgs Hardware Reference Second Edition] | ||||
enum { | |||||
ADDR_KEYB = 0x20, | |||||
ADDR_MOUSE = 0x30 | |||||
}; | |||||
uint16_t adb_host_kbd_recv(void) | uint16_t adb_host_kbd_recv(void) | ||||
{ | |||||
return adb_host_dev_recv(ADDR_KEYB); | |||||
} | |||||
#ifdef ADB_MOUSE_ENABLE | |||||
void adb_mouse_init(void) { | |||||
return; | |||||
} | |||||
uint16_t adb_host_mouse_recv(void) | |||||
{ | |||||
return adb_host_dev_recv(ADDR_MOUSE); | |||||
} | |||||
#endif | |||||
static inline uint16_t adb_host_dev_recv(uint8_t device) | |||||
{ | { | ||||
uint16_t data = 0; | uint16_t data = 0; | ||||
cli(); | cli(); | ||||
attention(); | attention(); | ||||
send_byte(0x2C); // Addr:Keyboard(0010), Cmd:Talk(11), Register0(00) | |||||
send_byte(device|0x0C); // Addr:Keyboard(0010)/Mouse(0011), Cmd:Talk(11), Register0(00) | |||||
place_bit0(); // Stopbit(0) | place_bit0(); // Stopbit(0) | ||||
if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored | if (!wait_data_hi(500)) { // Service Request(310us Adjustable Keyboard): just ignored | ||||
sei(); | sei(); |
void adb_host_init(void); | void adb_host_init(void); | ||||
bool adb_host_psw(void); | bool adb_host_psw(void); | ||||
uint16_t adb_host_kbd_recv(void); | uint16_t adb_host_kbd_recv(void); | ||||
uint16_t adb_host_mouse_recv(void); | |||||
void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); | void adb_host_listen(uint8_t cmd, uint8_t data_h, uint8_t data_l); | ||||
void adb_host_kbd_led(uint8_t led); | void adb_host_kbd_led(uint8_t led); | ||||
void adb_mouse_task(void); | |||||
void adb_mouse_init(void); | |||||
#endif | #endif |
SRC += $(PJRC_DIR)/usb_mouse.c | SRC += $(PJRC_DIR)/usb_mouse.c | ||||
endif | endif | ||||
ifdef ADB_MOUSE_ENABLE | |||||
SRC += $(PJRC_DIR)/usb_mouse.c | |||||
endif | |||||
ifdef PS2_MOUSE_ENABLE | ifdef PS2_MOUSE_ENABLE | ||||
SRC += $(PJRC_DIR)/usb_mouse.c | SRC += $(PJRC_DIR)/usb_mouse.c | ||||
endif | endif |