Przeglądaj źródła

Merge branch 'master' of https://gitee.com/openLuat/LuatOS

alienwalker 2 lat temu
rodzic
commit
74f66cd688

+ 2 - 2
.github/workflows/air101.yml

@@ -35,8 +35,8 @@ jobs:
         git config --global credential.helper store
         git config --global credential.helper store
         git config --global user.email 'bot@luatos.com'
         git config --global user.email 'bot@luatos.com'
         git config --global user.name 'robot'
         git config --global user.name 'robot'
-        git remote set-url origin https://ci:ci@gitee.com/openLuat/luatos-soc-air101
-        retry 'git push --all origin'
+        git remote set-url origin https://gitee.com/openLuat/luatos-soc-air101
+        retry 'git pull origin'
     - name: make
     - name: make
       run: |
       run: |
         cd ../air101
         cd ../air101

+ 2 - 2
.github/workflows/air105.yml

@@ -34,8 +34,8 @@ jobs:
         git config --global credential.helper store
         git config --global credential.helper store
         git config --global user.email 'bot@luatos.com'
         git config --global user.email 'bot@luatos.com'
         git config --global user.name 'robot'
         git config --global user.name 'robot'
-        git remote set-url origin https://ci:ci@gitee.com/openLuat/luatos-soc-air105
-        retry 'git push --all origin'
+        git remote set-url origin https://gitee.com/openLuat/luatos-soc-air105
+        retry 'git pull origin'
     - name: make
     - name: make
       run: |
       run: |
         cd ../air105
         cd ../air105

+ 54 - 0
components/u8g2/luat_lib_u8g2.c

@@ -286,6 +286,39 @@ static int l_u8g2_DrawUTF8(lua_State *L) {
     return 0;
     return 0;
 }
 }
 
 
