From 6338c857758e82a51a2a780fbcc25e305c55c5e6 Mon Sep 17 00:00:00 2001 From: dahanzimin <353767514@qq.com> Date: Sat, 22 Feb 2025 12:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20MINI=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=A8=A1=E6=8B=9F=E9=94=AE=E7=9B=98=E6=8C=87?= =?UTF-8?q?=E7=A4=BA=E7=81=AF=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../micropython_esp32c2/origin/build/lib/mini_bot.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/boards/default_src/micropython_esp32c2/origin/build/lib/mini_bot.py b/boards/default_src/micropython_esp32c2/origin/build/lib/mini_bot.py index e4adeac6..1eceecd5 100644 --- a/boards/default_src/micropython_esp32c2/origin/build/lib/mini_bot.py +++ b/boards/default_src/micropython_esp32c2/origin/build/lib/mini_bot.py @@ -21,6 +21,7 @@ _BOT035_PGA = const(0x20) _BOT035_KB = const(0x1C) _BOT035_MS = const(0x20) _BOT035_STR = const(0x24) +_BOT035_STA = const(0x25) _FONT_W = const(5) _FONT_H = const(8) _LEDS_W = const(12) @@ -316,6 +317,10 @@ class BOT035(FrameBuffer): else: print("Warning: Please upgrade the coprocessor firmware to use this feature") + def hid_keyboard_state(self): + state = self._rreg(_BOT035_STA) + return bool(state & 0x10), bool(state & 0x20), bool(state & 0x40) + def hid_mouse(self, keys=0, move=(0, 0), wheel=0, release=True): if self._version: self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_MS, bytes([keys & 0x0F, move[0] & 0xFF, move[1] & 0xFF, wheel & 0xFF]))