mirror of
https://github.com/tpunix/HMCLOCK.git
synced 2025-12-07 08:32:50 +08:00
调整epd的api接口
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
// Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
// 硬件参数
|
||||||
int scr_w;
|
int scr_w;
|
||||||
int scr_h;
|
int scr_h;
|
||||||
int scr_mode;
|
int scr_mode;
|
||||||
@@ -13,12 +13,12 @@ int line_bytes;
|
|||||||
int scr_padding;
|
int scr_padding;
|
||||||
|
|
||||||
|
|
||||||
// <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD>
|
// 窗口参数
|
||||||
int win_w;
|
int win_w;
|
||||||
int win_h;
|
int win_h;
|
||||||
|
|
||||||
|
|
||||||
// x<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>8<EFBFBD>ı<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>x2>x1, Y2>y1
|
// x必须是8的倍数,且x2>x1, Y2>y1
|
||||||
void epd_window(int x1, int y1, int x2, int y2)
|
void epd_window(int x1, int y1, int x2, int y2)
|
||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
@@ -218,16 +218,11 @@ int epd_lut_size(void)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epd_init(int w, int h, int mode)
|
void epd_init(void)
|
||||||
{
|
{
|
||||||
epd_hw_open();
|
epd_hw_open();
|
||||||
|
|
||||||
scr_w = w;
|
printk("epd_init: %dx%d\n", scr_w, scr_h);
|
||||||
scr_h = h;
|
|
||||||
scr_mode = mode;
|
|
||||||
line_bytes = (scr_w+7)>>3;
|
|
||||||
scr_padding = line_bytes*8-scr_w;
|
|
||||||
printk("epd_init: scr: %d x %d\n", scr_w, scr_h);
|
|
||||||
|
|
||||||
epd_power(1);
|
epd_power(1);
|
||||||
epd_reset();
|
epd_reset();
|
||||||
|
|||||||
@@ -28,11 +28,12 @@ int sf_read(int addr, int len, u8 *buf);
|
|||||||
int selflash(int otp_boot);
|
int selflash(int otp_boot);
|
||||||
|
|
||||||
// epd_hw
|
// epd_hw
|
||||||
void epd_hw_init(u32 config0, u32 config1);
|
void epd_hw_init(u32 config0, u32 config1, int w, int h, int mode);
|
||||||
void epd_hw_open(void);
|
void epd_hw_open(void);
|
||||||
void epd_hw_close(void);
|
void epd_hw_close(void);
|
||||||
void epd_reset(void);
|
void epd_reset(void);
|
||||||
void epd_wait(void);
|
void epd_wait(void);
|
||||||
|
int epd_busy(void);
|
||||||
void epd_power(int on);
|
void epd_power(int on);
|
||||||
|
|
||||||
void epd_cmd(int cmd);
|
void epd_cmd(int cmd);
|
||||||
@@ -46,8 +47,7 @@ void epd_read(u8 *data, int len);
|
|||||||
void epd_cmd_read(int cmd, u8 *data, int len);
|
void epd_cmd_read(int cmd, u8 *data, int len);
|
||||||
|
|
||||||
// epd_xxx
|
// epd_xxx
|
||||||
|
void epd_init(void);
|
||||||
void epd_init(int x, int y, int mode);
|
|
||||||
void epd_load_lut(u8 *lut);
|
void epd_load_lut(u8 *lut);
|
||||||
void epd_update(int mode);
|
void epd_update(int mode);
|
||||||
void epd_sleep(void);
|
void epd_sleep(void);
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void delay_ms(int ms)
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
void epd_hw_init(u32 config0, u32 config1)
|
void epd_hw_init(u32 config0, u32 config1, int w, int h, int mode)
|
||||||
{
|
{
|
||||||
epio_pwr = (config0>>24)&0xff;
|
epio_pwr = (config0>>24)&0xff;
|
||||||
epio_busy = (config0>>16)&0xff;
|
epio_busy = (config0>>16)&0xff;
|
||||||
@@ -80,6 +80,12 @@ void epd_hw_init(u32 config0, u32 config1)
|
|||||||
epio_cs = (config1>>16)&0xff;
|
epio_cs = (config1>>16)&0xff;
|
||||||
epio_clk = (config1>> 8)&0xff;
|
epio_clk = (config1>> 8)&0xff;
|
||||||
epio_sdi = (config1>> 0)&0xff;
|
epio_sdi = (config1>> 0)&0xff;
|
||||||
|
|
||||||
|
scr_w = w;
|
||||||
|
scr_h = h;
|
||||||
|
scr_mode = mode;
|
||||||
|
line_bytes = (scr_w+7)>>3;
|
||||||
|
scr_padding = line_bytes*8-scr_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void epd_hw_open(void)
|
void epd_hw_open(void)
|
||||||
@@ -147,6 +153,12 @@ void epd_wait(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int epd_busy(void)
|
||||||
|
{
|
||||||
|
return EPD_BUSY();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void epd_power(int on)
|
void epd_power(int on)
|
||||||
{
|
{
|
||||||
EPD_PWR(on);
|
EPD_PWR(on);
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ void clock_draw(int full)
|
|||||||
{
|
{
|
||||||
char tbuf[64];
|
char tbuf[64];
|
||||||
|
|
||||||
epd_init(104, 212, EPD_BWR|ROTATE_3);
|
epd_init();
|
||||||
|
|
||||||
memset(fb_bw, 0xff, scr_h*line_bytes);
|
memset(fb_bw, 0xff, scr_h*line_bytes);
|
||||||
memset(fb_rr, 0x00, scr_h*line_bytes);
|
memset(fb_rr, 0x00, scr_h*line_bytes);
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void user_app_init(void)
|
|||||||
|
|
||||||
adv_count = 0;
|
adv_count = 0;
|
||||||
fspi_config(0x00030605);
|
fspi_config(0x00030605);
|
||||||
epd_hw_init(0x23200700, 0x05210006); // for 2.13 board BW
|
epd_hw_init(0x23200700, 0x05210006, 104, 212, EPD_BWR|ROTATE_3); // for 2.13 board BW
|
||||||
|
|
||||||
selflash(otp_boot);
|
selflash(otp_boot);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user