mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
Merge branch 'ps2-ng'
This commit is contained in:
@@ -31,7 +31,7 @@ endef
|
|||||||
.tinyusb:
|
.tinyusb:
|
||||||
$(call libdep,tinyusb,hathach/tinyusb,d713571cd44f05d2fc72efc09c670787b74106e0)
|
$(call libdep,tinyusb,hathach/tinyusb,d713571cd44f05d2fc72efc09c670787b74106e0)
|
||||||
.ps2x2pico:
|
.ps2x2pico:
|
||||||
$(call libdep,ps2x2pico,No0ne/ps2x2pico,b90814df40ebbc0f42c2886b4bd17b20a177a4da)
|
$(call libdep,ps2x2pico,No0ne/ps2x2pico,27c9bcede3370f0d4fdefea9c86a0eeb6170cf77)
|
||||||
deps: .pico-sdk .tinyusb .ps2x2pico
|
deps: .pico-sdk .tinyusb .ps2x2pico
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,18 @@ target_sources(${target_name} PRIVATE
|
|||||||
ph_com_uart.c
|
ph_com_uart.c
|
||||||
ph_debug.c
|
ph_debug.c
|
||||||
|
|
||||||
${PS2_PATH}/ps2phy.c
|
${PS2_PATH}/ps2out.c
|
||||||
|
${PS2_PATH}/ps2in.c
|
||||||
${PS2_PATH}/ps2kb.c
|
${PS2_PATH}/ps2kb.c
|
||||||
${PS2_PATH}/ps2ms.c
|
${PS2_PATH}/ps2ms.c
|
||||||
|
${PS2_PATH}/scancodesets.c
|
||||||
)
|
)
|
||||||
target_link_options(${target_name} PRIVATE -Xlinker --print-memory-usage)
|
target_link_options(${target_name} PRIVATE -Xlinker --print-memory-usage)
|
||||||
target_compile_options(${target_name} PRIVATE -Wall -Wextra)
|
target_compile_options(${target_name} PRIVATE -Wall -Wextra)
|
||||||
target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${PS2_PATH})
|
target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR} ${PS2_PATH})
|
||||||
|
|
||||||
pico_generate_pio_header(${target_name} ${PS2_PATH}/ps2phy.pio)
|
pico_generate_pio_header(${target_name} ${PS2_PATH}/ps2out.pio)
|
||||||
|
pico_generate_pio_header(${target_name} ${PS2_PATH}/ps2in.pio)
|
||||||
|
|
||||||
target_link_libraries(${target_name} PRIVATE
|
target_link_libraries(${target_name} PRIVATE
|
||||||
pico_stdlib
|
pico_stdlib
|
||||||
|
|||||||
@@ -32,6 +32,8 @@
|
|||||||
#define _KBD_DATA_PIN 11 // CLK == 12
|
#define _KBD_DATA_PIN 11 // CLK == 12
|
||||||
#define _MOUSE_DATA_PIN 14 // CLK == 15
|
#define _MOUSE_DATA_PIN 14 // CLK == 15
|
||||||
|
|
||||||
|
#define _KBD_IN_DATA_PIN 26 // passthru, CLK == 27
|
||||||
|
#define _MOUSE_IN_DATA_PIN 16 // passthru, CLK == 17
|
||||||
|
|
||||||
u8 ph_g_ps2_kbd_leds = 0;
|
u8 ph_g_ps2_kbd_leds = 0;
|
||||||
bool ph_g_ps2_kbd_online = 0;
|
bool ph_g_ps2_kbd_online = 0;
|
||||||
@@ -57,13 +59,13 @@ void ph_ps2_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PH_O_IS_KBD_PS2) {
|
if (PH_O_IS_KBD_PS2) {
|
||||||
kb_init(_KBD_DATA_PIN);
|
kb_init(_KBD_DATA_PIN, _KBD_IN_DATA_PIN);
|
||||||
} else {
|
} else {
|
||||||
INIT_STUB(_KBD_DATA_PIN);
|
INIT_STUB(_KBD_DATA_PIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PH_O_IS_MOUSE_PS2) {
|
if (PH_O_IS_MOUSE_PS2) {
|
||||||
ms_init(_MOUSE_DATA_PIN);
|
ms_init(_MOUSE_DATA_PIN, _MOUSE_IN_DATA_PIN);
|
||||||
} else {
|
} else {
|
||||||
INIT_STUB(_MOUSE_DATA_PIN);
|
INIT_STUB(_MOUSE_DATA_PIN);
|
||||||
}
|
}
|
||||||
@@ -105,34 +107,34 @@ void ph_ps2_mouse_send_button(u8 button, bool state) {
|
|||||||
ph_ps2_mouse_buttons = ph_ps2_mouse_buttons & ~(1 << button);
|
ph_ps2_mouse_buttons = ph_ps2_mouse_buttons & ~(1 << button);
|
||||||
}
|
}
|
||||||
|
|
||||||
ms_send_packet(ph_ps2_mouse_buttons, 0, 0, 0, 0);
|
ms_send_movement(ph_ps2_mouse_buttons, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ph_ps2_mouse_send_rel(s8 x, s8 y) {
|
void ph_ps2_mouse_send_rel(s8 x, s8 y) {
|
||||||
if (PH_O_IS_MOUSE_PS2) {
|
if (PH_O_IS_MOUSE_PS2) {
|
||||||
ms_send_packet(ph_ps2_mouse_buttons, x, y, 0, 0);
|
ms_send_movement(ph_ps2_mouse_buttons, x, y, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ph_ps2_mouse_send_wheel(s8 h, s8 v) {
|
void ph_ps2_mouse_send_wheel(s8 h, s8 v) {
|
||||||
if (PH_O_IS_MOUSE_PS2) {
|
if (PH_O_IS_MOUSE_PS2) {
|
||||||
ms_send_packet(ph_ps2_mouse_buttons, 0, 0, h, v);
|
ms_send_movement(ph_ps2_mouse_buttons, 0, 0, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ph_ps2_send_clear(void) {
|
void ph_ps2_send_clear(void) {
|
||||||
if (PH_O_IS_KBD_PS2) {
|
if (PH_O_IS_KBD_PS2) {
|
||||||
for(u8 key = 0xe0; key <= 0xe7; key++) {
|
//for(u8 key = 0xe0; key <= 0xe7; key++) {
|
||||||
kb_send_key(key, false, 0);
|
// kb_send_key(key, false, 0);
|
||||||
}
|
//}
|
||||||
|
|
||||||
for(u8 key = 4; key <= 116; key++) {
|
//for(u8 key = 4; key <= 116; key++) {
|
||||||
kb_send_key(key, false, 0);
|
// kb_send_key(key, false, 0);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PH_O_IS_MOUSE_PS2) {
|
if (PH_O_IS_MOUSE_PS2) {
|
||||||
ms_send_packet(0, 0, 0, 0, 0);
|
ms_send_movement(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ void ph_ps2_init(void);
|
|||||||
void ph_ps2_task(void);
|
void ph_ps2_task(void);
|
||||||
|
|
||||||
void tuh_kb_set_leds(u8 leds);
|
void tuh_kb_set_leds(u8 leds);
|
||||||
void kb_init(u8 gpio);
|
void kb_init(u8 gpio_out, u8 gpio_in);
|
||||||
bool kb_task();
|
bool kb_task();
|
||||||
void kb_send_key(u8 key, bool state, u8 modifiers);
|
void kb_send_key(u8 key, bool state, u8 modifiers);
|
||||||
void ph_ps2_kbd_send_key(u8 key, bool state);
|
void ph_ps2_kbd_send_key(u8 key, bool state);
|
||||||
|
|
||||||
void ms_init(u8 gpio);
|
void ms_init(u8 gpio_out, u8 gpio_in);
|
||||||
bool ms_task();
|
bool ms_task();
|
||||||
void ms_send_packet(u8 buttons, s8 x, s8 y, s8 h, s8 v);
|
void ms_send_movement(u8 buttons, s8 x, s8 y, s8 z);
|
||||||
void ph_ps2_mouse_send_button(u8 button, bool state);
|
void ph_ps2_mouse_send_button(u8 button, bool state);
|
||||||
void ph_ps2_mouse_send_rel(s8 x, s8 y);
|
void ph_ps2_mouse_send_rel(s8 x, s8 y);
|
||||||
void ph_ps2_mouse_send_wheel(s8 h, s8 v);
|
void ph_ps2_mouse_send_wheel(s8 h, s8 v);
|
||||||
|
|||||||
Reference in New Issue
Block a user