luat_lib_gtfont.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "luat_base.h"
  2. #include "luat_spi.h"
  3. #include "GT5SLCD2E_1A.h"
  4. #define LUAT_LOG_TAG "gt"
  5. #include "luat_log.h"
  6. extern luat_spi_device_t* gt_spi_dev;
  7. static int l_gtfont_init(lua_State* L) {
  8. if (gt_spi_dev == NULL) {
  9. gt_spi_dev = lua_touserdata(L, 1);
  10. }
  11. return 0;
  12. }
  13. static VECFONT_ST fst;
  14. static int l_gtfont_test(lua_State* L) {
  15. fst.fontCode = luaL_checkinteger(L, 1);
  16. fst.type = luaL_checkinteger(L, 2);
  17. fst.size = luaL_checkinteger(L, 3);
  18. fst.thick = luaL_checkinteger(L, 4);
  19. LLOGD("fontCode %04X type %02X size %02X thick %02X", fst.fontCode, fst.type, fst.size, fst.thick);
  20. int w = get_font_st(&fst);
  21. LLOGD("get_font_st ret %02X", w);
  22. // TODO 按位显示出来
  23. return 0;
  24. }
  25. #include "rotable.h"
  26. static const rotable_Reg reg_gtfont[] =
  27. {
  28. { "init" , l_gtfont_init , 0},
  29. { "test" , l_gtfont_test , 0},
  30. { NULL, NULL , 0}
  31. };
  32. LUAMOD_API int luaopen_gtfont( lua_State *L ) {
  33. luat_newlib(L, reg_gtfont);
  34. return 1;
  35. }