maix::peripheral::hid
maix.peripheral.hid module
This is
maix::peripheral::hid
module of MaixCDK.
All of these elements are in namespacemaix::peripheral::hid
.For MaixCDK developer: DO NOT edit this doc file manually, this doc is auto generated!
Module
No module
Enum
DeviceType
Device enum of hid
item | describe |
---|---|
values | DEVICE_MOUSE: DEVICE_KEYBOARD: DEVICE_TOUCHPAD: |
C++ defination code:
enum DeviceType { DEVICE_MOUSE = 0, DEVICE_KEYBOARD, DEVICE_TOUCHPAD }
Variable
Function
Class
Hid
Hid class
C++ defination code:
class Hid
__init__
Hid Device constructor
item | description |
---|---|
type | func |
param | device_type: Device type, used to select mouse, keyboard, or touchpad. open: auto open device in constructor, if false, you need call open() to open device |
static | False |
C++ defination code:
Hid(hid::DeviceType device_type, bool open = true)
open
Open hid device
item | description |
---|---|
type | func |
return | err::Err |
static | False |
C++ defination code:
err::Err open()
close
Close hid device
item | description |
---|---|
type | func |
return | err::Err |
static | False |
C++ defination code:
err::Err close()
write
Write data to hid device
item | description |
---|---|
type | func |
param | data: data to write For the keyboard, 8 bytes of data need to be written, with the format as follows: data = [0x00, # 0x00, # 0x00, # Key value. Refer to the "Universal Serial Bus HID Usage Tables" section of the official documentation(https://www.usb.org). 0x00, # 0x00, # 0x00, # 0x00, # 0x00] # For the mouse, 4 bytes of data need to be written, with the format as follows: data = [0x00, # Button state 0x00: no button pressed 0x01: press left button 0x02: press right button 0x04: press middle button x, # X-axis relative coordinates. Signed number, positive values for x indicate movement to the right y, # Y-axis relative coordinates. Signed number, positive values for y indicate movement downward 0x00] # Wheel movement. Signed number, positive values indicate downward movement. For the touchpad, 6 bytes of data need to be written, with the format as follows: data = [0x00, # Button state (0: no button pressed, 0x01: press left button, 0x10, press right button.) x & 0xFF, (x >> 8) & 0xFF, # X-axis absolute coordinate, 0 means unused. Note: You must map the target position to the range [0x1, 0x7FFF]. This means x value = <position_to_move> * 0x7FFF / <actual_screen_width> y & 0xFF, (y >> 8) & 0xFF, # Y-axis absolute coordinate, 0 means unused. Note: You must map the target position to the range [0x1, 0x7FFF]. This means y value = <position_to_move> * 0x7FFF / <actual_screen_height> 0x00, # Wheel movement. Signed number, positive values indicate downward movement. |
return | err::Err |
static | False |
C++ defination code:
err::Err write(std::vector<int> &data)
is_opened
Check if hid device is opened
item | description |
---|---|
type | func |
return | bool |
static | False |
C++ defination code:
bool is_opened()