[openfirmware] [commit] r2896 - cpu/arm/olpc

repository service svn at openfirmware.info
Fri Mar 16 23:18:07 CET 2012


Author: wmb
Date: Fri Mar 16 23:18:06 2012
New Revision: 2896
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2896

Log:
OLPC XO-1.75 - trac #11704 - Raydium touchscreen driver - calibrate touchscreen during selftest and don't hang indefinitely if the touchscreen is spewing events.

Modified:
   cpu/arm/olpc/exc7200-touchscreen.fth
   cpu/arm/olpc/rm3150-touchscreen.fth
   cpu/arm/olpc/touchscreen-common.fth

Modified: cpu/arm/olpc/exc7200-touchscreen.fth
==============================================================================
--- cpu/arm/olpc/exc7200-touchscreen.fth	Fri Mar 16 02:04:15 2012	(r2895)
+++ cpu/arm/olpc/exc7200-touchscreen.fth	Fri Mar 16 23:18:06 2012	(r2896)
@@ -53,6 +53,7 @@
    begin
       pad?  if  . . . . . cr  then
    key? until
+   key drop
 ;
 
 : track  ( x y z down? contact# -- )

Modified: cpu/arm/olpc/rm3150-touchscreen.fth
==============================================================================
--- cpu/arm/olpc/rm3150-touchscreen.fth	Fri Mar 16 02:04:15 2012	(r2895)
+++ cpu/arm/olpc/rm3150-touchscreen.fth	Fri Mar 16 23:18:06 2012	(r2896)
@@ -95,6 +95,9 @@
 ;
 : discard-n  ( .. #events -- )   5 *  0  ?do  drop  loop  ;
 
+\ Needs 2 seconds of no-touch
+: calibrate  ( -- )  h# 20 0 ts-b!  ;
+
 : selftest  ( -- error? )
    open  0=  if
 \     ." Touchscreen open failed"  true exit
@@ -104,7 +107,12 @@
    \ Being able to open the touchpad is good enough in SMT mode
    smt-test?  if  close false exit  then
 
-   final-test? 0=  if
+   calibrate   \ Needs 2 seconds of no-touch
+
+   targets?  if
+      ." Calibrating touchscreen" cr
+      d# 2000 ms
+   else
       ." Touchscreen test will start in 4 seconds" cr
       d# 4000 ms
    then
@@ -115,7 +123,10 @@
    begin  key?  while  key drop  repeat
 
    \ Consume already-queued trackpad events to prevent premature exit
-   begin  pad-events  ?dup  while  discard-n  repeat
+   d# 100 0  do
+      pad-events  ?dup  0=  if  leave  then  ( .. #events )
+      discard-n                              ( )
+   loop
 
    background
    begin

Modified: cpu/arm/olpc/touchscreen-common.fth
==============================================================================
--- cpu/arm/olpc/touchscreen-common.fth	Fri Mar 16 02:04:15 2012	(r2895)
+++ cpu/arm/olpc/touchscreen-common.fth	Fri Mar 16 23:18:06 2012	(r2896)
@@ -143,8 +143,6 @@
    pixcolor !         
 ;
 
-: handle-key  ( -- exit? )  true  ;
-
 false value selftest-failed?  \ Success/failure flag for final test mode
 : exit-test?  ( -- flag )
    targets?  if                       ( )
@@ -165,7 +163,7 @@
    then                               ( )
 
    \ If not final test mode, we only exit via a key - no targets
-   key?  if  handle-key  else  false  then  ( exit ? )
+   key?  dup  if  key drop  then      ( exit? )
 ;
 
 0 value pressure



More information about the openfirmware mailing list