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