diff options
Diffstat (limited to 'fw/fe310/test/fs.c')
-rw-r--r-- | fw/fe310/test/fs.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fw/fe310/test/fs.c b/fw/fe310/test/fs.c index 222833b..1dce3af 100644 --- a/fw/fe310/test/fs.c +++ b/fw/fe310/test/fs.c @@ -100,5 +100,30 @@ void app_fs_init(void) { rv = f_mount(&fs, "", 1); printf("f_mount:%d\n", rv); } + + if (rv == FR_OK) { + FIL f; + UINT w; + char *msg = "PERA JE CAR!"; + + rv = f_open(&f, TEXT_FN, FA_READ); + printf("f_open:%d\n", rv); + if (!rv) { + UINT r; + char _msg[TEXT_SIZE]; + + memset(_msg, 0, sizeof(_msg)); + rv = f_read(&f, _msg, sizeof(_msg), &r); + printf("f_read:%d %u %s\n", rv, r, _msg); + f_close(&f); + } else { + rv = f_open(&f, TEXT_FN, FA_WRITE | FA_CREATE_ALWAYS); + printf("f_open:%d\n", rv); + rv = f_write(&f, msg, strlen(msg), &w); + printf("f_write:%d\n", rv); + } + f_close(&f); + + } eos_spi_deselect(); }
\ No newline at end of file |