summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-07-27 03:01:36 +0300
committerMaxim Devaev <[email protected]>2024-07-27 03:01:36 +0300
commit8a46fe5038fcd2c9e04e0d18fb554257e29ba392 (patch)
treee57bff98d8e8034be5c36e85f029250c984dcc3c
parente636914943971e5008edd7d17ebce106c3a61ff1 (diff)
parent8ef1545729298159769e5804feb50ededc5487ea (diff)
Merge branch 'ps2-ng'
-rw-r--r--hid/pico/Makefile2
-rw-r--r--hid/pico/src/CMakeLists.txt7
-rw-r--r--hid/pico/src/ph_ps2.c26
-rw-r--r--hid/pico/src/ph_ps2.h6
4 files changed, 23 insertions, 18 deletions
diff --git a/hid/pico/Makefile b/hid/pico/Makefile
index b335228b..42002cb0 100644
--- a/hid/pico/Makefile
+++ b/hid/pico/Makefile
@@ -31,7 +31,7 @@ endef
.tinyusb:
$(call libdep,tinyusb,hathach/tinyusb,d713571cd44f05d2fc72efc09c670787b74106e0)
.ps2x2pico:
- $(call libdep,ps2x2pico,No0ne/ps2x2pico,b90814df40ebbc0f42c2886b4bd17b20a177a4da)
+ $(call libdep,ps2x2pico,No0ne/ps2x2pico,27c9bcede3370f0d4fdefea9c86a0eeb6170cf77)
deps: .pico-sdk .tinyusb .ps2x2pico
diff --git a/hid/pico/src/CMakeLists.txt b/hid/pico/src/CMakeLists.txt
index 904e7b7f..7eeffa18 100644
--- a/hid/pico/src/CMakeLists.txt
+++ b/hid/pico/src/CMakeLists.txt
@@ -15,15 +15,18 @@ target_sources(${target_name} PRIVATE
ph_com_uart.c
ph_debug.c
- ${PS2_PATH}/ps2phy.c
+ ${PS2_PATH}/ps2out.c
+ ${PS2_PATH}/ps2in.c
${PS2_PATH}/ps2kb.c
${PS2_PATH}/ps2ms.c
+ ${PS2_PATH}/scancodesets.c
)
target_link_options(${target_name} PRIVATE -Xlinker --print-memory-usage)
target_compile_options(${target_name} PRIVATE -Wall -Wextra)
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
pico_stdlib
diff --git a/hid/pico/src/ph_ps2.c b/hid/pico/src/ph_ps2.c
index 5eb07174..c4499f13 100644
--- a/hid/pico/src/ph_ps2.c
+++ b/hid/pico/src/ph_ps2.c
@@ -32,6 +32,8 @@
#define _KBD_DATA_PIN 11 // CLK == 12
#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;
bool ph_g_ps2_kbd_online = 0;
@@ -57,13 +59,13 @@ void ph_ps2_init(void) {
}
if (PH_O_IS_KBD_PS2) {
- kb_init(_KBD_DATA_PIN);
+ kb_init(_KBD_DATA_PIN, _KBD_IN_DATA_PIN);
} else {
INIT_STUB(_KBD_DATA_PIN);
}
if (PH_O_IS_MOUSE_PS2) {
- ms_init(_MOUSE_DATA_PIN);
+ ms_init(_MOUSE_DATA_PIN, _MOUSE_IN_DATA_PIN);
} else {
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);
}
- 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) {
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) {
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) {
if (PH_O_IS_KBD_PS2) {
- for(u8 key = 0xe0; key <= 0xe7; key++) {
- kb_send_key(key, false, 0);
- }
+ //for(u8 key = 0xe0; key <= 0xe7; key++) {
+ // kb_send_key(key, false, 0);
+ //}
- for(u8 key = 4; key <= 116; key++) {
- kb_send_key(key, false, 0);
- }
+ //for(u8 key = 4; key <= 116; key++) {
+ // kb_send_key(key, false, 0);
+ //}
}
if (PH_O_IS_MOUSE_PS2) {
- ms_send_packet(0, 0, 0, 0, 0);
+ ms_send_movement(0, 0, 0, 0);
}
}
diff --git a/hid/pico/src/ph_ps2.h b/hid/pico/src/ph_ps2.h
index 62fee109..69f55866 100644
--- a/hid/pico/src/ph_ps2.h
+++ b/hid/pico/src/ph_ps2.h
@@ -34,14 +34,14 @@ void ph_ps2_init(void);
void ph_ps2_task(void);
void tuh_kb_set_leds(u8 leds);
-void kb_init(u8 gpio);
+void kb_init(u8 gpio_out, u8 gpio_in);
bool kb_task();
void kb_send_key(u8 key, bool state, u8 modifiers);
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();
-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_rel(s8 x, s8 y);
void ph_ps2_mouse_send_wheel(s8 h, s8 v);