From 1f99d5c9fac79e3e9aa4ebff97b296b6dcb9c9a7 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 9 Nov 2013 19:18:59 +1000 Subject: [PATCH] Add support for a default application orientation. Also remove old unneeded GDISP_USE_CUSTOM_BOARD macro --- demos/3rdparty/tdisp_f4_discovery/gfxconf.h | 1 - demos/modules/gwin/widgets/gfxconf.h | 3 ++- gfxconf.example.h | 1 + include/gdisp/options.h | 14 +++++--------- src/gdisp/gdisp.c | 9 +++++++++ 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/demos/3rdparty/tdisp_f4_discovery/gfxconf.h b/demos/3rdparty/tdisp_f4_discovery/gfxconf.h index 42399ef5..c00e3941 100644 --- a/demos/3rdparty/tdisp_f4_discovery/gfxconf.h +++ b/demos/3rdparty/tdisp_f4_discovery/gfxconf.h @@ -136,7 +136,6 @@ /* Optional Low Level Driver Definitions */ /* - #define GDISP_USE_CUSTOM_BOARD FALSE #define GDISP_SCREEN_WIDTH 320 #define GDISP_SCREEN_HEIGHT 240 #define GDISP_USE_FSMC diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index 7899bfb8..111979e3 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -50,10 +50,11 @@ #define GDISP_NEED_TEXT TRUE #define GDISP_NEED_IMAGE TRUE #define GDISP_NEED_CONVEX_POLYGON TRUE +#define GDISP_NEED_CONTROL TRUE +#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE /* The following are optional depending on your hardware */ //#define GDISP_NEED_SCROLL TRUE -//#define GDISP_NEED_CONTROL TRUE /* GDISP fonts to include */ #define GDISP_INCLUDE_FONT_UI2 TRUE diff --git a/gfxconf.example.h b/gfxconf.example.h index 260d8bf6..6a7b0c68 100644 --- a/gfxconf.example.h +++ b/gfxconf.example.h @@ -171,6 +171,7 @@ /* Optional Parameters for various subsystems */ /* + #define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE #define GDISP_LINEBUF_SIZE 128 #define GEVENT_MAXIMUM_SIZE 32 #define GEVENT_MAX_SOURCE_LISTENERS 32 diff --git a/include/gdisp/options.h b/include/gdisp/options.h index 7796144c..650e81c5 100644 --- a/include/gdisp/options.h +++ b/include/gdisp/options.h @@ -346,14 +346,10 @@ * @{ */ /** - * @brief Use a custom board definition even if a board definition exists. - * @details Defaults to FALSE - * @details If TRUE, add gdisp_lld_board.h to your project directory and customise it. - * @note Not all GDISP low level drivers currently use board definition files. + * @brief Define the default orientation for all displays in the system. + * @note GDISP_NEED_CONTROL must also be set (and the hardware must support it) */ - #ifndef GDISP_USE_CUSTOM_BOARD - #define GDISP_USE_CUSTOM_BOARD FALSE - #endif + // #define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE /** * @brief Set the screen height and width. * @note Ignored by some low level GDISP drivers, optional for others. @@ -368,8 +364,8 @@ * @details Only required by the SSD1963 driver. * @note This will be replaced eventually by board definition files */ - /* #define GDISP_USE_FSMC */ - /* #define GDISP_USE_GPIO */ + // #define GDISP_USE_FSMC + // #define GDISP_USE_GPIO /** @} */ #endif /* _GDISP_OPTIONS_H */ diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index 7eade99c..6964bfff 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -587,6 +587,15 @@ void _gdispInit(void) { g->flags = 0; gdisp_lld_init(g); + #if defined(GDISP_DEFAULT_ORIENTATION) && GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL + g->p.x = GDISP_CONTROL_ORIENTATION; + g->p.ptr = GDISP_DEFAULT_ORIENTATION; + #if GDISP_HARDWARE_CONTROL == HARDWARE_AUTODETECT + if (g->vmt->control) + #endif + gdisp_lld_control(g); + #endif + // Set the initial clipping region #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP