luat_lib_eink.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /*
  2. @module eink
  3. @summary 墨水屏操作库
  4. @version 1.0
  5. @date 2020.11.14
  6. */
  7. #include "luat_base.h"
  8. #include "luat_log.h"
  9. #include "luat_sys.h"
  10. #include "luat_msgbus.h"
  11. #include "luat_timer.h"
  12. #include "luat_malloc.h"
  13. #include "luat_spi.h"
  14. #include "luat_gpio.h"
  15. // #include "epd1in54.h"
  16. // #include "epd2in9.h"
  17. #include "epd.h"
  18. #include "epdpaint.h"
  19. #include "imagedata.h"
  20. #include "qrcode.h"
  21. #include <stdlib.h>
  22. #include "u8g2.h"
  23. #define Pin_BUSY (18)
  24. #define Pin_RES (7)
  25. #define Pin_DC (9)
  26. #define Pin_CS (16)
  27. #define SPI_ID (0)
  28. #define COLORED 0
  29. #define UNCOLORED 1
  30. #define LUAT_LOG_TAG "luat.eink"
  31. // static EPD epd;
  32. static Paint paint;
  33. static unsigned char* frame_buffer;
  34. /**
  35. 初始化eink
  36. @api eink.setup(full, spiid)
  37. @int 全屏刷新1,局部刷新0,默认是全屏刷新
  38. @int 所在的spi,默认是0
  39. @return boolean 成功返回true,否则返回false
  40. */
  41. static int l_eink_setup(lua_State *L) {
  42. int num = luaL_optinteger(L, 1, 1);
  43. int spi_id = luaL_optinteger(L, 2, 0);
  44. if (frame_buffer != NULL) {
  45. lua_pushboolean(L, 1);
  46. return 0;
  47. }
  48. luat_spi_t spi_config = {0};
  49. spi_config.bandrate = 2000000U;//luaL_optinteger(L, 1, 2000000U); // 2000000U
  50. spi_config.id = spi_id;
  51. spi_config.cs = 255; // 默认无
  52. spi_config.CPHA = 0; // CPHA0
  53. spi_config.CPOL = 0; // CPOL0
  54. spi_config.dataw = 8; // 8bit
  55. spi_config.bit_dict = 1; // MSB=1, LSB=0
  56. spi_config.master = 1; // master=1,slave=0
  57. spi_config.mode = 1; // FULL=1, half=0
  58. //LLOGD("setup GPIO for epd");
  59. // TODO 事实上无法配置
  60. luat_gpio_mode(luaL_optinteger(L, 3, Pin_BUSY), Luat_GPIO_INPUT, Luat_GPIO_PULLUP, Luat_GPIO_LOW);
  61. luat_gpio_mode(luaL_optinteger(L, 4, Pin_RES), Luat_GPIO_OUTPUT, Luat_GPIO_PULLUP, Luat_GPIO_LOW);
  62. luat_gpio_mode(luaL_optinteger(L, 5, Pin_DC), Luat_GPIO_OUTPUT, Luat_GPIO_PULLUP, Luat_GPIO_LOW);
  63. luat_gpio_mode(luaL_optinteger(L, 6, Pin_CS), Luat_GPIO_OUTPUT, Luat_GPIO_PULLUP, Luat_GPIO_LOW);
  64. //LLOGD("spi setup>>>");
  65. int status = luat_spi_setup(&spi_config);
  66. //LLOGD("spi setup<<<");
  67. //EPD_Model(MODEL_1in54f);
  68. //EPD_Model(MODEL_1in54_V2);
  69. // EPD_Model(MODEL_2in13b_V3);
  70. size_t epd_w = 0;
  71. size_t epd_h = 0;
  72. if(status == 0)
  73. {
  74. LLOGD("spi setup complete, now setup epd");
  75. if(num)
  76. status = EPD_Init(1, &epd_w, &epd_h);
  77. else
  78. status = EPD_Init(0, &epd_w, &epd_h);
  79. if (status != 0) {
  80. LLOGD("e-Paper init failed");
  81. return 0;
  82. }
  83. frame_buffer = (unsigned char*)luat_heap_malloc(epd_w * epd_h / 8);
  84. // Paint paint;
  85. Paint_Init(&paint, frame_buffer, epd_w, epd_h);
  86. Paint_Clear(&paint, UNCOLORED);
  87. }
  88. //LLOGD("epd init complete");
  89. lua_pushboolean(L, 1);
  90. return 1;
  91. }
  92. /**
  93. 清除绘图缓冲区
  94. @api eink.clear()
  95. @return nil 无返回值,不会马上刷新到设备
  96. */
  97. static int l_eink_clear(lua_State *L)
  98. {
  99. int colored = luaL_optinteger(L, 1, 1);
  100. Paint_Clear(&paint, colored);
  101. return 0;
  102. }
  103. /**
  104. 设置窗口
  105. @api eink.setWin(width, height, rotate)
  106. @int width 宽度
  107. @int height 高度
  108. @int rotate 显示方向,0/1/2/3, 相当于旋转0度/90度/180度/270度
  109. @return nil 无返回值
  110. */
  111. static int l_eink_setWin(lua_State *L)
  112. {
  113. int width = luaL_checkinteger(L, 1);
  114. int height = luaL_checkinteger(L, 2);
  115. int rotate = luaL_checkinteger(L, 3);
  116. Paint_SetWidth(&paint, width);
  117. Paint_SetHeight(&paint, height);
  118. Paint_SetRotate(&paint, rotate);
  119. return 0;
  120. }
  121. /**
  122. 获取窗口信息
  123. @api eink.getWin()
  124. @return int width 宽
  125. @return int height 高
  126. @return int rotate 旋转方向
  127. */
  128. static int l_eink_getWin(lua_State *L)
  129. {
  130. int width = Paint_GetWidth(&paint);
  131. int height = Paint_GetHeight(&paint);
  132. int rotate = Paint_GetRotate(&paint);
  133. lua_pushinteger(L, width);
  134. lua_pushinteger(L, height);
  135. lua_pushinteger(L, rotate);
  136. return 3;
  137. }
  138. /**
  139. 绘制字符串(仅ASCII)
  140. @api eink.print(x, y, str, colored, font)
  141. @int x坐标
  142. @int y坐标
  143. @string 字符串
  144. @int 默认是0
  145. @font 字体大小,默认12
  146. @return nil 无返回值
  147. */
  148. static int l_eink_print(lua_State *L)
  149. {
  150. size_t len;
  151. int x = luaL_checkinteger(L, 1);
  152. int y = luaL_checkinteger(L, 2);
  153. const char *str = luaL_checklstring(L, 3, &len);
  154. int colored = luaL_optinteger(L, 4, 0);
  155. int font = luaL_optinteger(L, 5, 12);
  156. switch (font)
  157. {
  158. case 8:
  159. Paint_DrawStringAt(&paint, x, y, str, &Font8, colored);
  160. break;
  161. case 12:
  162. Paint_DrawStringAt(&paint, x, y, str, &Font12, colored);
  163. break;
  164. case 16:
  165. Paint_DrawStringAt(&paint, x, y, str, &Font16, colored);
  166. break;
  167. case 20:
  168. Paint_DrawStringAt(&paint, x, y, str, &Font20, colored);
  169. break;
  170. case 24:
  171. Paint_DrawStringAt(&paint, x, y, str, &Font24, colored);
  172. break;
  173. default:
  174. break;
  175. }
  176. return 0;
  177. }
  178. // void u8g2_read_font_info(u8g2_font_info_t *font_info, const uint8_t *font);
  179. uint8_t luat_u8x8_gpio_and_delay(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
  180. const uint8_t *u8g2_font_get_glyph_data(u8g2_t *u8g2, uint16_t encoding);
  181. uint8_t * font_pix_find(uint16_t e, int font_pix_find);
  182. /**
  183. 绘制字符串,支持中文
  184. @api eink.printcn(x, y, str, colored, font)
  185. @int x坐标
  186. @int y坐标
  187. @string 字符串
  188. @int 默认是0
  189. @font 字体大小,默认12
  190. @return nil 无返回值
  191. */
  192. static int l_eink_printcn(lua_State *L)
  193. {
  194. size_t len;
  195. int x = luaL_checkinteger(L, 1);
  196. int y = luaL_checkinteger(L, 2);
  197. const char *str = luaL_checklstring(L, 3, &len);
  198. int colored = luaL_optinteger(L, 4, 0);
  199. int font_size = luaL_optinteger(L, 5, 12);
  200. //LLOGD("printcn font_size %d len %d", font_size, len);
  201. // 解码数据 TODO 使用无u8g2的方案
  202. u8g2_t *u8g2 = luat_heap_malloc(sizeof(u8g2_t));
  203. u8g2_Setup_ssd1306_i2c_128x64_noname_f( u8g2, U8G2_R0, u8x8_byte_sw_i2c, luat_u8x8_gpio_and_delay);
  204. u8g2_InitDisplay(u8g2);
  205. u8g2_SetPowerSave(u8g2, 0);
  206. u8g2->u8x8.next_cb = u8x8_utf8_next;
  207. uint16_t e;
  208. //u8g2_uint_t delta, sum;
  209. u8x8_utf8_init(u8g2_GetU8x8(u8g2));
  210. //sum = 0;
  211. uint8_t* str2 = (uint8_t*)str;
  212. for(;;)
  213. {
  214. e = u8g2->u8x8.next_cb(u8g2_GetU8x8(u8g2), (uint8_t)*str2);
  215. //LLOGD("chinese >> 0x%04X", e);
  216. if ( e == 0x0ffff )
  217. break;
  218. str2++;
  219. // if (e != 0x0fffe && e < 0x007e) {
  220. // char ch[2] = {e, 0};
  221. // if (font_size == 16)
  222. // Paint_DrawStringAt(&paint, x, y, ch, &Font16, colored);
  223. // else if (font_size == 24)
  224. // Paint_DrawStringAt(&paint, x, y, ch, &Font24, colored);
  225. // x += font_size;
  226. // }
  227. // else
  228. if ( e != 0x0fffe )
  229. {
  230. //delta = u8g2_DrawGlyph(u8g2, x, y, e);
  231. uint8_t * f = font_pix_find(e, font_size);
  232. if (f != NULL) {
  233. // 当前仅支持16p和24p
  234. int datalen = font_size == 16 ? 32 : 72;
  235. int xlen = font_size == 16 ? 2 : 3;
  236. //LLOGD("found FONT DATA 0x%04X datalen=%d xlen=%d", e, datalen, xlen);
  237. for (size_t i = 0; i < datalen; )
  238. {
  239. for (size_t k = 0; k < xlen; k++)
  240. {
  241. uint8_t pix = f[i];
  242. //LLOGD("pix data %02X x+j=%d y+j/2=%d", pix, x, y+i/2);
  243. for (size_t j = 0; j < 8; j++)
  244. {
  245. if ((pix >> (7-j)) & 0x01) {
  246. Paint_DrawPixel(&paint, x+j+k*8, y+i/xlen, colored);
  247. }
  248. }
  249. i++;
  250. }
  251. }
  252. }
  253. else {
  254. LLOGD("NOT found FONT DATA 0x%04X", e);
  255. }
  256. if (e <= 0x7E)
  257. x += font_size / 2;
  258. else
  259. {
  260. x += font_size;
  261. }
  262. }
  263. }
  264. luat_heap_free(u8g2);
  265. return 0;
  266. }
  267. /**
  268. 将缓冲区图像输出到屏幕
  269. @api eink.show(x, y)
  270. @int x 输出的x坐标,默认0
  271. @int y 输出的y坐标,默认0
  272. @return nil 无返回值
  273. */
  274. static int l_eink_show(lua_State *L)
  275. {
  276. int x = luaL_optinteger(L, 1, 0);
  277. int y = luaL_optinteger(L, 2, 0);
  278. /* Display the frame_buffer */
  279. //EPD_SetFrameMemory(&epd, frame_buffer, x, y, Paint_GetWidth(&paint), Paint_GetHeight(&paint));
  280. //EPD_DisplayFrame(&epd);
  281. EPD_Clear();
  282. EPD_Display(frame_buffer, NULL);
  283. return 0;
  284. }
  285. /**
  286. 缓冲区绘制线
  287. @api eink.line(x, y, x2, y2, colored)
  288. @int 起点x坐标
  289. @int 起点y坐标
  290. @int 终点x坐标
  291. @int 终点y坐标
  292. @return nil 无返回值
  293. @usage
  294. eink.line(0, 0, 10, 20, 0)
  295. */
  296. static int l_eink_line(lua_State *L)
  297. {
  298. int x = luaL_checkinteger(L, 1);
  299. int y = luaL_checkinteger(L, 2);
  300. int x2 = luaL_checkinteger(L, 3);
  301. int y2 = luaL_checkinteger(L, 4);
  302. int colored = luaL_optinteger(L, 5, 0);
  303. Paint_DrawLine(&paint, x, y, x2, y2, colored);
  304. return 0;
  305. }
  306. /**
  307. 缓冲区绘制矩形
  308. @api eink.rect(x, y, x2, y2, colored, fill)
  309. @int 左上顶点x坐标
  310. @int 左上顶点y坐标
  311. @int 右下顶点x坐标
  312. @int 右下顶点y坐标
  313. @int 默认是0
  314. @int 是否填充,默认是0,不填充
  315. @return nil 无返回值
  316. @usage
  317. eink.rect(0, 0, 10, 20)
  318. eink.rect(0, 0, 10, 20, 1) -- Filled
  319. */
  320. static int l_eink_rect(lua_State *L)
  321. {
  322. int x = luaL_checkinteger(L, 1);
  323. int y = luaL_checkinteger(L, 2);
  324. int x2 = luaL_checkinteger(L, 3);
  325. int y2 = luaL_checkinteger(L, 4);
  326. int colored = luaL_optinteger(L, 5, 0);
  327. int fill = luaL_optinteger(L, 6, 0);
  328. if(fill)
  329. Paint_DrawFilledRectangle(&paint, x, y, x2, y2, colored);
  330. else
  331. Paint_DrawRectangle(&paint, x, y, x2, y2, colored);
  332. return 0;
  333. }
  334. /**
  335. 缓冲区绘制圆形
  336. @api eink.circle(x, y, radius, colored, fill)
  337. @int 圆心x坐标
  338. @int 圆心y坐标
  339. @int 半径
  340. @int 默认是0
  341. @int 是否填充,默认是0,不填充
  342. @return nil 无返回值
  343. @usage
  344. eink.circle(0, 0, 10)
  345. eink.circle(0, 0, 10, 1, 1) -- Filled
  346. */
  347. static int l_eink_circle(lua_State *L)
  348. {
  349. int x = luaL_checkinteger(L, 1);
  350. int y = luaL_checkinteger(L, 2);
  351. int radius = luaL_checkinteger(L, 3);
  352. int colored = luaL_optinteger(L, 4, 0);
  353. int fill = luaL_optinteger(L, 5, 0);
  354. if(fill)
  355. Paint_DrawFilledCircle(&paint, x, y, radius, colored);
  356. else
  357. Paint_DrawCircle(&paint, x, y, radius, colored);
  358. return 0;
  359. }
  360. /**
  361. 缓冲区绘制QRCode
  362. @api eink.qrcode(x, y, str, version)
  363. @int x坐标
  364. @int y坐标
  365. @string 二维码的内容
  366. @int 二维码版本号
  367. @return nil 无返回值
  368. */
  369. static int l_eink_qrcode(lua_State *L)
  370. {
  371. size_t len;
  372. int x = luaL_checkinteger(L, 1);
  373. int y = luaL_checkinteger(L, 2);
  374. const char* str = luaL_checklstring(L, 3, &len);
  375. int version = luaL_checkinteger(L, 4);
  376. // Create the QR code
  377. QRCode qrcode;
  378. uint8_t qrcodeData[qrcode_getBufferSize(version)];
  379. qrcode_initText(&qrcode, qrcodeData, version, 0, str);
  380. for(int i = 0; i < qrcode.size; i++)
  381. {
  382. for (int j = 0; j < qrcode.size; j++)
  383. {
  384. qrcode_getModule(&qrcode, j, i) ? Paint_DrawPixel(&paint, x+j, y+i, COLORED) : Paint_DrawPixel(&paint, x+j, y+i, UNCOLORED);
  385. }
  386. }
  387. return 0;
  388. }
  389. /**
  390. 缓冲区绘制电池
  391. @api eink.bat(x, y, bat)
  392. @int x坐标
  393. @int y坐标
  394. @int 电池电压,单位毫伏
  395. @return nil 无返回值
  396. */
  397. static int l_eink_bat(lua_State *L)
  398. {
  399. int x = luaL_checkinteger(L, 1);
  400. int y = luaL_checkinteger(L, 2);
  401. int bat = luaL_checkinteger(L, 3);
  402. int batnum = 0;
  403. // eink.rect(0, 3, 2, 6)
  404. // eink.rect(2, 0, 20, 9)
  405. // eink.rect(9, 1, 19, 8, 0, 1)
  406. if(bat < 4200 && bat > 4080)batnum = 100;
  407. if(bat < 4080 && bat > 4000)batnum = 90;
  408. if(bat < 4000 && bat > 3930)batnum = 80;
  409. if(bat < 3930 && bat > 3870)batnum = 70;
  410. if(bat < 3870 && bat > 3820)batnum = 60;
  411. if(bat < 3820 && bat > 3790)batnum = 50;
  412. if(bat < 3790 && bat > 3770)batnum = 40;
  413. if(bat < 3770 && bat > 3730)batnum = 30;
  414. if(bat < 3730 && bat > 3700)batnum = 20;
  415. if(bat < 3700 && bat > 3680)batnum = 15;
  416. if(bat < 3680 && bat > 3500)batnum = 10;
  417. if(bat < 3500 && bat > 2500)batnum = 5;
  418. batnum = 20 - (int)(batnum / 5) + 3;
  419. // w外框
  420. Paint_DrawRectangle(&paint, x+0, y+3, x+2, y+6, COLORED);
  421. Paint_DrawRectangle(&paint, x+2, y+0, x+23, y+9, COLORED);
  422. // 3 ~21 100 / 5
  423. Paint_DrawFilledRectangle(&paint, x+batnum, y+1, x+22, y+8, COLORED);
  424. return 0;
  425. }
  426. /**
  427. 缓冲区绘制天气图标
  428. @api eink.weather_icon(x, y, code)
  429. @int x坐标
  430. @int y坐标
  431. @int 天气代号
  432. @return nil 无返回值
  433. */
  434. static int l_eink_weather_icon(lua_State *L)
  435. {
  436. size_t len;
  437. int x = luaL_checkinteger(L, 1);
  438. int y = luaL_checkinteger(L, 2);
  439. int code = luaL_checkinteger(L, 3);
  440. const char* str = luaL_optlstring(L, 4, "nil", &len);
  441. const unsigned char * icon = gImage_999;
  442. if (strcmp(str, "xue") == 0)code = 401;
  443. if (strcmp(str, "lei") == 0)code = 302;
  444. if (strcmp(str, "shachen") == 0)code = 503;
  445. if (strcmp(str, "wu") == 0)code = 501;
  446. if (strcmp(str, "bingbao") == 0)code = 504;
  447. if (strcmp(str, "yun") == 0)code = 103;
  448. if (strcmp(str, "yu") == 0)code = 306;
  449. if (strcmp(str, "yin") == 0)code = 101;
  450. if (strcmp(str, "qing") == 0)code = 100;
  451. // xue、lei、shachen、wu、bingbao、yun、yu、yin、qing
  452. //if(code == 64)
  453. // for(int i = 0; i < 64; i++)
  454. // {
  455. // for (int j = 0; j < 8; j++)
  456. // {
  457. // for (int k = 0; k < 8; k++)
  458. // (gImage_103[i*8+j] << k )& 0x80 ? Paint_DrawPixel(&paint, x+j*8+k, y+i, COLORED) : Paint_DrawPixel(&paint, x+j*8+k, y+i, UNCOLORED);
  459. // }
  460. // }
  461. switch (code)
  462. {
  463. case 100:icon = gImage_100;break;
  464. case 101:icon = gImage_101;break;
  465. case 102:icon = gImage_102;break;
  466. case 103:icon = gImage_103;break;
  467. case 104:icon = gImage_104;break;
  468. case 200:icon = gImage_200;break;
  469. case 201:icon = gImage_201;break;
  470. case 205:icon = gImage_205;break;
  471. case 208:icon = gImage_208;break;
  472. case 301:icon = gImage_301;break;
  473. case 302:icon = gImage_302;break;
  474. case 303:icon = gImage_303;break;
  475. case 304:icon = gImage_304;break;
  476. case 305:icon = gImage_305;break;
  477. case 306:icon = gImage_306;break;
  478. case 307:icon = gImage_307;break;
  479. case 308:icon = gImage_308;break;
  480. case 309:icon = gImage_309;break;
  481. case 310:icon = gImage_310;break;
  482. case 311:icon = gImage_311;break;
  483. case 312:icon = gImage_312;break;
  484. case 313:icon = gImage_313;break;
  485. case 400:icon = gImage_400;break;
  486. case 401:icon = gImage_401;break;
  487. case 402:icon = gImage_402;break;
  488. case 403:icon = gImage_403;break;
  489. case 404:icon = gImage_404;break;
  490. case 405:icon = gImage_405;break;
  491. case 406:icon = gImage_406;break;
  492. case 407:icon = gImage_407;break;
  493. case 500:icon = gImage_500;break;
  494. case 501:icon = gImage_501;break;
  495. case 502:icon = gImage_502;break;
  496. case 503:icon = gImage_503;break;
  497. case 504:icon = gImage_504;break;
  498. case 507:icon = gImage_507;break;
  499. case 508:icon = gImage_508;break;
  500. case 900:icon = gImage_900;break;
  501. case 901:icon = gImage_901;break;
  502. case 999:icon = gImage_999;break;
  503. default:
  504. break;
  505. }
  506. for(int i = 0; i < 48; i++)
  507. {
  508. for (int j = 0; j < 6; j++)
  509. {
  510. for (int k = 0; k < 8; k++)
  511. (icon[i*6+j] << k )& 0x80 ? Paint_DrawPixel(&paint, x+j*8+k, y+i, COLORED) : Paint_DrawPixel(&paint, x+j*8+k, y+i, UNCOLORED);
  512. }
  513. }
  514. return 0;
  515. }
  516. /**
  517. 设置墨水屏驱动型号
  518. @api eink.model(m)
  519. @int 型号名称, 例如 eink.model(eink.MODEL_1in54_V2)
  520. @return nil 无返回值
  521. */
  522. static int l_eink_model(lua_State *L) {
  523. EPD_Model(luaL_checkinteger(L, 1));
  524. return 0;
  525. }
  526. #include "rotable.h"
  527. static const rotable_Reg reg_eink[] =
  528. {
  529. { "setup", l_eink_setup, 0},
  530. { "clear", l_eink_clear, 0},
  531. { "setWin", l_eink_setWin, 0},
  532. { "getWin", l_eink_getWin, 0},
  533. { "print", l_eink_print, 0},
  534. { "printcn", l_eink_printcn, 0},
  535. { "show", l_eink_show, 0},
  536. { "rect", l_eink_rect, 0},
  537. { "circle", l_eink_circle, 0},
  538. { "line", l_eink_line, 0},
  539. { "qrcode", l_eink_qrcode, 0},
  540. { "bat", l_eink_bat, 0},
  541. { "weather_icon", l_eink_weather_icon, 0},
  542. { "model", l_eink_model, 0},
  543. { "MODEL_1in02d", NULL, MODEL_1in02d},
  544. { "MODEL_1in54", NULL, MODEL_1in54},
  545. { "MODEL_1in54_V2", NULL, MODEL_1in54_V2},
  546. { "MODEL_1in54b", NULL, MODEL_1in54b},
  547. { "MODEL_1in54b_V2", NULL, MODEL_1in54b_V2},
  548. { "MODEL_1in54c", NULL, MODEL_1in54c},
  549. { "MODEL_1in54f", NULL, MODEL_1in54f},
  550. { "MODEL_2in54b_V3", NULL, MODEL_2in13b_V3},
  551. { "MODEL_2in7", NULL, MODEL_2in7},
  552. { "MODEL_2in7b", NULL, MODEL_2in7b},
  553. { "MODEL_2in9", NULL, MODEL_2in9},
  554. { "MODEL_2in9_V2", NULL, MODEL_2in9_V2},
  555. { "MODEL_2in9bc", NULL, MODEL_2in9bc},
  556. { "MODEL_2in9b_V3", NULL, MODEL_2in9b_V3},
  557. { "MODEL_2in9d", NULL, MODEL_2in9d},
  558. { "MODEL_2in9f", NULL, MODEL_2in9f},
  559. { NULL, NULL, 0}
  560. };
  561. LUAMOD_API int luaopen_eink( lua_State *L ){
  562. rotable_newlib(L, reg_eink);
  563. return 1;
  564. }