mirror of
https://github.com/tpunix/HMCLOCK.git
synced 2025-12-09 09:08:12 +08:00
自动识别FLASH中保存的分辨率等信息
This commit is contained in:
@@ -70,10 +70,12 @@ Flash的0x39000处存放有墨水屏所使用的IO的信息:
|
||||
|
||||
Flash的0x3a000处存放有墨水屏的分辨率等信息:
|
||||
|
||||
00 25 00 00 92 fa a8 fe 00 01 80 00 28 01 04 00
|
||||
0080 0128 128x296 BWR
|
||||
40 1f 00 00 f0 70 18 01 00 01 7a 00 fa 00 fc 07
|
||||
007a 00fa 122x250
|
||||
007a 00fa 122x250 BWR
|
||||
c4 0a 00 00 1a 4f ae 5a 00 00 68 00 d4 00 04 00
|
||||
0068 00d4 104x212
|
||||
0068 00d4 104x212 BW
|
||||
|
||||
原版的固件,不知道什么原因,无法用蓝牙搜索到。否则可以无损更新固件了(但大多数价签的电池都是没电的,还是得拆开)。
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ int scr_padding;
|
||||
int update_mode;
|
||||
int lut_size;
|
||||
|
||||
int detect_w = 104;
|
||||
int detect_h = 212;
|
||||
int detect_mode = EPD_BW;
|
||||
|
||||
|
||||
// 窗口参数
|
||||
int win_w;
|
||||
@@ -356,6 +360,7 @@ void epd_screen_update(void)
|
||||
for(i=0; i<win_h*line_bytes; i++){
|
||||
epd_data(fb_bw[i]);
|
||||
}
|
||||
|
||||
if(scr_mode&EPD_BWR){
|
||||
epd_cmd(0x26);
|
||||
for(i=0; i<win_h*line_bytes; i++){
|
||||
|
||||
@@ -73,7 +73,9 @@ int select_font(int id);
|
||||
void fb_test(void);
|
||||
|
||||
|
||||
#define EPD_BW 0x00
|
||||
#define EPD_BWR 0x20
|
||||
|
||||
#define MIRROR_H 0x40
|
||||
#define MIRROR_V 0x80
|
||||
#define ROTATE_0 0x00 // 0
|
||||
@@ -99,6 +101,12 @@ extern int line_bytes;
|
||||
extern int scr_padding;
|
||||
extern int update_mode;
|
||||
|
||||
|
||||
extern int detect_w;
|
||||
extern int detect_h;
|
||||
extern int detect_mode;
|
||||
|
||||
|
||||
extern int win_w;
|
||||
extern int win_h;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
int fb_w;
|
||||
int fb_h;
|
||||
|
||||
#define FB_SIZE 4096
|
||||
#define FB_SIZE 4736
|
||||
u8 fb_bw[FB_SIZE];
|
||||
u8 fb_rr[FB_SIZE];
|
||||
|
||||
|
||||
@@ -346,6 +346,34 @@ int selflash(int otp_boot)
|
||||
int id = sf_readid();
|
||||
printk("Flash ID: %08x\n", id);
|
||||
|
||||
sf_read(0x39000, 16, pbuf);
|
||||
printk("39000: ");
|
||||
for(int i=0; i<16; i++){
|
||||
printk(" %02x", pbuf[i]);
|
||||
}
|
||||
printk("\n");
|
||||
printk("EPD Type: %02x\n", pbuf[0]);
|
||||
if(pbuf[1]==0x01){
|
||||
printk("EPD Gpio: %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
pbuf[8], pbuf[9], pbuf[10], pbuf[11], pbuf[12], pbuf[13], pbuf[14], pbuf[15]);
|
||||
}
|
||||
|
||||
sf_read(0x3a000, 16, pbuf);
|
||||
printk("3a000: ");
|
||||
for(int i=0; i<16; i++){
|
||||
printk(" %02x", pbuf[i]);
|
||||
}
|
||||
printk("\n");
|
||||
|
||||
int xres = *(u16*)(pbuf+10);
|
||||
int yres = *(u16*)(pbuf+12);
|
||||
if(xres<512 && yres<512){
|
||||
detect_w = xres;
|
||||
detect_h = yres;
|
||||
detect_mode = pbuf[9]? EPD_BWR : EPD_BW;
|
||||
printk("EPD Res: %dx%d %d\n", xres, yres, pbuf[9]);
|
||||
}
|
||||
|
||||
int region_table = (int)&Region$$Table$$Base;
|
||||
int firm_size = *(u32*)(region_table+0x10) - 0x07fc0000;
|
||||
printk("Firm size: %08x\n", firm_size);
|
||||
|
||||
@@ -183,13 +183,14 @@ void user_app_init(void)
|
||||
adv_state = 0;
|
||||
fspi_config(0x00030605);
|
||||
|
||||
epd_hw_init(0x23200700, 0x05210006, 104, 212, ROTATE_3); // 2.13黑白屏,6个测试点
|
||||
selflash(otp_boot);
|
||||
|
||||
epd_hw_init(0x23200700, 0x05210006, detect_w, detect_h, detect_mode | ROTATE_3); // 2.13黑白屏,6个测试点
|
||||
if(epd_detect()==0){
|
||||
epd_hw_init(0x23111000, 0x07210120, 104, 212, ROTATE_3); // 2.13黑白屏,5个测试点
|
||||
epd_hw_init(0x23111000, 0x07210120, detect_w, detect_h, detect_mode | ROTATE_3); // 2.13黑白屏,5个测试点
|
||||
epd_detect();
|
||||
}
|
||||
|
||||
selflash(otp_boot);
|
||||
|
||||
default_app_on_init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user