2 #include "ui/browser.h"
4 #include <drivers/fatfs/ff.h>
7 #define FAHRPLAN_PATH "/fahrplan"
8 #define FAHRPLAN_MENUFILE "fahrplan.lst"
9 #define FAHRPLAN_POSFILE "selected.dat"
11 static uint8_t badge_load_fahrplan_pos(void) {
15 if(FR_OK
== f_open(&fd
, FAHRPLAN_POSFILE
, FA_OPEN_EXISTING
| FA_READ
)) {
18 if(FR_OK
== f_read(&fd
, &buf
, sizeof(buf
), &bytes
) && bytes
== sizeof(buf
)) {
28 static void badge_save_fahrplan_pos(uint8_t pos
) {
31 if(FR_OK
== f_open(&fd
, FAHRPLAN_POSFILE
, FA_CREATE_ALWAYS
| FA_WRITE
)) {
33 f_write(&fd
, &pos
, sizeof(pos
), &bytes
);
38 void badge_fahrplan(void) {
39 f_chdir(FAHRPLAN_PATH
);
41 uint8_t oldpos
= badge_load_fahrplan_pos();
44 badge_browse_textfiles(FAHRPLAN_MENUFILE
, &pos
);
47 badge_save_fahrplan_pos(pos
);
This page took 0.065073 seconds and 5 git commands to generate.