+/*
+在提供的文本周围画一个框。这与 DrawUTF8 类似,但为文本添加了一些装饰。,要调用u8g2.SendBuffer()才会更新到屏幕
+@api u8g2.DrawButtonUTF8(str, x, y, flags, w, h, v, str)
+@string 文件内容
+@int 横坐标
+@int 竖坐标
+@int 标志 多个标志可以与“或”运算符一起使用。
+@int 文本的最小宽度。如果为0(或低于文本宽度),则文本宽度将用于框架。
+@int 文本前后的额外空间。
+@int 文本上下的额外空间。
+@usage
+u8g2.DrawButtonUTF8("str", 10, 20,u8g2.BTN_BW2,0,2,2)
+*/
+static int l_u8g2_DrawButtonUTF8(lua_State *L) {
+    if (u8g2 == NULL) {
+        LLOGW("disp not init yet!!!");
+        return 0;
+    }
+    size_t len;
+    size_t x, y,flags,w,h,v;
+    const char* str = luaL_checklstring(L, 1, &len);
+
+    x = luaL_checkinteger(L, 2);
+    y = luaL_checkinteger(L, 3);
+    flags = luaL_checkinteger(L, 4);
+    w = luaL_checkinteger(L, 5);
+    h = luaL_checkinteger(L, 6);
+    v = luaL_checkinteger(L, 7);
+
+    u8g2_DrawButtonUTF8(u8g2, x, y, flags, w, h, v, str);
+    return 0;
+}
+
 /*
 /*
 设置字体模式
 设置字体模式
 @api u8g2.SetFontMode(mode)
 @api u8g2.SetFontMode(mode)
@@ -842,6 +875,7 @@ static const rotable_Reg_t reg_u8g2[] =
     { "ClearBuffer", ROREG_FUNC(l_u8g2_ClearBuffer)},
     { "ClearBuffer", ROREG_FUNC(l_u8g2_ClearBuffer)},
     { "SendBuffer",  ROREG_FUNC(l_u8g2_SendBuffer)},
     { "SendBuffer",  ROREG_FUNC(l_u8g2_SendBuffer)},
     { "DrawUTF8",    ROREG_FUNC(l_u8g2_DrawUTF8)},
     { "DrawUTF8",    ROREG_FUNC(l_u8g2_DrawUTF8)},
+    { "DrawButtonUTF8",    ROREG_FUNC(l_u8g2_DrawButtonUTF8)},
     { "SetFontMode", ROREG_FUNC(l_u8g2_SetFontMode)},
     { "SetFontMode", ROREG_FUNC(l_u8g2_SetFontMode)},
     { "SetFont",     ROREG_FUNC(l_u8g2_SetFont)},
     { "SetFont",     ROREG_FUNC(l_u8g2_SetFont)},
     { "GetDisplayHeight",   ROREG_FUNC(l_u8g2_GetDisplayHeight)},
     { "GetDisplayHeight",   ROREG_FUNC(l_u8g2_GetDisplayHeight)},
@@ -968,6 +1002,26 @@ static const rotable_Reg_t reg_u8g2[] =
     { "DRAW_LOWER_RIGHT",        ROREG_INT(U8G2_DRAW_LOWER_RIGHT)},
     { "DRAW_LOWER_RIGHT",        ROREG_INT(U8G2_DRAW_LOWER_RIGHT)},
     //@const DRAW_ALL number 全部
     //@const DRAW_ALL number 全部
     { "DRAW_ALL",        ROREG_INT(U8G2_DRAW_ALL)},
     { "DRAW_ALL",        ROREG_INT(U8G2_DRAW_ALL)},
+    //@const BTN_BW0 number 文本周围没有边框
+    { "BTN_BW0",        ROREG_INT(U8G2_BTN_BW0)},
+    //@const BTN_BW1 number 文本周围的边框,1像素边框宽度
+    { "BTN_BW1",        ROREG_INT(U8G2_BTN_BW1)},
+    //@const BTN_BW2 number 文本周围的边框,2像素边框宽度
+    { "BTN_BW2",        ROREG_INT(U8G2_BTN_BW2)},
+    //@const BTN_BW3 number 文本周围的边框,3像素边框宽度
+    { "BTN_BW3",        ROREG_INT(U8G2_BTN_BW3)},
+    //@const BTN_SHADOW0 number 启用阴影,与框架无间隙
+    { "BTN_SHADOW0",        ROREG_INT(U8G2_BTN_SHADOW0)},
+    //@const BTN_SHADOW1 number 启用阴影,到帧的1像素间隙
+    { "BTN_SHADOW1",        ROREG_INT(U8G2_BTN_SHADOW1)},
+    //@const BTN_SHADOW2 number 启用阴影,到帧的2像素间隙
+    { "BTN_SHADOW2",        ROREG_INT(U8G2_BTN_SHADOW2)},
+    //@const BTN_INV number 反转文本
+    { "BTN_INV",        ROREG_INT(U8G2_BTN_INV)},
+    //@const BTN_HCENTER number 将文本置于框架内的中心,并将参考位置更改为文本的中心
+    { "BTN_HCENTER",        ROREG_INT(U8G2_BTN_HCENTER)},
+    //@const BTN_XFRAME number 在按钮周围绘制第二个1像素框
+    { "BTN_XFRAME",        ROREG_INT(U8G2_BTN_XFRAME)},
 	{ NULL,  ROREG_INT(0)}
 	{ NULL,  ROREG_INT(0)}
 };
 };
 
 

+ 1 - 0
components/u8g2/u8g2.h

@@ -631,6 +631,7 @@ uint8_t *u8g2_m_48_30_f(uint8_t *page_cnt);
 
 
 /*==========================================*/
 /*==========================================*/
 /* u8g2_d_setup.c generated code start */
 /* u8g2_d_setup.c generated code start */
+void u8g2_Setup_custom_i2c_noname_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
 void u8g2_Setup_ssd1305_128x32_noname_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
 void u8g2_Setup_ssd1305_128x32_noname_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
 void u8g2_Setup_ssd1305_128x32_adafruit_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
 void u8g2_Setup_ssd1305_128x32_adafruit_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
 void u8g2_Setup_ssd1305_128x32_noname_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);
 void u8g2_Setup_ssd1305_128x32_noname_2(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb);

+ 10 - 0
components/u8g2/u8g2_d_setup.c

@@ -3,6 +3,16 @@
 
 
 #include "u8g2.h"
 #include "u8g2.h"
 
 
+/* custom f */
+void u8g2_Setup_custom_i2c_noname_f(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
+{
+  uint8_t tile_buf_height;
+  uint8_t *buf;
+  // u8g2_SetupDisplay(u8g2, u8x8_d_custom_128x64_noname, u8x8_cad_custom_fast_i2c, byte_cb, gpio_and_delay_cb);
+  buf = u8g2_m_16_8_f(&tile_buf_height);
+  u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation);
+}
+
 /* ssd1305 */
 /* ssd1305 */
 /* ssd1305 1 */
 /* ssd1305 1 */
 void u8g2_Setup_ssd1305_128x32_noname_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
 void u8g2_Setup_ssd1305_128x32_noname_1(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)