Implement generic movie player
This commit is contained in:
parent
b05d4c0799
commit
5b18f1644a
@ -82,7 +82,7 @@ typedef unsigned long u32;
|
||||
#define OLED_DATA 1 //写数据
|
||||
|
||||
extern u16 BACK_COLOR; //背景色
|
||||
extern unsigned char image[12800];
|
||||
extern unsigned char image[FRAME_SIZE];
|
||||
|
||||
void LCD_Writ_Bus(u8 dat);
|
||||
void LCD_WR_DATA8(u8 dat);
|
||||
|
@ -657,7 +657,7 @@ void LCD_ShowPicture(u16 x1,u16 y1,u16 x2,u16 y2)
|
||||
{
|
||||
int i;
|
||||
LCD_Address_Set(x1,y1,x2,y2);
|
||||
for(i=0;i<12800;i++)
|
||||
for(i=0;i<FRAME_SIZE;i++)
|
||||
{
|
||||
// LCD_WR_DATA8(image[i*2+1]);
|
||||
LCD_WR_DATA8(image[i]);
|
||||
@ -668,7 +668,7 @@ void LCD_ShowLogo(void)
|
||||
{
|
||||
int i;
|
||||
LCD_Address_Set(0,0,159,75);
|
||||
for(i=0;i<25600;i++)
|
||||
for(i=0;i<FRAME_SIZE;i++)
|
||||
{
|
||||
LCD_WR_DATA8(logo_bmp[i]);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "fatfs/tf_card.h"
|
||||
#include <string.h>
|
||||
|
||||
unsigned char image[12800];
|
||||
unsigned char image[FRAME_SIZE];
|
||||
FATFS fs;
|
||||
|
||||
void init_uart0(void)
|
||||
@ -39,6 +39,7 @@ int main(void)
|
||||
FIL fil;
|
||||
FRESULT fr; /* FatFs return code */
|
||||
UINT br;
|
||||
FSIZE_t filesize;
|
||||
|
||||
rcu_periph_clock_enable(RCU_GPIOA);
|
||||
rcu_periph_clock_enable(RCU_GPIOC);
|
||||
@ -48,8 +49,8 @@ int main(void)
|
||||
init_uart0();
|
||||
|
||||
Lcd_Init(); // init OLED
|
||||
LCD_Clear(WHITE);
|
||||
BACK_COLOR=WHITE;
|
||||
LCD_Clear(BLACK);
|
||||
BACK_COLOR=BLACK;
|
||||
|
||||
LEDR(1);
|
||||
LEDG(1);
|
||||
@ -63,61 +64,48 @@ int main(void)
|
||||
|
||||
if (mount_is_ok == 0)
|
||||
{
|
||||
while(1)
|
||||
fr = f_open(&fil, "movie.bin", FA_READ);
|
||||
if (fr) printf("open error: %d!\n\r", (int)fr);
|
||||
|
||||
if (!fr)
|
||||
{
|
||||
offset = 0;
|
||||
fr = f_open(&fil, "logo.bin", FA_READ);
|
||||
if (fr) printf("open error: %d!\n\r", (int)fr);
|
||||
f_lseek(&fil, offset);
|
||||
fr = f_read(&fil, image, sizeof(image), &br);
|
||||
LCD_ShowPicture(0,0,159,39);
|
||||
offset += 12800;
|
||||
LEDB_TOG;
|
||||
f_lseek(&fil, offset);
|
||||
fr = f_read(&fil, image, sizeof(image), &br);
|
||||
LCD_ShowPicture(0,40,159,79);
|
||||
LEDB_TOG;
|
||||
delay_1ms(1500);
|
||||
f_close(&fil);
|
||||
|
||||
fr = f_open(&fil, "bmp.bin", FA_READ);
|
||||
if (fr) printf("open error: %d!\n\r", (int)fr);
|
||||
offset = 0;
|
||||
|
||||
for (int i=0; i<2189;i++)
|
||||
while(1)
|
||||
{
|
||||
fr = f_read(&fil, image, sizeof(image), &br);
|
||||
LCD_ShowPicture(0,0,159,39);
|
||||
offset += 12800;
|
||||
f_lseek(&fil, offset);
|
||||
LEDB_TOG;
|
||||
fr = f_read(&fil, image, sizeof(image), &br);
|
||||
LCD_ShowPicture(0,40,159,79);
|
||||
offset += 12800;
|
||||
f_lseek(&fil, offset);
|
||||
LEDB_TOG;
|
||||
filesize = f_size(&fil);
|
||||
offset = 0;
|
||||
|
||||
LEDR(0);
|
||||
LEDB(0);
|
||||
while(offset < filesize)
|
||||
{
|
||||
f_lseek(&fil, offset);
|
||||
fr = f_read(&fil, image, sizeof(image), &br);
|
||||
LCD_ShowPicture(0,0,159,79);
|
||||
offset += FRAME_SIZE;
|
||||
LEDB_TOG;
|
||||
delay_1ms(6);
|
||||
}
|
||||
|
||||
delay_1ms(4000);
|
||||
}
|
||||
|
||||
/* Close the file */
|
||||
f_close(&fil);
|
||||
}
|
||||
else
|
||||
{
|
||||
LCD_ShowString(12, 20, (u8 *)("Missing movie.bin"), YELLOW);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LCD_ShowString(24, 0, (u8 *)("no card found!"), BLACK);
|
||||
LCD_ShowString(24, 16, (u8 *)("no card found!"), BLUE);
|
||||
LCD_ShowString(24, 32, (u8 *)("no card found!"), BRED);
|
||||
LCD_ShowString(24, 48, (u8 *)("no card found!"), GBLUE);
|
||||
LCD_ShowString(24, 64, (u8 *)("no card found!"), RED);
|
||||
while (1)
|
||||
{
|
||||
LEDR_TOG;
|
||||
delay_1ms(200);
|
||||
LEDG_TOG;
|
||||
delay_1ms(200);
|
||||
LEDB_TOG;
|
||||
delay_1ms(200);
|
||||
}
|
||||
LCD_ShowString(20, 20, (u8 *)("Insert SD-Card!"), YELLOW);
|
||||
}
|
||||
|
||||
LCD_ShowString(2, 64, (u8 *)("Tiband"), MAGENTA);
|
||||
while (1)
|
||||
{
|
||||
LEDR_TOG;
|
||||
delay_1ms(500);
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user