luat_lcd_sh8601z.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "luat_base.h"
  2. #include "luat_lcd.h"
  3. #include "luat_gpio.h"
  4. #include "luat_rtos.h"
  5. #define LUAT_LOG_TAG "sh8601z"
  6. #include "luat_log.h"
  7. static int sh8601z_inited_init(luat_lcd_conf_t* conf)
  8. {
  9. luat_lcd_qspi_conf_t auto_flush =
  10. {
  11. .write_4line_cmd = 0x32,
  12. .vsync_reg = 0,
  13. .hsync_cmd = 0,
  14. .hsync_reg = 0,
  15. .write_1line_cmd = 0x02,
  16. .write_4line_data = 0x12,
  17. };
  18. luat_lcd_qspi_config(conf, &auto_flush); //必须在第一个命令发送前就准备好
  19. luat_gpio_set(conf->pin_rst, Luat_GPIO_LOW);
  20. luat_rtos_task_sleep(20);
  21. luat_gpio_set(conf->pin_rst, Luat_GPIO_HIGH);
  22. luat_rtos_task_sleep(50);
  23. luat_lcd_wakeup(conf);
  24. luat_rtos_task_sleep(100);
  25. uint8_t temp = 0x55;
  26. lcd_write_cmd_data(conf,0x3A, &temp, 1);
  27. temp = 0x20;
  28. lcd_write_cmd_data(conf,0x53, &temp, 1);
  29. temp = 0xff;
  30. lcd_write_cmd_data(conf,0x51, &temp, 1);
  31. // temp = 0x00;
  32. // lcd_write_cmd_data(conf,0x36, &temp, 1);
  33. // luat_lcd_clear(conf,LCD_BLACK);
  34. luat_lcd_display_on(conf);
  35. return 0;
  36. }
  37. luat_lcd_opts_t lcd_opts_sh8601z = {
  38. .name = "sh8601z",
  39. .init_cmds_len = 0,
  40. .init_cmds = NULL,
  41. .direction0 = 0x00,
  42. .direction90 = 0x00,
  43. .direction180 = 0x40,
  44. .direction270 = 0x40,
  45. .rb_swap = 1,
  46. .user_ctrl_init = sh8601z_inited_init,
  47. };