|
int | Start (const int basepin) |
| Start a new cog with the SPI driver. More...
|
|
int | Start (const int pin_do, const int pin_clk, const int pin_di, const int pin_cs) |
| Start a new cog with the SPI driver. More...
|
|
void | ReadBlock (const int block_index, char *buffer_address) |
|
void | WriteBlock (const int block_index, char *buffer_address) |
|
void | ReleaseCard (void) |
| Release the SPI bus and allow other devices to use it. More...
|
|
void | Stop (void) |
| Kill the assembly driver cog. More...
|
|
bool | HasError (void) const |
| If there was an error in the SD routines then this function will return an error code. More...
|
|
void | ClearError (void) |
| Resets the error flag to kNoError. More...
|
|
int | GetError (void) const |
|
SPI interface routines for SD & SDHC & MMC cards.
C++ conversion by SRLM, based on sdsafespi.spin version 0.3.0 by Jonathan "lonesock" Dummer.
This uses multiblock SPI mode exclusively.
This is the "SAFE" version...uses
- 1 instruction per bit writes
- 2 instructions per bit reads
- Warning
- You should check the error code after each function call. Something may have gone wrong, and this is the only way to know! If there is an error, the safest thing to do would be to destroy the object instance, fix the error, and try again. For some errors, it may be ok to simply clear the error and try again.
Notes:
- It appears that negative Spi_command is never used in the assembly code. This looks like an old error possibility that is no longer used. Can we take it out?
- Todo:
- (SRLM): Convert the SD SPI driver to GAS instead of binary.
- Author
- SRLM (srlm@.nosp@m.srlm.nosp@m.produ.nosp@m.ctio.nosp@m.ns.co.nosp@m.m)