Sfoglia il codice sorgente

update: scr库文档,暂时就先定成这样了

chenxuuu 4 anni fa
parent
commit
b8693da8e0
1 ha cambiato i file con 44 aggiunte e 2 eliminazioni
  1. 44 2
      docs/markdown/core/luat_scr.md

+ 44 - 2
docs/markdown/core/luat_scr.md

@@ -23,9 +23,9 @@
 local buff = zbuff.create({200,200,16},0xffff)
 
 --新建一个屏幕对象,xy偏移默认0
-local screen = scr.create("st7735",spi或者i2c编号,rstPin,csPin,x_offset,y_offset)
+local screen = scr.create("st7735",scr.port_spi连接类型,连接id,复位引脚,使能引脚,背光引脚,x偏移,y偏移)
 screen:wake()--唤醒屏幕
---screen:sleep()--休眠屏幕
+screen:sleep()--休眠屏幕
 screen:show(buff)--显示buff内容
 
 buff:pixel(0,3,0)-- 设置具体像素值
@@ -35,6 +35,48 @@ buff:drawRect(20, 40, 40, 40, 0) -- 画矩形
 screen:show(buff)--显示buff内容
 ```
 
+## Luat C API
+
+所有屏幕刷新控制逻辑,都由luat层处理。
+仅需适配spi/12c/特殊接口即可
+
+```c
+//连接类型
+enum luat_scr_port{
+    luat_scr_spi,
+    luat_scr_i2c,
+    luat_scr_lcd,
+    luat_scr_other
+}
+
+typeof struct luat_scr_cfg{
+    char* name;   //注意不用的时候要手动free掉
+    luat_scr_port port; //连接类型
+    int id;       //连接id
+    int rst_pin;  //复位引脚
+    int cs_pin;   //使能引脚
+    int blk_pin;  //背光引脚
+    int x_offset; //x偏移
+    int y_offset; //y偏移
+}luat_scr_cfg;
+
+int luat_scr_initial(luat_scr_cfg* cfg);
+int luat_scr_close(luat_scr_cfg* cfg);
+
+//下面这几个函数,只有是用到了spi/i2c外的类型时才用到
+int luat_scr_reset(luat_scr_cfg* cfg,uint32_t ms);
+int luat_scr_blk(luat_scr_cfg* cfg,char enable);
+
+//下面这几个函数,只有是用到了luat_scr_lcd类型时才用到
+int luat_scr_cmd(luat_scr_cfg* cfg,uint8_t* data,uint32_t length);
+int luat_scr_data(luat_scr_cfg* cfg,uint8_t* data,uint32_t length);
+
+//下面这几个函数,只有是用到了luat_scr_other类型时才用到
+int luat_scr_display(luat_scr_cfg* cfg,zbuff* data);//要完全自己实现刷屏功能
+int luat_scr_wake(luat_scr_cfg* cfg);
+int luat_scr_sleep(luat_scr_cfg* cfg);
+```
+
 ## 相关知识点
 
 * [Luat核心机制](/markdown/core/luat_core)