Files
There are no circuits or boards in this repository.
Last update 3 years 1 month
by
ddr2
Filessend_code | |
---|---|
.. | |
Makefile | |
diskio.c | |
diskio.h | |
ff.c | |
ff.h | |
ffconf.h | |
main.c | |
mmc_avr.h | |
mmc_avr_spi.c | |
uart.c | |
uart.h |
main.c/*------------------------------------------------------------/ / Open or create a file in append mode / (This function was sperseded by FA_OPEN_APPEND flag at FatFs R0.12a) /------------------------------------------------------------*/ #include <stdio.h> #include "uart.h" #include "ff.h" const char *errors[] = { "(0) Succeeded", "(1) A hard error occurred in the low level disk I/O layer", "(2) Assertion failed", "(3) The physical drive cannot work", "(4) Could not find the file", "(5) Could not find the path", "(6) The path name format is invalid", "(7) Access denied due to prohibited access or directory full", "(8) Access denied due to prohibited access", "(9) The file/directory object is invalid", "(10) The physical drive is write protected", "(11) The logical drive number is invalid", "(12) The volume has no work area", "(13) There is no valid FAT volume", "(14) The f_mkfs() aborted due to any problem", "(15) Could not get a grant to access the volume within defined period", "(16) The operation is rejected according to the file sharing policy", "(17) LFN working buffer could not be allocated", "(18) Number of open files > FF_FS_LOCK", "(19) Given parameter is invalid" }; void die (FRESULT rf) { printf("error: %d, %s\n", rf, errors[rf]); for(;;); } int main (void) { FRESULT fr; FATFS fs; FIL fil; uart_init(); /* Open or create a log file and ready to append */ printf("mount: "); fr = f_mount(&fs, "", 0); if (fr != FR_OK) die(fr); puts ("ok."); printf("open:"); fr = f_open (&fil, "TEST.TXT", FA_READ); /* Open or create a file */ //|FA_WRITE if (fr != FR_OK) die(fr); puts("ok."); for (;;); return 0; }