Skip to content

Commit

Permalink
fix status (13) cmd, add to info
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jan 16, 2014
1 parent 0b310c0 commit a9f0f8b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions fat32cli/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "typefix.h"
#ifdef __AVR__
#define BAUD 57600
#define BAUD 115200
#ifndef F_CPU
#define F_CPU 16000000 // default to OpenLog
#endif
Expand Down Expand Up @@ -272,6 +272,7 @@ int main(int argc, char *argv[])
}
break;
case 'I':
printf("sta: %02x\n", cardstat() );
sta = sdhcinit();
printf("init %d\n", sta);
if (sta)
Expand All @@ -297,7 +298,6 @@ int main(int argc, char *argv[])
for (sta = 0; sta < 18; sta++)
printf("%c", dochar(filesectbuf[sta]));
printf("\n");

break;
case 'K':
i = setlock(2);
Expand Down
9 changes: 3 additions & 6 deletions fat32lib/sdhc.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,13 @@ u8 setlock(u8 nyt)
return ret;
}

static u16 gcardstat;
u16 cardstat()
u8 cardstat()
{
gcardstat = 0xdead;
csact();
sendsimplecmd(13);
recvspiblock(2);
gcardstat = (filesectbuf[0] << 8) | filesectbuf[1];
recvspiblock(1);
csinact();
return gcardstat;
return filesectbuf[0];
}

#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion fat32lib/sdhc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ void erasecard(void);
u8 cardnotbusy(void);


u16 cardstat(void);
u8 cardstat(void);

u8 cardpassword(u8 op, u8 * pw, u8 pwlen);

0 comments on commit a9f0f8b

Please sign in to comment.