fl { Quickstart Touch Sense demo PropForth4.0a 14/06/2011 12:53:02 LED7 = 0x17 LED6 = 0x16 LED5 = 0x15 LED4 = 0x14 LED3 = 0x13 LED2 = 0x12 LED1 = 0x11 LED0 = 0x10 PAD7 = 0x7 PAD6 = 0x6 PAD5 = 0x5 PAD4 = 0x4 PAD3 = 0x3 PAD2 = 0x2 PAD1 = 0x1 PAD0 = 0x0 } \ waitcnt ( n1 n2 -- n3 ) \ wait until n1, n3 = n1 + n2 : waitcnt _execasm2>1 1F1 _cnip ; : variable lockdict create $C_a_dovarl w, 0 l, forthentry freedict ; 0 wconstant _pad 10 wconstant _LEDs variable delay variable glovalPads : scan_pads \ ( n -- ) n:delay time dup delay L! cnt COG@ + begin outa COG@ ff _pad lshift or outa COG! dira COG@ ff _pad lshift or dira COG! dira COG@ ff _pad lshift invert and dira COG! delay L@ waitcnt ina COG@ invert ff and glovalPads L! 0 until ; : demo c" clkfreq 100 u/ scan_pads" 4 cogx _LEDs 8 0 do dup pinout 1+ loop drop begin 0 32 0 do glovalPads L@ or dup _LEDs lshift outa COG@ ff00ffff and or outa COG! loop drop 0 until ;