📄 hid_kb_2313_descriptors_and_data.inc
字号:
; HID_KB_2313_Descriptors_and_Data.inc
.SET SH = 128
.SET a = 4
.SET b = 5
.SET c = 6
.SET d = 7
.SET e = 8
.SET f = 9
.SET g = 10
.SET h = 11
.SET i = 12
.SET j = 13
.SET k = 14
.SET l = 15
.SET m = 16
.SET n = 17
.SET o = 18
.SET p = 19
.SET q = 20
.SET r = 21
.SET s = 22
.SET t = 23
.SET u = 24
.SET v = 25
.SET w = 26
.SET kx = 27 ; can't use X,Y or Z in new assembler
.SET ky = 28
.SET kz = 29
.SET n0 = 39
.SET n1 = 30
.SET n2 = 31
.SET n3 = 32
.SET n4 = 33
.SET n5 = 34
.SET n6 = 35
.SET n7 = 36
.SET n8 = 37
.SET n9 = 38
.SET sp = 44
.SET excl = SH+n1
.SET quest = SH+56
.SET period = 55
.SET comma = 54
.SET bs=42
.SET colon = SH+51
.SET tab = 43
.SET enter = 40
.SET dash = 45
.SET ampersand = SH+36
.CSEG
.ORG 0x300 ; in words
;Device_Descriptor
DD:
.DB 0x12,0x01 ; bLength = 18d bDescriptorType = Device (1)
.DB 0x00,0x01 ; bcdUSB(L/H) USB spec rev (BCD)
.DB 0xFF,0xFF ; bDeviceClass bDeviceSubClass,
.DB 0xFF,0x40 ; bDeviceProtocol bMaxPacketSize0 EP0 is 64 bytes
.DB 0x6A,0x0B ; idVendor(L/H) MAXIM is 0B6A
.DB 0x46,0x53 ; idProduct(L/H)--5346
.DB 0x34,0x12 ; bcdDevice--1234
.DB 1,2,3,1 ; iManufacturer--iProduct--iSerialNumber--bNumConfigurations
; .DB 0,0,0,1
;
;Configuration_Descriptor
CD:
.DB 0x09,0x02 ; bLength bDescriptorType = Config
.DB 34,0 ; wTotalLength=34 bytes (L/H)
.DB 0x01,0x01 ; bNumInterfaces bConfigValue
.DB 0x00,0x80 ; iConfiguration bmAttributes. b7=1 b6=self-powered(NOT) b5=RWU supported(NOT)
.DB 0x01,0x09 ; MaxPower is 2 ma INTERFACE Descriptor, Length=9
.DB 0x04,0x00 ; type = IF IF #0
.DB 0x00,0x01 ; bAlternate Setting bNum Endpoints
.DB 0x03,0x00 ; bInterfaceClass=HID bInterfaceSubClass
.DB 0x00,0x00 ; bInterfaceProtocol iInterface
;HID_Descriptor
HD:
.DB 0x09,0x21 ; bLength bDescriptorType = HID
.DB 0x10,0x01 ; bcdHID(L/H) Rev 1.1
.DB 0x00,0x01 ; bCountryCode (none) bNumDescriptors (one report descriptor)
.DB 0x22,43 ; bDescriptorType(report): wDescriptorLength(L) 43 byte report descriptor
.DB 0x00,0x07 ; wDescriptorLengthH ENDPOINT DESCRIPTOR bLength
.DB 0x05,0x83 ; bDescriptorType(EP) bEndpointAddress (EP3-IN)
.DB 0x03,0x40 ; bmAttributes(INT) wMaxPacketSizeL
.DB 0x00,0x255 ; wMaxPacketSizeH bInterval (poll every 255 msec)
;Report_Descriptor
RD:
.DB 0x05,0x01 ; bDescriptorType (report) Usage Page (generic desktop)
.DB 0x09,0x06 ; Usage
.DB 0xA1,0x01 ; Collection
.DB 0x05,0x07 ; Usage Page
.DB 0x19,0xE0 ; Usage Minimum = 224
.DB 0x29,0xE7 ; Usage Maximum = 231
.DB 0x15,0x00 ; Logical Minimum = 0
.DB 0x25,0x01 ; Logical Maximum = 1
.DB 0x75,0x01 ; Report Size = 1
.DB 0x95,0x08 ; Report Count = 8
.DB 0x81,0x02 ; Input(Data,Variable,Absolute)
.DB 0x95,0x01 ; Report Count = 1
.DB 0x75,0x08 ; Report Size = 8
.DB 0x81,0x01 ; Input(Constant)
.DB 0x19,0x00 ; Usage Minimum = 0
.DB 0x29,0x65 ; Usage Maximum = 101
.DB 0x15,0x00 ; Logical Minimum = 0,
.DB 0x25,0x65 ; Logical Maximum = 101
.DB 0x75,0x08 ; Report Size = 8
.DB 0x95,0x01 ; Report Count = 1
.DB 0x81,0x00 ; Input(Data,Variable,Array)
.DB 0xC0 ; End Collection
STR0: ; Language string
.DB 0x04,0x03 ; bLength bDescriptorType = string
.DB 0x09,0x04 ; wLANGID(L/H)
;
; NOTE: USB uses Unicode for strings, which inserts a 0 after every ASCII character.
; These tables omit the zeros to save code space. The sending routine inserts them.
;
STR1: ; Manufacturer ID
.DB 12,0x03 ; bLength bDescriptorType=string
.DB 'M','A','X','I','M' ; length is 2 + 2*(number of letters)
STR2: ; Product ID
.DB 10,0x03 ; bLength bDescriptorType=string
.DB 'D','e','m','o'
STR3: ; Serial Number
.DB 8,0x03 ; bLength bDescriptorType = string
.DB 'S','N','1'
DESCREND:
.CSEG
.ORG 0x380 ; in words
;HID_Message: Each letter is 3 bytes: shift,[00],Keycode. Sending routine inserts the middle zero.
; If b7 is set, send the shift character as the first byte.
;
; 0xFF is the message terminator.
;
KB_Message:
.DB enter,enter,dash,dash,dash,sp,SH+m,SH+a,SH+kx,n3,n4,n2,n0,SH+e,sp,SH+d,a,t,a,sp,SH+s,h,e,e,t,sp,dash,dash,dash,enter
.DB tab,dash,sp,SH+A,d,d,s,sp,SH+u,SH+s,SH+b,sp,t,o,sp,a,n,ky,sp,s,ky,s,t,e,m,enter
.DB tab,dash,sp,SH+t,i,n,ky,sp,ampersand,sp,SH+c,h,e,a,p,bs,bs,bs,bs,o,s,t,sp,SH+e,f,f,e,c,t,i,v,e,enter
.DB tab,dash,sp,SH+s,i,m,p,l,e,sp,SH+s,SH+p,SH+i,sp,SH+i,n,t,e,r,f,a,c,e,enter
.DB tab,dash,sp,SH+F,l,e,kx,i,b,l,e,enter
.DB tab,dash,sp,SH+T,ky,p,e,s,sp,SH+i,t,s,sp,SH+O,w,n,sp,SH+d,a,t,a,sp,SH+s,h,e,e,t,enter
.DB tab,dash,sp,SH+u,s,e,sp,SH+ky,o,u,r,sp,SH+e,kx,i,s,t,i,n,g,sp,u,SH+p,sp,ampersand,sp,SH+t,o,o,l,s,enter,0xFF
Message_End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -