luat_lcd_jd9261t.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "luat_base.h"
  2. #include "luat_lcd.h"
  3. #include "luat_gpio.h"
  4. #include "luat_mem.h"
  5. #include "luat_rtos.h"
  6. #define LUAT_LOG_TAG "jd9261t"
  7. #include "luat_log.h"
  8. static int jd9261t_inited_init(luat_lcd_conf_t* conf)
  9. {
  10. luat_lcd_qspi_conf_t auto_flush =
  11. {
  12. .write_4line_cmd = 0xde,
  13. .vsync_reg = 0x61,
  14. .hsync_cmd = 0xde,
  15. .hsync_reg = 0x60,
  16. .write_1line_cmd = 0xde,
  17. };
  18. uint8_t temp = 0x0b;
  19. luat_gpio_set(conf->pin_rst, Luat_GPIO_LOW);
  20. luat_rtos_task_sleep(10);
  21. luat_gpio_set(conf->pin_rst, Luat_GPIO_HIGH);
  22. luat_rtos_task_sleep(150);
  23. luat_lcd_qspi_config(conf, &auto_flush); //必须在第一个命令发送前就准备好
  24. lcd_write_cmd_data(conf,0x36, &temp, 1);
  25. luat_rtos_task_sleep(5);
  26. if (!conf->buff)
  27. {
  28. conf->buff = luat_heap_opt_zalloc(LUAT_HEAP_AUTO, conf->w * conf->h * ((conf->bpp <= 16)?2:4));
  29. conf->flush_y_min = conf->h;
  30. conf->flush_y_max = 0;
  31. }
  32. luat_lcd_qspi_auto_flush_on_off(conf, 1);
  33. luat_gpio_set(conf->pin_pwr, Luat_GPIO_HIGH);
  34. return 0;
  35. }
  36. luat_lcd_opts_t lcd_opts_jd9261t_inited = {
  37. .name = "jd9261t_inited",
  38. .init_cmds_len = 0,
  39. .init_cmds = NULL,
  40. .direction0 = 0x03,
  41. .direction90 = 0x03,
  42. .direction180 = 0x03,
  43. .direction270 = 0x03,
  44. .rb_swap = 1,
  45. .no_ram_mode = 1,
  46. .user_ctrl_init = jd9261t_inited_init,
  47. };