Can one do the equivalent of setse1 and waitse1 in Spin2?
aside from the obvious inline ASM, WAITCT.
WAITCT
Ha, good point, but nothing is obvious to me!
Speaking of non-obvious, how would one use waitct to wait on a selectable event? I'm not getting it.
Not. The only relation is they are both hooked into the hardware event mechanism.
WAITSE1 isn't going to be very helpful to Spin code. May as well just test inputs and loop. Write a function and name it waitpin() or similar.
Here's a simple example. The timeout is future absolute CT value as per the WAITSE1 instruction. It can be removed of course.
PUB waitpin( pinnum, timeout ) org or pinnum, #%001_000000 'falling edge ' or pinnum, #%100_000000 'low level setse1 pinnum setq timeout waitse1 end
@evanh Thanks for the snippet. I guess bits 8, 7, and 6 mean something; are they documented somewhere?
Silicon doc - section Events - sub-section Selectable Events - https://www.parallax.com/propeller-2/documentation/
Awesome; thanks!
Comments
aside from the obvious inline ASM,
WAITCT
.Ha, good point, but nothing is obvious to me!
Speaking of non-obvious, how would one use waitct to wait on a selectable event? I'm not getting it.
Not. The only relation is they are both hooked into the hardware event mechanism.
WAITSE1 isn't going to be very helpful to Spin code. May as well just test inputs and loop. Write a function and name it waitpin() or similar.
Here's a simple example. The timeout is future absolute CT value as per the WAITSE1 instruction. It can be removed of course.
@evanh Thanks for the snippet. I guess bits 8, 7, and 6 mean something; are they documented somewhere?
Silicon doc - section Events - sub-section Selectable Events - https://www.parallax.com/propeller-2/documentation/
Awesome; thanks!