Changeset 2160
- Timestamp:
- Feb 3, 2011 12:30:28 AM (2 years ago)
- File:
-
- 1 edited
-
dev/olpc/touchpad/syntpad.fth (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dev/olpc/touchpad/syntpad.fth
r2052 r2160 2 2 \ Add this code to the existing mouse driver 3 3 dev /mouse 4 5 variable 'get-data 'get-data off6 variable 'get-data? 'get-data? off7 8 : setup ( -- )9 'get-data @ 0= if10 " get-data" my-parent ihandle>phandle find-method if11 'get-data !12 then13 then14 'get-data? @ 0= if15 " get-data?" my-parent ihandle>phandle find-method if16 'get-data? !17 then18 then19 ;20 21 4 22 5 h# f800 constant red … … 42 25 43 26 \ open initializes the port and resets the device 44 \ cmd sends a command byte and waits for the ack45 \ read1 reads 1 response byte46 \ read2 reads 2 response bytes47 \ mouse1:1 command e648 27 \ mouse2:1 command e7 49 28 \ stream-on command f4 50 \ stream- off command f529 \ stream-mode command ea,f4 51 30 \ mouse-status command e9 and reads 3 response bytes 52 \ set-resolution command e8 then sends another command byte 53 \ get-data? reads a data byte if one is available 54 \ get-data waits for and reads a data byte 55 31 \ stream-poll? ( -- false | dx dy buttons true ) 56 32 57 33 variable ptr 58 0 value show-raw?59 60 \ Runs the special Device ID command and checks for the ALPS return code61 \ Ref: 5.2.10 (1) of Hybrid-GP2B-T-1.pdf62 34 63 35 \ The Synaptics touchpad version is 64.02.30 … … 68 40 ; 69 41 70 \ Put the device into advancedmode and enable it42 \ Put the device into streaming mode and enable it 71 43 : start ( -- ) 72 setup73 44 stream-mode 74 45 ; … … 76 47 \ The normal mouse driver uses remote mode, but this device 77 48 \ doesn't support remote mode, so patch the mouse driver 78 \ "open" routine to substitute " noop" for "remote-mode".49 \ "open" routine to substitute "start" for "remote-mode". 79 50 80 51 patch start remote-mode open 81 52 82 \ The following code receives and decodes touchpad packets in the 83 \ various special formats 53 \ The following code receives and decodes touchpad packets 84 54 85 55 : show-packets ( adr len -- ) … … 113 83 ; 114 84 115 \ Try to receive a GS-format packet. If one arrives within85 \ Try to receive a mouse report packet. If one arrives within 116 86 \ 20 milliseconds, return true and the decoded information. 117 87 \ Otherwise return false. … … 124 94 ; 125 95 126 \ Switch the device to glide format and display 127 \ the data that it sends. Stop when a key is typed. 96 \ Display raw data from the device, stopping when a key is typed. 128 97 : show-pad ( -- ) 129 98 start
Note: See TracChangeset
for help on using the changeset viewer.
