aboutsummaryrefslogtreecommitdiffstats
path: root/halext/drivers/gdispS6d1121/gdisp_lld.h
blob: f32b3e476a5ab01f335c3780799df223455c5a46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
    ChibiOS/RT - Copyright (C) 2012
                 Joel Bodenmann aka Tectu <joel@unormal.org>

    This file is part of ChibiOS-LCD-Driver.

    ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    ChibiOS-LCD-Driver is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/**
 * @file    templates/gdisp_lld.h
 * @brief   GDISP Graphic Driver subsystem low level driver header template.
 *
 * @addtogroup GDISP
 * @{
 */

#ifndef _GDISP_LLD_H
#define _GDISP_LLD_H

#if HAL_USE_GDISP || defined(__DOXYGEN__)

/*===========================================================================*/
/* Driver constants.                                                         */
/*===========================================================================*/

/*===========================================================================*/
/* Driver pre-compile time settings.                                         */
/*===========================================================================*/

/*===========================================================================*/
/* Derived constants and error checks.                                       */
/*===========================================================================*/

/*===========================================================================*/
/* Driver data structures and types.                                         */
/*===========================================================================*/

/**
 * @brief   Structure representing a GDISP driver.
 * @note    Implementations may extend this structure to contain more,
 *          architecture dependent, fields.
 */
struct GDISPDriver {
	/**
	 * @brief   Width of the screen.
	 * @note    Read-only.
	 */
	coord_t				Width;
	/**
	 * @brief   Height of the screen.
	 * @note    Read-only.
	 */
	coord_t				Height;
	/**
	 * @brief   Current orientation of the screen.
	 * @note    Read-only.
	 */
	gdisp_orientation_t	Orientation;
	/**
	 * @brief   Current power mode of the screen.
	 * @note    Read-only.
	 */
	gdisp_powermode_t	Powermode;
	
	#if defined(GDISP_DRIVER_EXT_FIELDS)
	GDISP_DRIVER_EXT_FIELDS
	#endif
	/* End of mandatory fields */
};

/*===========================================================================*/
/* Driver macros.                                                            */
/*===========================================================================*/

/*===========================================================================*/
/* External declarations.                                                    */
/*===========================================================================*/

#if !defined(__DOXYGEN__)
	extern GDISPDriver GDISP;
#endif

#ifdef __cplusplus
extern "C" {
#endif

	/* Core functions */
	void gdisp_lld_init(void);
	void gdisp_lld_setpowermode(gdisp_powermode_t powerMode);
	void gdisp_lld_setorientation(gdisp_orientation_t newOrientation);

	/* Some of these functions will be implemented in software by the high level driver
	   depending on the GDISP_HARDWARE_XXX macros defined in gdisp_lld_config.h.
	 */

	/* Drawing functions */
	void gdisp_lld_clear(color_t color);
	void gdisp_lld_drawpixel(coord_t x, coord_t y, color_t color);
	void gdisp_lld_drawline(coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color);
	void gdisp_lld_drawbox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color);
	void gdisp_lld_fillarea(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color);
	void gdisp_lld_blitarea(coord_t x, coord_t y, coord_t cx, coord_t cy, pixel_t *buffer);

	/* Circular Drawing Functions */
	#if GDISP_NEED_CIRCLE
	void gdisp_lld_drawcircle(coord_t x, coord_t y, coord_t radius, color_t color);
	void gdisp_lld_fillcircle(coord_t x, coord_t y, coord_t radius, color_t color);
	#endif

	#if GDISP_NEED_ELLIPSE
	void gdisp_lld_drawellipse(coord_t x, coord_t y, coord_t a, coord_t b, color_t color);
	void gdisp_lld_fillellipse(coord_t x, coord_t y, coord_t a, coord_t b, color_t color);
	#endif

	/* Text Rendering Functions */
	#if GDISP_NEED_TEXT
	void gdisp_lld_drawchar(coord_t x, coord_t y, char c, font_t font, color_t color);
	void gdisp_lld_fillchar(coord_t x, coord_t y, char c, font_t font, color_t color, color_t bgcolor);
	#endif

	/* Pixel readback */
	#if GDISP_NEED_PIXELREAD
	color_t gdisp_lld_getpixelcolor(coord_t x, coord_t y);
	#endif

	/* Scrolling Function - clears the area scrolled out */
	#if GDISP_NEED_SCROLL
	void gdisp_lld_verticalscroll(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor);
	#endif

#ifdef __cplusplus
}
#endif

#endif	/* HAL_USE_GDISP */

#endif	/* _GDISP_LLD_H */
/** @} */