Reduce minimum number of low level driver routines to 2

ugfx_release_2.6
Andrew Hannam 2012-07-31 15:24:15 +10:00
parent 256062859a
commit d7fc0795d5
7 changed files with 121 additions and 70 deletions

View File

@ -35,8 +35,8 @@
*/
/**
* @file templates/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source template.
* @file gdispNokia6100/gdisp_lld.c
* @brief GDISP Graphics Driver subsystem low level driver source for the Nokia6100 display.
*
* @addtogroup GDISP
* @{
@ -87,7 +87,7 @@
/* ---- Required Routines ---- */
/*
The following 4 routines are required.
The following 2 routines are required.
All other routines are optional.
*/
@ -107,37 +107,6 @@ void gdisp_lld_init(void) {
/* Code here */
}
/**
* @brief Sets the power mode for the graphic device.
* @note The power modes are powerOn, powerSleep and powerOff.
* If powerSleep is not supported it is equivelent to powerOn.
*
* @param[in] powerMode The new power mode
*
* @notapi
*/
void gdisp_lld_setpowermode(gdisp_powermode_t powerMode) {
/* Code here */
/* if successful
GDISP1.Powermode = powerMode;
*/
}
/**
* @brief Sets the orientation of the display.
* @note This may be ignored if not supported by the device.
*
* @param[in] newOrientation The new orientation
*
* @notapi
*/
void gdisp_lld_setorientation(gdisp_orientation_t newOrientation) {
/* Code here */
/* if successful
GDISP1.Orientation = newOrientation;
*/
}
/**
* @brief Draws a pixel on the display.
*
@ -171,6 +140,41 @@ void gdisp_lld_drawpixel(coord_t x, coord_t y, color_t color) {
gdisp_lld_fillarea() and gdisp_lld_blitarea().
*/
#if GDISP_HARDWARE_POWERCONTROL || defined(__DOXYGEN__)
/**
* @brief Sets the power mode for the graphic device.
* @note The power modes are powerOn, powerSleep and powerOff.
* If powerSleep is not supported it is equivelent to powerOn.
*
* @param[in] powerMode The new power mode
*
* @notapi
*/
void gdisp_lld_setpowermode(gdisp_powermode_t powerMode) {
/* Code here */
/* if successful
GDISP1.Powermode = powerMode;
*/
}
#endif
#if GDISP_HARDWARE_ORIENTATION || defined(__DOXYGEN__)
/**
* @brief Sets the orientation of the display.
* @note This may be ignored if not supported by the device.
*
* @param[in] newOrientation The new orientation
*
* @notapi
*/
void gdisp_lld_setorientation(gdisp_orientation_t newOrientation) {
/* Code here */
/* if successful
GDISP1.Orientation = newOrientation;
*/
}
#endif
#if GDISP_HARDWARE_CLEARS || defined(__DOXYGEN__)
/**
* @brief Clear the display.

View File

@ -35,8 +35,8 @@
*/
/**
* @file templates/gdisp_lld.h
* @brief GDISP Graphic Driver subsystem low level driver header template.
* @file gdispNokia6100/gdisp_lld.h
* @brief GDISP Graphic Driver subsystem low level driver header for the Nokia6100 display.
*
* @addtogroup GDISP
* @{

View File

@ -35,8 +35,8 @@
*/
/**
* @file templates/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header template.
* @file gdispNokia6100/gdisp_lld_config.h
* @brief GDISP Graphic Driver subsystem low level driver header for the Nokia6100 display.
*
* @addtogroup GDISP
* @{
@ -55,6 +55,18 @@
* @name GDISP hardware accelerated support
* @{
*/
/**
* @brief Hardware supports changing the orientation.
* @details If set to @p FALSE a software stubb is provided.
*/
#define GDISP_HARDWARE_ORIENTATION FALSE
/**
* @brief Hardware supports power control.
* @details If set to @p FALSE a software stubb is provided.
*/
#define GDISP_HARDWARE_POWERCONTROL FALSE
/**
* @brief Hardware accelerated line drawing.
* @details If set to @p FALSE software emulation is used.

View File

@ -0,0 +1,9 @@
The new GDISP driver is an architecture independant rewrite of the GLCD interface. This new architecture independance should allow many new low level drivers to be easily added.
GDISP allows low-level driver hardware accelerated drawing routines while providing a software emulation if the low level driver can not provide it. A basic low level driver now only requires 2 routines to be written.
A glcd.h compatability file has been included that allow applications written to use the existing GLCD driver to use the GDISP driver with little or no change.
It is written in the ChibiOS style with ChibiOS style includes and documentation.
It is encapsulated into a "halext" structure with appropriate readme's that allow for easy inclusion in any ChibiOS project. This structure can be seamlessly added to as new driver types are added and it supports low level drivers that are neither platform or board specific (although they can be).

View File

@ -45,6 +45,16 @@
required - it will do it.
*/
#if !GDISP_HARDWARE_POWERCONTROL
void gdisp_lld_setpowermode(gdisp_powermode_t UNUSED(powerMode)) {
}
#endif
#if !GDISP_HARDWARE_ORIENTATION
void gdisp_lld_setorientation(gdisp_orientation_t UNUSED(newOrientation)) {
}
#endif
#if !GDISP_HARDWARE_CLEARS
void gdisp_lld_clear(color_t color) {
gdisp_lld_fillarea(0, 0, GDISP1.Width, GDISP1.Height, color);

View File

@ -87,7 +87,7 @@
/* ---- Required Routines ---- */
/*
The following 4 routines are required.
The following 2 routines are required.
All other routines are optional.
*/
@ -107,37 +107,6 @@ void gdisp_lld_init(void) {
/* Code here */
}
/**
* @brief Sets the power mode for the graphic device.
* @note The power modes are powerOn, powerSleep and powerOff.
* If powerSleep is not supported it is equivelent to powerOn.
*
* @param[in] powerMode The new power mode
*
* @notapi
*/
void gdisp_lld_setpowermode(gdisp_powermode_t powerMode) {
/* Code here */
/* if successful
GDISP1.Powermode = powerMode;
*/
}
/**
* @brief Sets the orientation of the display.
* @note This may be ignored if not supported by the device.
*
* @param[in] newOrientation The new orientation
*
* @notapi
*/
void gdisp_lld_setorientation(gdisp_orientation_t newOrientation) {
/* Code here */
/* if successful
GDISP1.Orientation = newOrientation;
*/
}
/**
* @brief Draws a pixel on the display.
*
@ -171,6 +140,41 @@ void gdisp_lld_drawpixel(coord_t x, coord_t y, color_t color) {
gdisp_lld_fillarea() and gdisp_lld_blitarea().
*/
#if GDISP_HARDWARE_POWERCONTROL || defined(__DOXYGEN__)
/**
* @brief Sets the power mode for the graphic device.
* @note The power modes are powerOn, powerSleep and powerOff.
* If powerSleep is not supported it is equivelent to powerOn.
*
* @param[in] powerMode The new power mode
*
* @notapi
*/
void gdisp_lld_setpowermode(gdisp_powermode_t powerMode) {
/* Code here */
/* if successful
GDISP1.Powermode = powerMode;
*/
}
#endif
#if GDISP_HARDWARE_ORIENTATION || defined(__DOXYGEN__)
/**
* @brief Sets the orientation of the display.
* @note This may be ignored if not supported by the device.
*
* @param[in] newOrientation The new orientation
*
* @notapi
*/
void gdisp_lld_setorientation(gdisp_orientation_t newOrientation) {
/* Code here */
/* if successful
GDISP1.Orientation = newOrientation;
*/
}
#endif
#if GDISP_HARDWARE_CLEARS || defined(__DOXYGEN__)
/**
* @brief Clear the display.

View File

@ -55,6 +55,18 @@
* @name GDISP hardware accelerated support
* @{
*/
/**
* @brief Hardware supports changing the orientation.
* @details If set to @p FALSE a software stubb is provided.
*/
#define GDISP_HARDWARE_ORIENTATION FALSE
/**
* @brief Hardware supports power control.
* @details If set to @p FALSE a software stubb is provided.
*/
#define GDISP_HARDWARE_POWERCONTROL FALSE
/**
* @brief Hardware accelerated line drawing.
* @details If set to @p FALSE software emulation is used.