#ifndef PAPER_H_ #define PAPER_H_ #include #include #include #include "departure_mono_11.h" #include "departure_mono_22.h" #define WAVEFORM EPD_BUILTIN_WAVEFORM EpdiyHighlevelState hl; uint8_t* fb; static int init (lua_State *L) { epd_init(&epd_board_lilygo_t5_47, &ED097TC2, EPD_LUT_64K); // epd_set_vcom(1560); hl = epd_hl_init(WAVEFORM); epd_set_rotation(EPD_ROT_LANDSCAPE); fb = epd_hl_get_framebuffer(&hl); return 0; } static int clear (lua_State *L){ epd_clear(); return 0; } static int get_width (lua_State *L) { int width = epd_rotated_display_width(); lua_pushnumber(L, width); return 1; } static int get_height (lua_State *L) { int height = epd_rotated_display_height(); lua_pushnumber(L, height); return 1; } static int draw_line (lua_State *L) { return 0; } static int update (lua_State *L) { int temperature = 25; epd_poweron(); epd_hl_update_screen(&hl, MODE_GC16, temperature); epd_poweroff(); return 0; } static const struct luaL_Reg paper[] = { {"init", init}, {"clear", clear}, {"get_width", get_width}, {"get_height", get_height}, {"draw_line", draw_line}, {"update", update}, {NULL, NULL}, }; int luaopen_paper (lua_State *L) { luaL_newlib(L, paper); return 1; } #endif // PAPER_H_