mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 17:11:52 +08:00
multihid firmware
This commit is contained in:
@@ -27,24 +27,20 @@
|
||||
|
||||
#include "keymap.h"
|
||||
|
||||
// #define PS2_KBD_CLOCK_PIN 7
|
||||
// #define PS2_KBD_DATA_PIN 5
|
||||
// #define HID_PS2_KBD_CLOCK_PIN 7
|
||||
// #define HID_PS2_KBD_DATA_PIN 5
|
||||
|
||||
|
||||
class Ps2HidKeyboard {
|
||||
class Ps2Keyboard {
|
||||
// https://wiki.osdev.org/PS/2_Keyboard
|
||||
|
||||
public:
|
||||
Ps2HidKeyboard() : _dev(PS2_KBD_CLOCK_PIN, PS2_KBD_DATA_PIN) {}
|
||||
Ps2Keyboard() : _dev(HID_PS2_KBD_CLOCK_PIN, HID_PS2_KBD_DATA_PIN) {}
|
||||
|
||||
void begin() {
|
||||
_dev.keyboard_init();
|
||||
}
|
||||
|
||||
bool isOnline() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void periodic() {
|
||||
_dev.keyboard_handle(&_leds);
|
||||
}
|
||||
@@ -57,7 +53,7 @@ class Ps2HidKeyboard {
|
||||
if (ps2_type != PS2_KEY_TYPE_UNKNOWN) {
|
||||
// Не отправлялась часть нажатий. Когда clock на нуле, комп не принимает ничего от клавы.
|
||||
// Этот костыль понижает процент пропущенных нажатий.
|
||||
while (digitalRead(PS2_KBD_CLOCK_PIN) == 0) {};
|
||||
while (digitalRead(HID_PS2_KBD_CLOCK_PIN) == 0) {};
|
||||
if (state) {
|
||||
switch (ps2_type) {
|
||||
case PS2_KEY_TYPE_REG: _dev.keyboard_press(ps2_code); break;
|
||||
@@ -78,6 +74,10 @@ class Ps2HidKeyboard {
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t getOfflineAs(uint8_t offline) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t getLedsAs(uint8_t caps, uint8_t scroll, uint8_t num) {
|
||||
uint8_t result = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user