2 #include "ui/browser.h"
4 #include <drivers/fatfs/ff.h>
6 #define FAHRPLAN_PATH "/fahrplan"
7 #define FAHRPLAN_MENUFILE "fahrplan.lst"
8 #define FAHRPLAN_POSFILE "selected.dat"
10 static size_t badge_load_fahrplan_pos(void) {
14 if(FR_OK
== f_open(&fd
, FAHRPLAN_POSFILE
, FA_OPEN_EXISTING
| FA_READ
)) {
17 if(FR_OK
== f_read(&fd
, &buf
, sizeof(buf
), &bytes
) && bytes
== sizeof(buf
)) {
27 static void badge_save_fahrplan_pos(size_t pos
) {
30 if(FR_OK
== f_open(&fd
, FAHRPLAN_POSFILE
, FA_CREATE_ALWAYS
| FA_WRITE
)) {
32 f_write(&fd
, &pos
, sizeof(pos
), &bytes
);
37 void badge_fahrplan(void) {
38 f_chdir(FAHRPLAN_PATH
);
40 size_t oldpos
= badge_load_fahrplan_pos();
43 badge_browse_textfiles(FAHRPLAN_MENUFILE
, &pos
);
46 badge_save_fahrplan_pos(pos
);
This page took 0.043063 seconds and 5 git commands to generate.