2019-11-21 19:54:18 +00:00
|
|
|
#include "tools.h"
|
|
|
|
#include "gfx.h"
|
|
|
|
#include "../libs/fatfs/ff.h"
|
|
|
|
#include "../gfx/gfx.h"
|
|
|
|
#include "../utils/btn.h"
|
2019-12-03 09:06:11 +00:00
|
|
|
#include "../soc/gpio.h"
|
|
|
|
#include "../utils/util.h"
|
2019-11-21 19:54:18 +00:00
|
|
|
|
|
|
|
void displayinfo(){
|
|
|
|
clearscreen();
|
|
|
|
|
|
|
|
FATFS *fs;
|
|
|
|
DWORD fre_clust, fre_sect, tot_sect;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
gfx_printf("Getting storage info: please wait...");
|
|
|
|
|
|
|
|
res = f_getfree("sd:", &fre_clust, &fs);
|
|
|
|
gfx_printf("\nResult getfree: %d\n\n", res);
|
|
|
|
|
|
|
|
tot_sect = (fs->n_fatent - 2) * fs->csize;
|
|
|
|
fre_sect = fre_clust * fs->csize;
|
|
|
|
|
2019-12-03 09:06:11 +00:00
|
|
|
gfx_printf("%d KiB total\n%d KiB free\n\nPress any key to continue\n", tot_sect / 2, fre_sect / 2);
|
2019-11-21 19:54:18 +00:00
|
|
|
|
|
|
|
btn_wait();
|
2019-12-03 09:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void displaygpio(){
|
|
|
|
int res;
|
|
|
|
clearscreen();
|
|
|
|
gfx_printf("Updates gpio pins ever 50ms:\nPress power to exit");
|
|
|
|
msleep(200);
|
|
|
|
while (1){
|
|
|
|
msleep(10);
|
|
|
|
gfx_con_setpos(0, 63);
|
|
|
|
|
|
|
|
for (int i = 0; i <= 30; i++){
|
|
|
|
gfx_printf("\nPort %d: ", i);
|
|
|
|
for (int i2 = 7; i2 >= 0; i2--)
|
|
|
|
gfx_printf("%d", gpio_read(i, (1 << i2)));
|
|
|
|
}
|
|
|
|
|
|
|
|
res = btn_read();
|
|
|
|
if (res & BTN_POWER)
|
|
|
|
break;
|
|
|
|
}
|
2019-11-21 19:54:18 +00:00
|
|
|
}
|