⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 combi.lst

📁 USB接口的鼠标驱动源程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
0030 0003                         QUEUE_STRUCT        OpticsQueue;        //optics queue      
                                  
0033 0002                         ONE_MSEC_STATUS     MsecStatus;         //status of 1msec interrupt
0035 0003                         OPTICS_STATE        Optics;             //current state of optics
0038 0005                         MOUSE_STATE         Mouse;              //current state of mouse (buttons, x,y,z)
003D                              char bLastButtons;
003E                              char bDebounceCount;
                                  
                                  
003F 0010                         char bOpticsArray[16];                  //16-byte array used for optics queue data
                                  
                                  
                                  const signed char quad_table[] =
                                  /*
                                  ;***
                                  ; Quadrature state table. This table assists processing of quadrature state
                                  ; transitions. The table index is calculated as:
                                  ;       [(last_state)*4 + current_state],
                                  ; and the table entry at that point is 1, 0 or -1 indicating increment, hold
                                  ; or decrement the count, respectively.
                                  ;***
                                  */
                                  {
                                      0,                  //;State 0 => state 0 (NoChange)
                                      1,                  //;        => state 1 (Increment)
                                      0xff,               //;        => state 2 (Decrement)
                                      0,                  //;        => state 3 (Fault)
                                      
                                      0xff,               //;State 1 => state 0 (Decrement)
                                      0,                  //;       => state 1  (NoChange)
                                      0,                  //;       => state 2  (Fault)
                                      1,                  //;       => state 3  (Increment)
                                      
                                      1,                  //;State 2 => state 0 (Increment)
                                      0,                  //;       => state 1  (Fault)
                                      0,                  //;     => state 2    (NoChange)
                                      0xff,               //;       => state 3  (Decrement)
                                      
                                      0,                  //;State 3 => state 0 (Fault)
                                      0xff,               //;       => state 1  (Decrement)
                                      1,                  //;       => state 2  (Increment)
                                      0                   //;      => state 3   (NoChange)
17D0 00 01 FF 00 FF 00 00 01 01   };
17D9 00 00 FF 00 FF 01 00         
                                  
                                  const signed char z_quad_table[] =
                                  /*
                                  ;***
                                  ; Quadrature state table. This table assists processing of quadrature state
                                  ; transitions. The table index is calculated as:
                                  ;       [(last_state)*4 + current_state],
                                  ; and the table entry at that point is 1, 0 or -1 indicating increment, hold
                                  ; or decrement the count, respectively.
                                  ;***
                                  */
                                  {
                                      0,                  //;State 0 => state 0 (NoChange)
                                      0,                  //;        => state 1 (NoChange)
                                      0,                  //;        => state 2 (NoChange)
                                      0,                  //;        => state 3 (Fault)
                                      
                                      0,              //;State 1 => state 0 (NoChange)
                                      0,                  //;       => state 1 (NoChange)
                                      0,                  //;       => state 2 (NoChange)
                                      1,                  //;       => state 3 (Increment)
                                      
                                      1,                  //;State 2 => state 0 (Increment)
                                      0,                  //;       => state 1 (Fault)
                                      0,                  //;     => state 2 (NoChange)
                                      0xff,               //;       => state 3 (Decrement)
                                      
                                      0,                  //;State 3 => state 0 (Fault)
                                      0xff,               //;       => state 1 (Decrement)
                                      0,                  //;       => state 2 (NoChange)
                                      0                   //;      => state 3 (NoChange)
17C0 00 00 00 00 00 00 00 01 01   };
17C9 00 00 FF 00 FF 00 00         
                                  /*
                                  ** function prototypes for shared functions
                                  */
                                  void main(void);
                                  void ClearRam(void);
                                  void Delay(char delay);
                                  //void delay(void);
                                  
                                  //*************************************************************************************************
                                  //USB DECLARATIONS
                                  
                                  #include "usb_desc.h"                       //include usb descriptors
                                  
                                  /*
                                  ** HID MOUSE DESCRIPTOR DECLARATIONS
                                  */
                                  
                                  const char hid_report_desc_table[] =
                                  {
                                  
                                   0x05, 0x01, /*usage page (generic desktop) */
                                   0x09, 0x02, /*usage (mouse) */
                                   0xA1, 0x01, /*collection (application) */
                                   0x05, 0x09, /*usage page (buttons) */
                                   0x19, 0x01, /*usage minimum (1) */
                                   0x29, 0x03, /*usage maximum (3) */
                                   0x15, 0x00, /*logical minimum (0) */
                                   0x25, 0x01, /*logical maximum (1) */
                                   0x95, 0x03, /*report count (3 bytes) */
                                   0x75, 0x01, /*report size (1) */
                                   0x81, 0x02, /*input (3 button bits) */
                                   0x95, 0x01, /*report count (1) */
                                   0x75, 0x05, /*report size (5) */
                                   0x81, 0x03, /*input (constant 5 bit padding) */
                                   0x05, 0x01, /*usage page (generic desktop) */
                                   0x09, 0x01, /*pointer*/
                                   0xA1, 0x00, /*linked*/
                                   0x09, 0x30, /*X*/
                                   0x09, 0x31, /*Y*/
                                   0x15, 0x81, /*logical minimum (-127) */
                                   0x25, 0x7F, /*logical maximum (127) */
                                   0x75, 0x08, /*report size (8) */
                                   0x95, 0x02, /*report count (2) */
                                   0x81, 0x06, /*input (2 position bytes X & Y) */
                                   0xC0,       /*end collection*/
                                   0x09,0x38,  /*wheel*/
                                   0x95,0x01,  /*wheel size = 1 byte*/
                                   0x81,0x06,  /*variable data bit field with relative position*/
                                   0x09,0x3c,  /*motion wakeup*/
                                   0x15,0x00,  /*0 no movement*/
                                   0x25,0x01,  /*1 movement*/
                                   0x75,0x01,  /*1st bit represents movement*/
                                   0x95,0x01,  /*1 report*/
                                   0xb1,0x22,  /* Variable Data Bit Field with  absolute positioning and no preferred state*/
                                   0x95,0x07,  /* 7 reports for reversing, upper 7 bits of byte 3*/
                                   0xb1,0x01,  /*Constant Array Bit Field with absolute positioning*/
                                   0xC0        /* end collection, end collection */
                                  
1778 05 01 09 02 A1 01 05 09 19    };
1781 01 29 03 15 00 25 01 95 03   
178A 75 01 81 02 95 01 75 05 81   
1793 03 05 01 09 01 A1 00 09 30   
179C 09 31 15 81 25 7F 75 08 95   
17A5 02 81 06 C0 09 38 95 01 81   
17AE 06 09 3C 15 00 25 01 75 01   
17B7 95 01 B1 22 95 07 B1 01 C0   
                                  
                                  const char Endpoint_Descriptor[] =
                                  {
                                   0x07,      /* descriptor length (7 bytes) */
                                   0x05,      /* descriptor type (ENDPOINT) */
                                   0x81,      /* endpoint address (IN endpoint, endpoint 1) */
                                   0x03,      /* endpoint attributes (interrupt) */
                                   0x04, 0x00, /* maximum packet size (4 bytes) */
                                   0x0A       /* polling interval (10ms) */
1771 07 05 81 03 04 00 0A         };
                                  
                                  const char Class_Descriptor[] =
                                  {
                                   0x09,      /* descriptor size (9 bytes) */
                                   0x21,      /* descriptor type (HID) */
                                   0x10, 0x01,/* class specification (1.10) */
                                   0x00,      /* hardware target country */
                                   0x01,      /* number of hid class desriptors to follow (1) */
                                   0x22,      /* report descriptor type (2) */
                                   sizeof(hid_report_desc_table),
                                   0x00
1768 09 21 10 01 00 01 22 48 00   };
                                  
                                  const char Interface_Descriptor[] =
                                  {
                                   0x09,      /* length of descriptor (9 bytes) */
                                   0x04,      /* descriptor type (INTERFACE) */
                                   0x00,      /* interface number (0) */
                                   0x00,      /* alternate setting (0) */
                                   0x01,      /* number of endpoints (1) */
                                   0x03,      /* interface class (3..defined by USB spec) */
                                   0x01,      /* interface sub-class (1..defined by USB spec) */
                                   0x02,      /* interface protocol (2..defined by USB spec) */
                                   0x00       /* interface string index (not supported) */
175F 09 04 00 00 01 03 01 02 00   };
                                  
                                  const char config_desc_table[] =
                                  {
                                   0x09,      /* length of descriptor (9 bytes) */
                                   0x02,      /* descriptor type (CONFIGURATION) */
                                   0x22, 0x00,/* total length of descriptor (33 bytes) */
                                   0x01,      /* number of interfaces to configure (1) */
                                   0x01,      /* configuration value (1) */
                                   0x04,      /* configuration string index (4) */
                                   0xA0,      /* configuration attributes (bus powered, remote wakeup) */
                                   0x64       /* maximum power (set at 100, change this value for your specific optics)*/
1756 09 02 22 00 01 01 04 A0 64   };
                                  
                                  const char device_desc_table[] =
                                  {
                                   0x12,      /* size of descriptor (18 bytes) */
                                   0x01,      /* descriptor type (device descriptor) */
                                   0x10, 0x01,/* USB spec release (ver 1.1) */
                                   0x00,      /* class code (each interface specifies class information) */
                                   0x00,      /* device sub-class (must be set to 0 because class code is 0) */
                                   0x00,      /* device protocol (no class specific protocol) */
                                   0x08,      /* maximum packet size (8 bytes) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -