You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/doc/en/peripheral/hid.md
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Note: Since only 4 USB devices are supported, only 4 devices can be started at t
20
20
21
21
You need to enable `HID Keyboard` to run it.
22
22
23
-
The following example sends `rstuv` four characters through the keyboard and then releases the key.
23
+
The following example sends keyboard event to pc.
24
24
25
25
```python
26
26
from maix import hid, time
@@ -35,6 +35,14 @@ for key in keys:
35
35
36
36
```
37
37
38
+
After creating the `hid` object, key events can be sent using the `write` method. A key event is represented by an 8-byte array, where:
39
+
-**Byte 1**: Indicates the status of modifier keys like `ctrl`, `shift`, `alt`, etc. Each bit represents a specific modifier key:`bit0: left ctrl`,`bit1: left shift`,`bit2: left alt`,`bit3: left GUI (e.g., Windows key)`,`bit4: right ctrl`,`bit5: right shift`,`bit6: right alt`,`bit7: right GUI`
40
+
-**Byte 2**: Reserved byte.
41
+
-**Byte 3**: Primary key value. A value of 0 means the key is released. Key codes are referenced from the "Universal Serial Bus HID Usage Tables" section of the [USB HID documentation](https://www.usb.org).
42
+
-**Bytes 4~8**: Additional keys, used to press multiple keys at once. A value of 0 means the key is released.
43
+
44
+
For specific usage, refer to the example code above.
0 commit comments