2025-06-27 00:32:57 +08:00
|
|
|
|
#include "mywin_demo.h"
|
2025-10-18 01:02:27 +08:00
|
|
|
|
#include "avi.h"
|
|
|
|
|
|
#include "dac.h"
|
2025-06-27 00:32:57 +08:00
|
|
|
|
#include "ff.h"
|
|
|
|
|
|
#include "flash_manager.h"
|
2025-10-18 01:02:27 +08:00
|
|
|
|
#include "lcd_pwm.h"
|
2025-06-27 00:32:57 +08:00
|
|
|
|
#include "mp3play.h"
|
|
|
|
|
|
#include "mylua.h"
|
2025-10-18 01:02:27 +08:00
|
|
|
|
#include "mywin_inc.h"
|
|
|
|
|
|
#include "system_file.h"
|
|
|
|
|
|
#include "system_updata.h"
|
2025-06-27 00:32:57 +08:00
|
|
|
|
|
|
|
|
|
|
#include "mywin_user_home.h"
|
2025-10-18 01:02:27 +08:00
|
|
|
|
#include "mywin_user_stat.h"
|
2025-06-27 00:32:57 +08:00
|
|
|
|
#include "mywin_user_status_bar.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "date.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "arm_math.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "fft2d.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "mywin_user_lock.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "mywin_user_animation.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2025-10-18 01:02:27 +08:00
|
|
|
|
*
|
|
|
|
|
|
* <EFBFBD>Զ<EFBFBD><EFBFBD>崰<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
|
*
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
void baseWin_callback(WIN_WindowStruct *win, WIN_MsgStruct *msg);
|
|
|
|
|
|
|
|
|
|
|
|
// ״̬<D7B4><CCAC>ʾ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void stat_callback(void *t);
|
|
|
|
|
|
|
|
|
|
|
|
void mywin_demo_test(void *t) {
|
|
|
|
|
|
WIN_Init();
|
|
|
|
|
|
int lcd_xsize = WIN_GetWinStruct()->lcd->getLcdSizeX();
|
|
|
|
|
|
int lcd_ysize = WIN_GetWinStruct()->lcd->getLcdSizeY();
|
|
|
|
|
|
ui_setScreenBackLightPower(1);
|
|
|
|
|
|
|
|
|
|
|
|
// mylua_test();
|
|
|
|
|
|
|
|
|
|
|
|
// ״̬<D7B4><CCAC>ʾ
|
|
|
|
|
|
WIN_StatusBarStruct *statubar = 0;
|
|
|
|
|
|
statubar = WIN_CreatStatusBar(0, 0, 0, 0, lcd_xsize, 20);
|
|
|
|
|
|
WIN_ShowWindow((WIN_WindowStruct *)statubar);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ҳ
|
|
|
|
|
|
WIN_HomeStruct *home = 0;
|
|
|
|
|
|
home = WIN_CreatHome(0, 0, 0, 20, lcd_xsize, lcd_ysize - 20);
|
|
|
|
|
|
WIN_SetBackPicPath((WIN_WindowStruct *)home, "0:/JPG/<2F><><EFBFBD><EFBFBD>1.jpg");
|
|
|
|
|
|
WIN_SetWinTitle((WIN_WindowStruct *)home, "home");
|
|
|
|
|
|
WIN_ShowWindow((WIN_WindowStruct *)home);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ûص<C3BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
WIN_SetMsgLoopCallBack(0, baseWin_callback);
|
|
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
|
WIN_Delay(20);
|
|
|
|
|
|
}
|
2025-06-27 00:32:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-18 01:02:27 +08:00
|
|
|
|
// <20><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>
|
|
|
|
|
|
void prtSc(void) {
|
|
|
|
|
|
int lcd_xsize = WIN_GetWinStruct()->lcd->getLcdSizeX();
|
|
|
|
|
|
int lcd_ysize = WIN_GetWinStruct()->lcd->getLcdSizeY();
|
|
|
|
|
|
int buff_size = lcd_xsize * lcd_ysize * 2 + 8;
|
|
|
|
|
|
u8 *buff = mymalloc(buff_size);
|
|
|
|
|
|
u8 scan = 0x00;
|
|
|
|
|
|
u8 gray = 0x10;
|
|
|
|
|
|
u16 w = lcd_xsize;
|
|
|
|
|
|
u16 h = lcd_ysize;
|
|
|
|
|
|
u8 is565 = 0x01;
|
|
|
|
|
|
u8 rgb = 0x1b;
|
|
|
|
|
|
|
|
|
|
|
|
buff[0] = scan;
|
|
|
|
|
|
buff[1] = gray;
|
|
|
|
|
|
buff[2] = w;
|
|
|
|
|
|
buff[3] = w >> 8;
|
|
|
|
|
|
buff[4] = h;
|
|
|
|
|
|
buff[5] = h >> 8;
|
|
|
|
|
|
buff[6] = is565;
|
|
|
|
|
|
buff[7] = rgb;
|
|
|
|
|
|
|
|
|
|
|
|
static int num = 1;
|
|
|
|
|
|
FIL *file = mymalloc(sizeof(FIL));
|
|
|
|
|
|
char *file_name = mymalloc(256);
|
|
|
|
|
|
FRESULT ret = FR_OK;
|
|
|
|
|
|
sprintf(file_name, "0:/PIC/%d.pic", num);
|
|
|
|
|
|
num++;
|
|
|
|
|
|
ret = f_open(file, file_name, FA_CREATE_NEW | FA_WRITE);
|
|
|
|
|
|
if (ret == FR_OK) {
|
|
|
|
|
|
u16 *imag = (u16 *)(buff + 8);
|
|
|
|
|
|
UINT real = 0;
|
|
|
|
|
|
WIN_GetWinStruct()->lcd->getColors(imag, 0, 0, w, h);
|
|
|
|
|
|
ret = f_write(file, buff, buff_size, &real);
|
|
|
|
|
|
if (ret != FR_OK)
|
|
|
|
|
|
while (1)
|
|
|
|
|
|
;
|
|
|
|
|
|
else
|
|
|
|
|
|
MSGBOX_TipsTime(0, "<EFBFBD><EFBFBD>ͼ<EFBFBD>ѱ<EFBFBD><EFBFBD><EFBFBD>", file_name, "ȷ<EFBFBD><EFBFBD>", 5000);
|
|
|
|
|
|
} else
|
|
|
|
|
|
MSGBOX_TipsTime(0, "<EFBFBD>ļ<EFBFBD><EFBFBD>Ѵ<EFBFBD><EFBFBD><EFBFBD>", file_name, "ȷ<EFBFBD><EFBFBD>", 5000);
|
|
|
|
|
|
f_close(file);
|
|
|
|
|
|
myfree(file);
|
|
|
|
|
|
myfree(file_name);
|
|
|
|
|
|
myfree(buff);
|
2025-06-27 00:32:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-18 01:02:27 +08:00
|
|
|
|
static const char *g_powerOffItem[] = {"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>BootLoader"};
|
2025-06-27 00:32:57 +08:00
|
|
|
|
|
2025-10-18 01:02:27 +08:00
|
|
|
|
static void creat_lock(void *ptr) {
|
|
|
|
|
|
WIN_WindowStruct *win = WIN_GetCurrentWindow();
|
|
|
|
|
|
LOCK_EnterLock("0:/PIC/3.pic");
|
2025-06-27 00:32:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-18 01:02:27 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>,<2C><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>һЩȫ<D0A9><C8AB><EFBFBD><EFBFBD>Ϣ
|
2025-06-27 00:32:57 +08:00
|
|
|
|
/*
|
2025-07-05 19:47:28 +08:00
|
|
|
|
ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>İ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-10-18 01:02:27 +08:00
|
|
|
|
<EFBFBD>̰<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD><EFBFBD><EFBFBD>
|
2025-06-27 00:32:57 +08:00
|
|
|
|
*/
|
2025-10-18 01:02:27 +08:00
|
|
|
|
void baseWin_callback(WIN_WindowStruct *win, WIN_MsgStruct *msg) {
|
|
|
|
|
|
WIN_KeyStruct *k = 0;
|
|
|
|
|
|
static int light = 1;
|
|
|
|
|
|
switch (msg->msg) {
|
|
|
|
|
|
case WIN_MSG_INIT:
|
|
|
|
|
|
break;
|
|
|
|
|
|
case WIN_MSG_KEY:
|
|
|
|
|
|
k = msg->data.p;
|
|
|
|
|
|
if (k->shortPress & KEY_VALUE_LIGHT) {
|
|
|
|
|
|
// <20>̰<EFBFBD><CCB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
light = !light;
|
|
|
|
|
|
ui_setScreenBackLightPower(light);
|
|
|
|
|
|
} else if (k->shortPress & KEY_VALUE_DES) {
|
|
|
|
|
|
// ֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD><EFBFBD>̵߳<DFB3><CCB5>ú<EFBFBD><C3BA><EFBFBD>
|
|
|
|
|
|
WIN_RunInWindow("home", creat_lock, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (k->longPress & KEY_VALUE_HOME) {
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD>
|
|
|
|
|
|
int index = MSGBOX_Select((WIN_WindowStruct *)0, "ѡ<EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD>ѡ<EFBFBD><EFBFBD>",
|
|
|
|
|
|
(char **)g_powerOffItem, 2, "ȷ<EFBFBD><EFBFBD>", "ȡ<EFBFBD><EFBFBD>");
|
|
|
|
|
|
if (index == 0) {
|
|
|
|
|
|
SysFile_SaveSetFile();
|
|
|
|
|
|
NVIC_SystemReset();
|
|
|
|
|
|
} else if (index == 1) {
|
|
|
|
|
|
SysFile_SaveSetFile();
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>iap<61><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> user.app <20>ļ<EFBFBD>
|
|
|
|
|
|
(*(u32 *)0x20000000) = 0xff000003;
|
|
|
|
|
|
NVIC_SystemReset();
|
|
|
|
|
|
}
|
|
|
|
|
|
} // if (k->longPress&KEY_VALUE_HOME)
|
|
|
|
|
|
else if (k->longPress & KEY_VALUE_DES) {
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD>
|
|
|
|
|
|
prtSc();
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case WIN_MSG_CHID:
|
|
|
|
|
|
break;
|
|
|
|
|
|
case WIN_MSG_EXTMSG:
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
WIN_DefaultMsgLoop(win, msg);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2025-06-27 00:32:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-18 01:02:27 +08:00
|
|
|
|
// ״̬<D7B4><CCAC>ʾ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
void stat_callback(void *t) {
|
|
|
|
|
|
WIN_StatStruct *stat = (WIN_StatStruct *)t;
|
|
|
|
|
|
sprintf(stat->txt, "%.1f,%.1f", mem_perused() / 100.0,
|
|
|
|
|
|
exmem_perused() / 100.0);
|
|
|
|
|
|
WIN_SetInvalid((WIN_WindowStruct *)stat);
|
2025-06-27 00:32:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-18 01:02:27 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>Ҷ<EFBFBD>任<EFBFBD><E4BBBB><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
void FFT_Test(WIN_PicStruct *pic_, int t) {
|
|
|
|
|
|
static float32_t *img = 0;
|
|
|
|
|
|
static int xsize = 0;
|
|
|
|
|
|
static int ysize = 0;
|
|
|
|
|
|
static int ttt = 0;
|
|
|
|
|
|
if (ttt < 256)
|
|
|
|
|
|
ttt++;
|
|
|
|
|
|
else
|
|
|
|
|
|
ttt = 0;
|
|
|
|
|
|
// if (img) return;
|
|
|
|
|
|
if (img == 0) {
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ͼ<EFBFBD><CDBC>
|
|
|
|
|
|
img = mymalloc(pic_->xsize * pic_->ysize * sizeof(float32_t));
|
|
|
|
|
|
xsize = pic_->xsize;
|
|
|
|
|
|
ysize = pic_->ysize;
|
|
|
|
|
|
for (int i = 0; i < xsize * ysize; i++) {
|
|
|
|
|
|
img[i] = RGB2GRAY(pic_->data[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
FFT2D_Struct fft2d = {0};
|
|
|
|
|
|
if (FFT2D_Init(&fft2d, 512) == 0) {
|
|
|
|
|
|
|
|
|
|
|
|
FFT2D_Rfft(&fft2d, img, xsize, ysize);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 512; i++) {
|
|
|
|
|
|
for (int j = 0; j < 512; j++) {
|
|
|
|
|
|
if (((i > ttt) && (i < 512 - ttt)) || ((j > ttt) && (j < 512 - ttt))) {
|
|
|
|
|
|
if (!(((i > ttt) && (i < 512 - ttt)) &&
|
|
|
|
|
|
((j > ttt) && (j < 512 - ttt))))
|
|
|
|
|
|
fft2d.imgBuff[i * 512 + j] = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FFT2D_Rifft(&fft2d, 0);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
for (int i = 0; i < ysize; i++) {
|
|
|
|
|
|
for (int j = 0; j < xsize; j++) {
|
|
|
|
|
|
pic_->data[i * xsize + j] = fft2d.imgBuff[i * 512 + j];
|
|
|
|
|
|
pic_->data[i * xsize + j] = GRAY2RGB(pic_->data[i * xsize + j]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
FFT2D_Delete(&fft2d);
|
2025-06-27 00:32:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-18 01:02:27 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD>
|
|
|
|
|
|
static void Delete_code(void) {
|
|
|
|
|
|
// LCD_PWMinit(100);
|
|
|
|
|
|
|
|
|
|
|
|
// DAC_UserStruct dac={0};
|
|
|
|
|
|
//
|
|
|
|
|
|
// dac.buff1=mymalloc (256*4);
|
|
|
|
|
|
// dac.buff2=mymalloc (256*4);
|
|
|
|
|
|
// for (int i=0;i<64;i++) dac.buff1[i]=i*4*4;
|
|
|
|
|
|
// for (int i=0;i<64;i++) dac.buff2[i]=1024-i*4*4;
|
|
|
|
|
|
// dac.buff_size=64*4;
|
|
|
|
|
|
// dac.rate=RATE48000;
|
|
|
|
|
|
//
|
|
|
|
|
|
// DAC_NormalInit (&dac);
|
|
|
|
|
|
|
|
|
|
|
|
// FIL *mp3f=mymalloc (sizeof (FIL));
|
|
|
|
|
|
// FILINFO *mp3f_info=malloc (sizeof (FILINFO));
|
|
|
|
|
|
// f_stat ("0:/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.mp3",mp3f_info);
|
|
|
|
|
|
// u8 *mp3_data=mymalloc (mp3f_info->fsize);
|
|
|
|
|
|
// UINT datasize=0;
|
|
|
|
|
|
// f_open (mp3f,"0:/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.mp3",FA_READ);
|
|
|
|
|
|
// f_read (mp3f,mp3_data,mp3f_info->fsize,&datasize);
|
|
|
|
|
|
|
|
|
|
|
|
// mp3_play_song (mp3_data,datasize);
|
|
|
|
|
|
|
|
|
|
|
|
// char txt[50]={0};
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// ANIMATION_ShowGifTime (0,"0:/GIF/12.gif",10000);
|
|
|
|
|
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ͼƬ
|
|
|
|
|
|
// loading ();
|
|
|
|
|
|
|
|
|
|
|
|
// ״̬<D7B4><CCAC>
|
|
|
|
|
|
// WIN_StatusBarStruct *statubar=0;
|
|
|
|
|
|
// statubar=WIN_CreatStatusBar (0,0,0,0,LCD_GetLcdSizeX(),20);
|
|
|
|
|
|
// STATUSBAR_SetRes (statubar,&res);
|
|
|
|
|
|
// if (ret==0)
|
|
|
|
|
|
// { STATUSBAR_SetBackPic(statubar,&pic);
|
|
|
|
|
|
// pic.data+=pic.xsize*20;//<2F><><EFBFBD><EFBFBD>ͼƬλ<C6AC><CEBB>
|
|
|
|
|
|
// }
|
|
|
|
|
|
// WIN_ShowWindow((WIN_WindowStruct*)statubar);
|
|
|
|
|
|
|
|
|
|
|
|
// stat=WIN_CreatStat (0,0,0,LCD_GetLcdSizeY()/2-30,20,60);//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// STAT_SetImg (stat,(u8*)gImage_stat_nfc);
|
|
|
|
|
|
// stat=WIN_CreatStat
|
|
|
|
|
|
//(0,0,LCD_GetLcdSizeX()-20,LCD_GetLcdSizeY()/2-30,20,60);//<2F>ұ<EFBFBD> STAT_SetImg
|
|
|
|
|
|
//(stat,(u8*)gImage_stat_bluetooth); stat=WIN_CreatStat
|
|
|
|
|
|
//(0,0,LCD_GetLcdSizeX()/2-30,0,60,20);//<2F>ϱ<EFBFBD>
|
|
|
|
|
|
// stat->TimerCallBack=stat_bet_callback;
|
|
|
|
|
|
// stat->timerId=WIN_CreatTimer ((WIN_WindowStruct *)stat,1000);
|
|
|
|
|
|
// STAT_SetTxt (stat,"ʾ<><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
2025-06-27 00:32:57 +08:00
|
|
|
|
}
|