mpython_ble.hidcode

HID设备(Human Interface Devices)键值常量定义

提示

如果你的可用内存不多,不建议你使用 hidcode 模块。你可按需,自行定义常量,减少不必要的内存浪费。

Mouse

鼠标常量

class Mouse
Mouse.LEFT = 1
Mouse.RIGHT = 2
Mouse.MIDDLE = 4

KeyboardCode

class KeyboardCode
KeyboardCode.A = 0x04

a and A

KeyboardCode.B = 0x05

b and B

KeyboardCode.C = 0x06

c and C

KeyboardCode.D = 0x07

d and D

KeyboardCode.E = 0x08

e and E

KeyboardCode.F = 0x09

f and F

KeyboardCode.G = 0x0A

g and G

KeyboardCode.H = 0x0B

h and H

KeyboardCode.I = 0x0C

i and I

KeyboardCode.J = 0x0D

j and J

KeyboardCode.K = 0x0E

k and K

KeyboardCode.L = 0x0F

l and L

KeyboardCode.M = 0x10

m and M

KeyboardCode.N = 0x11

n and N

KeyboardCode.O = 0x12

o and O

KeyboardCode.P = 0x13

p and P

KeyboardCode.Q = 0x14

q and Q

KeyboardCode.R = 0x15

r and R

KeyboardCode.S = 0x16

s and S

KeyboardCode.T = 0x17

t and T

KeyboardCode.U = 0x18

u and U

KeyboardCode.V = 0x19

v and V

KeyboardCode.W = 0x1A

w and W

KeyboardCode.S = 0x1B

x and X

KeyboardCode.Y = 0x1C

y and Y

KeyboardCode.Z = 0x1D

z and Z

KeyboardCode.ONE = 0x1E

1 and !

KeyboardCode.TWO = 0x1F

2 and @

KeyboardCode.THREE = 0x20

3 and #

KeyboardCode.FOUR = 0x21

4 and $

KeyboardCode.FIVE = 0x22

5 and %

KeyboardCode.SIX = 0x23

6 and ^

KeyboardCode.SEVEN = 0x24

7 and &

KeyboardCode.EIGHT = 0x25

8 and *

KeyboardCode.NINE = 0x26

9 and (

KeyboardCode.ZERO = 0x27

0 and )

KeyboardCode.ENTER = 0x28

Enter

KeyboardCode.ESCAPE = 0x29

Escape

KeyboardCode.BACKSPACE = 0x2A

Delete backward (Backspace)

KeyboardCode.TAB = 0x2B

Tab and Backtab

KeyboardCode.SPACE = 0x2C

Space

KeyboardCode.MINUS = 0x2D

-` and ``_

KeyboardCode.EQUALS = 0x2E

=` and ``+

KeyboardCode.LEFT_BRACKET = 0x2F

[ and {

KeyboardCode.RIGHT_BRACKET = 0x30

] and }

KeyboardCode.BACKSLASH = 0x31

\ and |

KeyboardCode.POUND = 0x32

# and ~

KeyboardCode.SEMICOLON = 0x33

; and :

KeyboardCode.QUOTE = 0x34

' and "

KeyboardCode.GRAVE_ACCENT = 0x35

