1 /*
2  * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "esp_check.h"
8 #include "esp_lcd_panel_ops.h"
9 #include "esp_lcd_panel_interface.h"
10 
11 static const char *TAG = "lcd_panel";
12 
esp_lcd_panel_reset(esp_lcd_panel_handle_t panel)13 esp_err_t esp_lcd_panel_reset(esp_lcd_panel_handle_t panel)
14 {
15     ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle");
16     return panel->reset(panel);
17 }
18 
esp_lcd_panel_init(esp_lcd_panel_handle_t panel)19 esp_err_t esp_lcd_panel_init(esp_lcd_panel_handle_t panel)
20 {
21     ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle");
22     return panel->init(panel);
23 }
24 
esp_lcd_panel_del(esp_lcd_panel_handle_t panel)25 esp_err_t esp_lcd_panel_del(esp_lcd_panel_handle_t panel)
26 {
27     ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle");
28     return panel->del(panel);
29 }
30 
esp_lcd_panel_draw_bitmap(esp_lcd_panel_handle_t panel,int x_start,int y_start,int x_end,int y_end,const void * color_data)31 esp_err_t esp_lcd_panel_draw_bitmap(esp_lcd_panel_handle_t panel, int x_start, int y_start, int x_end, int y_end, const void *color_data)
32 {
33     ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle");
34     return panel->draw_bitmap(panel, x_start, y_start, x_end, y_end, color_data);
35 }
36 
esp_lcd_panel_mirror(esp_lcd_panel_handle_t panel,bool mirror_x,bool mirror_y)37 esp_err_t esp_lcd_panel_mirror(esp_lcd_panel_handle_t panel, bool mirror_x, bool mirror_y)
38 {
39     ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle");
40     return panel->mirror(panel, mirror_x, mirror_y);
41 }
42 
esp_lcd_panel_swap_xy(esp_lcd_panel_handle_t panel,bool swap_axes)43 esp_err_t esp_lcd_panel_swap_xy(esp_lcd_panel_handle_t panel, bool swap_axes)
44 {
45     ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle");
46     return panel->swap_xy(panel, swap_axes);
47 }
48 
esp_lcd_panel_set_gap(esp_lcd_panel_handle_t panel,int x_gap,int y_gap)49 esp_err_t esp_lcd_panel_set_gap(esp_lcd_panel_handle_t panel, int x_gap, int y_gap)
50 {
51     ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle");
52     return panel->set_gap(panel, x_gap, y_gap);
53 }
54 
esp_lcd_panel_invert_color(esp_lcd_panel_handle_t panel,bool invert_color_data)55 esp_err_t esp_lcd_panel_invert_color(esp_lcd_panel_handle_t panel, bool invert_color_data)
56 {
57     ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle");
58     return panel->invert_color(panel, invert_color_data);
59 }
60 
esp_lcd_panel_disp_off(esp_lcd_panel_handle_t panel,bool off)61 esp_err_t esp_lcd_panel_disp_off(esp_lcd_panel_handle_t panel, bool off)
62 {
63     ESP_RETURN_ON_FALSE(panel, ESP_ERR_INVALID_ARG, TAG, "invalid panel handle");
64     return panel->disp_off(panel, off);
65 }
66