124da6adec
Although the SPI Relay driver is RC2014-specific, the SD Card driver is generic enough to be a subsystem. That's the second subsystem we add and this warrants, I think, the formalization of a new concept: protocols.
16 lines
299 B
Plaintext
16 lines
299 B
Plaintext
( -- n )
|
|
: _idle 0xff (spix) ;
|
|
|
|
( -- n )
|
|
( spix 0xff until the response is something else than 0xff
|
|
for a maximum of 20 times. Returns 0xff if no response. )
|
|
: _wait
|
|
0 ( cnt )
|
|
BEGIN
|
|
_idle
|
|
DUP 0xff = IF DROP ELSE NIP EXIT THEN
|
|
1+
|
|
DUP 20 = UNTIL
|
|
DROP 0xff
|
|
;
|