Add correct handling of sd card, add reset command, add ls command

This commit is contained in:
2020-04-26 21:23:25 +02:00
parent 6e07a363f4
commit 4df68880f0
8 changed files with 111 additions and 13 deletions

View File

@@ -32,9 +32,9 @@ static struct sd_info card_info; // = {.type = CARD_NONE};
* @brief checkNotInserted
* @return return 0 if card is inserted, else 1
*/
static int sdio_check_inserted() {
int sdio_check_inserted() {
#if SDIO_ENABLE_INS
return ((INS_PORT->IDR & INS_PIN) == (INS_ACTIVE_LEVEL<<INS_PIN) ? 0 : 1);
return ((INS_PORT->IDR & (1<<INS_PIN)) == (INS_ACTIVE_LEVEL<<INS_PIN) ? 0 : 1);
#else
return 0; // Assume Card is inserted
#endif
@@ -46,7 +46,7 @@ static int sdio_check_inserted() {
*/
static int sdio_check_write_protection() {
#if SDIO_ENABLE_WRITEPROT
return ((WRITEPROT_PORT->IDR & WRITEPROT_PIN) == (WRITEPROT_ACTIVE_LEVEL<<WRITEPROT_PIN) ? 1 : 0);
return ((WRITEPROT_PORT->IDR & (1<<WRITEPROT_PIN)) == (WRITEPROT_ACTIVE_LEVEL<<WRITEPROT_PIN) ? 1 : 0);
#else
return 0; // Assume Card is not write protected
#endif