Update main.c

清理无用代码
添加无存储卡情况
This commit is contained in:
greedyhao 2019-08-29 12:02:54 +08:00
parent e5186aad1a
commit ff58662ca2
1 changed files with 41 additions and 31 deletions

View File

@ -34,14 +34,12 @@ void init_uart0(void)
int main(void)
{
u8 i,m;
float t=0;
uint8_t mount_is_ok = 1; /* 0: mount successful ; 1: mount failed */
int offset = 0;
uint64_t start_mtime, delta_mtime;
FIL fil;
FRESULT fr; /* FatFs return code */
UINT br, bw;
UINT br;
rcu_periph_clock_enable(RCU_GPIOA);
rcu_periph_clock_enable(RCU_GPIOC);
@ -58,8 +56,14 @@ int main(void)
LEDG(1);
LEDB(1);
fr = f_mount(&fs, "", 1);
if (fr == 0)
mount_is_ok = 0;
else
mount_is_ok = 1;
while(1)
{
if (mount_is_ok == 0)
{
offset = 0;
fr = f_open(&fil, "logo.bin", FA_READ);
@ -97,6 +101,12 @@ int main(void)
/* Close the file */
f_close(&fil);
}
else
{
LEDR_TOG;
delay_1ms(500);
}
}
}
int _put_char(int ch)