2020-04-23 13:55:00 -04:00
|
|
|
( cmd arg1 arg2 -- resp )
|
|
|
|
( Sends a command to the SD card, along with arguments and
|
|
|
|
specified CRC fields. (CRC is only needed in initial commands
|
|
|
|
though). This does *not* handle CS. You have to
|
|
|
|
select/deselect the card outside this routine. )
|
|
|
|
: _cmd
|
|
|
|
_wait DROP ROT ( a1 a2 cmd )
|
|
|
|
0 _s+crc ( a1 a2 crc )
|
|
|
|
ROT 256 /MOD ROT ( a2 h l crc )
|
|
|
|
_s+crc _s+crc ( a2 crc )
|
|
|
|
SWAP 256 /MOD ROT ( h l crc )
|
|
|
|
_s+crc _s+crc ( crc )
|
2020-10-29 21:03:11 -04:00
|
|
|
1 OR ( ensure stop bit )
|
2020-06-29 18:48:00 -04:00
|
|
|
(spix) DROP ( send CRC )
|
2020-04-23 13:55:00 -04:00
|
|
|
_wait ( wait for a valid response... )
|
|
|
|
;
|