-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
068c63b
commit 0ef5c2b
Showing
8 changed files
with
595 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include "spi.h" | ||
#include "sd.h" | ||
#include "fat_filelib.h" | ||
|
||
//----------------------------------------------------------------- | ||
// main | ||
//----------------------------------------------------------------- | ||
int main(int argc, char *argv[]) | ||
{ | ||
// Initialise SPI interface | ||
spi_init(); | ||
|
||
// Initialise SD interface | ||
if (sd_init() < 0) | ||
{ | ||
printf("ERROR: Cannot init SD card\n"); | ||
return -1; | ||
} | ||
|
||
// Initialise File IO Library | ||
fl_init(); | ||
|
||
// Attach media access functions to library | ||
if (fl_attach_media(sd_readsector, sd_writesector) != FAT_INIT_OK) | ||
{ | ||
printf("ERROR: Failed to init file system\n"); | ||
return -1; | ||
} | ||
|
||
// List the root directory | ||
fl_listdirectory("/"); | ||
|
||
return 0; | ||
} | ||
|
Oops, something went wrong.