summaryrefslogtreecommitdiff
path: root/fw/fe310/test/fs.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-05-13 12:26:19 +0200
committerUros Majstorovic <majstor@majstor.org>2022-05-13 12:26:19 +0200
commit9ccb4db8d59ec9dab33ee8617d462f21a8bb4fa8 (patch)
treea4f8ba9375a4ee82bae6ddc0cb3a35227f6f9469 /fw/fe310/test/fs.c
parent45f0d9b890b086493f9bb06428c46cd802324223 (diff)
touch controller/eve fixes
Diffstat (limited to 'fw/fe310/test/fs.c')
-rw-r--r--fw/fe310/test/fs.c25
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