tm070rdh13.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) 2023 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #include "hpm_panel.h"
  8. static void reset(hpm_panel_t *panel)
  9. {
  10. if (!panel->hw_if.set_reset_pin_level)
  11. return;
  12. panel->hw_if.set_reset_pin_level(0);
  13. hpm_panel_delay_ms(20);
  14. panel->hw_if.set_reset_pin_level(1);
  15. hpm_panel_delay_ms(20);
  16. }
  17. static void init(hpm_panel_t *panel)
  18. {
  19. if (panel->hw_if.set_video_router)
  20. panel->hw_if.set_video_router();
  21. }
  22. static void power_on(hpm_panel_t *panel)
  23. {
  24. if (panel->state.power_state != HPM_PANEL_STATE_POWER_ON &&
  25. panel->hw_if.set_backlight) {
  26. if (panel->state.backlight_percent == 0)
  27. panel->state.backlight_percent = 100;
  28. panel->hw_if.set_backlight(panel->state.backlight_percent);
  29. panel->state.power_state = HPM_PANEL_STATE_POWER_ON;
  30. }
  31. }
  32. static void power_off(hpm_panel_t *panel)
  33. {
  34. if (panel->state.power_state != HPM_PANEL_STATE_POWER_OFF &&
  35. panel->hw_if.set_backlight) {
  36. panel->hw_if.set_backlight(0);
  37. panel->state.power_state = HPM_PANEL_STATE_POWER_OFF;
  38. }
  39. }
  40. hpm_panel_t panel_tm070rdh13 = {
  41. .name = "tm070rdh13",
  42. .if_type = HPM_PANEL_IF_TYPE_RGB,
  43. .timing = {
  44. .pixel_clock_khz = 60000,
  45. .hactive = 800,
  46. .hfront_porch = 50,
  47. .hback_porch = 36,
  48. .hsync_len = 10,
  49. .hsync_pol = 1,
  50. .vactive = 480,
  51. .vfront_porch = 10,
  52. .vback_porch = 20,
  53. .vsync_len = 3,
  54. .vsync_pol = 1,
  55. },
  56. .funcs = {
  57. .reset = reset,
  58. .init = init,
  59. .power_on = power_on,
  60. .power_off = power_off,
  61. },
  62. };