` and ~

KeyboardCode.COMMA = 0x36

, and <

KeyboardCode.PERIOD = 0x37

. and >

KeyboardCode.FORWARD_SLASH = 0x38

/ and ?

KeyboardCode.CAPS_LOCK = 0x39

Caps Lock

KeyboardCode.F1 = 0x3A

Function key F1

KeyboardCode.F2 = 0x3B

Function key F2

KeyboardCode.F3 = 0x3C

Function key F3

KeyboardCode.F4 = 0x3D

Function key F4

KeyboardCode.F5 = 0x3E

Function key F5

KeyboardCode.F6 = 0x3F

Function key F6

KeyboardCode.F7 = 0x40

Function key F7

KeyboardCode.F8 = 0x41

Function key F8

KeyboardCode.F9 = 0x42

Function key F9

KeyboardCode.F10 = 0x43

Function key F10

KeyboardCode.F11 = 0x44

Function key F11

KeyboardCode.F12 = 0x45

Function key F12

KeyboardCode.PRINT_SCREEN = 0x46

Print Screen (SysRq)

KeyboardCode.SCROLL_LOCK = 0x47

Scroll Lock

KeyboardCode.PAUSE = 0x48

Pause (Break)

KeyboardCode.INSERT = 0x49

Insert

KeyboardCode.HOME = 0x4A

Home

KeyboardCode.PAGE_UP = 0x4B

Go back one page

KeyboardCode.DELETE = 0x4C

Delete forward

KeyboardCode.END = 0x4D

End

KeyboardCode.PAGE_DOWN = 0x4E

Go forward one page

KeyboardCode.RIGHT_ARROW = 0x4F

Move the cursor right

KeyboardCode.LEFT_ARROW = 0x50

Move the cursor left

KeyboardCode.DOWN_ARROW = 0x51

Move the cursor down

KeyboardCode.UP_ARROW = 0x52

Move the cursor up

KeyboardCode.KEYPAD_NUMLOCK = 0x53

Num Lock

KeyboardCode.KEYPAD_FORWARD_SLASH = 0x54

Keypad /

KeyboardCode.KEYPAD_ASTERISK = 0x55

Keypad *

KeyboardCode.KEYPAD_MINUS = 0x56

Keyapd -

KeyboardCode.KEYPAD_PLUS = 0x57

Keypad +

KeyboardCode.KEYPAD_ENTER = 0x58

Keypad Enter

KeyboardCode.KEYPAD_ONE = 0x59

Keypad 1 and End

KeyboardCode.KEYPAD_TWO = 0x5A

Keypad 2 and Down Arrow

KeyboardCode.KEYPAD_THREE = 0x5B

Keypad 3 and PgDn

KeyboardCode.KEYPAD_FOUR = 0x5C

Keypad 4 and Left Arrow

KeyboardCode.KEYPAD_FIVE = 0x5D

Keypad 5

KeyboardCode.KEYPAD_SIX = 0x5E

Keypad 6 and Right Arrow

KeyboardCode.KEYPAD_SEVEN = 0x5F

Keypad 7 and Home

KeyboardCode.KEYPAD_EIGHT = 0x60

Keypad 8 and Up Arrow

KeyboardCode.KEYPAD_NINE = 0x61

Keypad 9 and PgUp

KeyboardCode.KEYPAD_ZERO = 0x62

Keypad 0 and Ins

KeyboardCode.KEYPAD_PERIOD = 0x63

Keypad . and Del

KeyboardCode.KEYPAD_BACKSLASH = 0x64

Keypad \\ and |

KeyboardCode.KEYPAD_EQUALS = 0x67

Keypad = (Mac)

KeyboardCode.F13 = 0x68

Function key F13 (Mac)

KeyboardCode.F14 = 0x69

Function key F14 (Mac)

KeyboardCode.F15 = 0x6A

Function key F15 (Mac)

KeyboardCode.F16 = 0x6B

Function key F16 (Mac)

KeyboardCode.F17 = 0x6C

Function key F17 (Mac)

KeyboardCode.F18 = 0x6D

Function key F18 (Mac)

KeyboardCode.F19 = 0x6E

Function key F19 (Mac)

KeyboardCode.LEFT_CONTROL = 0xE0

Control modifier left

KeyboardCode.CONTROL = LEFT_CONTROL

Control modifier

KeyboardCode.LEFT_SHIFT = 0xE1

Shift modifier left

KeyboardCode.SHIFT = LEFT_SHIFT

Shift modifier

KeyboardCode.LEFT_ALT = 0xE2

Alt modifier left

KeyboardCode.ALT = LEFT_ALT

Alt modifier

KeyboardCode.OPTION = ALT

Labeled as Option on some Mac keyboards

KeyboardCode.LEFT_GUI = 0xE3

GUI modifier left

KeyboardCode.RIGHT_CONTROL = 0xE4

Control modifier right

KeyboardCode.RIGHT_SHIFT = 0xE5
KeyboardCode.RIGHT_ALT = 0xE6
KeyboardCode.RIGHT_GUI = 0xE7

ConsumerCode

消费类常量

class ConsumerCode
ConsumerCode.POWER = 0x30
ConsumerCode.CHANNEL_UP = 0X9C
ConsumerCode.CHANNEL_DOWN = 0X9D
ConsumerCode.RECORD = 0xB2
ConsumerCode.FAST_FORWARD = 0xB3
ConsumerCode.REWIND = 0xB4
ConsumerCode.SCAN_NEXT_TRACK = 0xB5
ConsumerCode.SCAN_PREVIOUS_TRACK = 0xB6
ConsumerCode.STOP = 0xB7
ConsumerCode.EJECT = 0xB8
ConsumerCode.PLAY_PAUSE = 0xCD
ConsumerCode.MUTE = 0xE2
ConsumerCode.VOLUME_DECREMENT = 0xEA
ConsumerCode.VOLUME_INCREMENT = 0xE9