summaryrefslogtreecommitdiff
path: root/hid
diff options
context:
space:
mode:
Diffstat (limited to 'hid')
-rw-r--r--hid/pico/src/ph_outputs.h1
-rw-r--r--hid/pico/src/ph_ps2.c20
2 files changed, 15 insertions, 6 deletions
diff --git a/hid/pico/src/ph_outputs.h b/hid/pico/src/ph_outputs.h
index ce68ac30..d2487327 100644
--- a/hid/pico/src/ph_outputs.h
+++ b/hid/pico/src/ph_outputs.h
@@ -26,6 +26,7 @@
#include "ph_proto.h"
+#define PH_O_HAS_PS2 (!!(ph_g_outputs_avail & PH_PROTO_OUT2_HAS_PS2))
#define PH_O_KBD(x_id) ((ph_g_outputs_active & PH_PROTO_OUT1_KBD_MASK) == PH_PROTO_OUT1_KBD_##x_id)
#define PH_O_MOUSE(x_id) ((ph_g_outputs_active & PH_PROTO_OUT1_MOUSE_MASK) == PH_PROTO_OUT1_MOUSE_##x_id)
#define PH_O_IS_KBD_USB PH_O_KBD(USB)
diff --git a/hid/pico/src/ph_ps2.c b/hid/pico/src/ph_ps2.c
index d5bc9beb..ec74dc22 100644
--- a/hid/pico/src/ph_ps2.c
+++ b/hid/pico/src/ph_ps2.c
@@ -24,25 +24,33 @@
#include "ph_types.h"
#include "ph_outputs.h"
+
#include "hardware/gpio.h"
+
+#define _LS_POWER_PIN 13
+#define _KBD_DATA_PIN 11 // CLK == 12
+#define _MOUSE_DATA_PIN 14 // CLK == 15
+
+
u8 ph_g_ps2_kbd_leds = 0;
bool ph_g_ps2_kbd_online = 0;
bool ph_g_ps2_mouse_online = 0;
+
void ph_ps2_init(void) {
- if (PH_O_IS_KBD_PS2 || PH_O_IS_MOUSE_PS2) {
- gpio_init(13); // GPIO13=LV pull-up voltage
- gpio_set_dir(13, GPIO_OUT);
- gpio_put(13, 1);
+ if (PH_O_HAS_PS2) {
+ gpio_init(_LS_POWER_PIN);
+ gpio_set_dir(_LS_POWER_PIN, GPIO_OUT);
+ gpio_put(_LS_POWER_PIN, true);
}
if (PH_O_IS_KBD_PS2) {
- ph_ps2_kbd_init(11); // keyboard: GPIO11=data, GPIO12=clock
+ ph_ps2_kbd_init(_KBD_DATA_PIN);
}
if (PH_O_IS_MOUSE_PS2) {
- ph_ps2_mouse_init(14); // mouse: GPIO14=data, GPIO15=clock
+ ph_ps2_mouse_init(_MOUSE_DATA_PIN);
}
}