Update main.c

清理无用代码
添加无存储卡情况
This commit is contained in:
greedyhao 2019-08-29 12:02:54 +08:00
parent e5186aad1a
commit ff58662ca2

View File

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