Removed some hardware dependancies in HL drivers

Removed some hardware dependancies in high level drivers that had crept
in over time.
ugfx_release_2.6
Andrew Hannam 2012-11-10 15:11:39 +10:00
parent 0eeb2a2b8f
commit c069817f0c
4 changed files with 25 additions and 26 deletions

View File

@ -293,6 +293,7 @@ void gdispDrawBox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color);
/* Now obsolete functions */
#define gdispBlitArea(x, y, cx, cy, buffer) gdispBlitAreaEx(x, y, cx, cy, 0, 0, cx, buffer)
#define RGB565CONVERT(r,g,b) RGB2COLOR(r,g,b)
/* Macro definitions for common gets and sets */
#define gdispSetPowerMode(powerMode) gdispControl(GDISP_CONTROL_POWER, (void *)(unsigned)(powerMode))

View File

@ -468,8 +468,6 @@
#define RED_OF(c) (((c) & 0xF800)>>8)
#define GREEN_OF(c) (((c)&0x007E)>>3)
#define BLUE_OF(c) (((c)&0x001F)<<3)
#define RGB565CONVERT(red, green, blue) (uint16_t)( (( red >> 3 ) << 11 ) | (( green >> 2 ) << 5 ) | ( blue >> 3 ))
#elif GDISP_PIXELFORMAT == GDISP_PIXELFORMAT_RGB888
typedef uint32_t color_t;

View File

@ -66,7 +66,7 @@
/* Low Level Driver details and error checks. */
/*===========================================================================*/
#if !defined(GFX_USE_GDISP)
#if !defined(GFX_USE_GDISP) || !GFX_USE_GDISP
#error "GWIN: GFX_USE_GDISP must also be defined"
#endif
#include "gdisp.h"

View File

@ -85,22 +85,22 @@ static coord_t _tsReadRealY(void) {
}
static void _tsDrawCross(uint16_t x, uint16_t y) {
gdispDrawLine(x-15, y, x-2, y, 0xffff);
gdispDrawLine(x+2, y, x+15, y, 0xffff);
gdispDrawLine(x, y-15, x, y-2, 0xffff);
gdispDrawLine(x, y+2, x, y+15, 0xffff);
gdispDrawLine(x-15, y, x-2, y, White);
gdispDrawLine(x+2, y, x+15, y, White);
gdispDrawLine(x, y-15, x, y-2, White);
gdispDrawLine(x, y+2, x, y+15, White);
gdispDrawLine(x-15, y+15, x-7, y+15, RGB565CONVERT(184,158,131));
gdispDrawLine(x-15, y+7, x-15, y+15, RGB565CONVERT(184,158,131));
gdispDrawLine(x-15, y+15, x-7, y+15, RGB2COLOR(184,158,131));
gdispDrawLine(x-15, y+7, x-15, y+15, RGB2COLOR(184,158,131));
gdispDrawLine(x-15, y-15, x-7, y-15, RGB565CONVERT(184,158,131));
gdispDrawLine(x-15, y-7, x-15, y-15, RGB565CONVERT(184,158,131));
gdispDrawLine(x-15, y-15, x-7, y-15, RGB2COLOR(184,158,131));
gdispDrawLine(x-15, y-7, x-15, y-15, RGB2COLOR(184,158,131));
gdispDrawLine(x+7, y+15, x+15, y+15, RGB565CONVERT(184,158,131));
gdispDrawLine(x+15, y+7, x+15, y+15, RGB565CONVERT(184,158,131));
gdispDrawLine(x+7, y+15, x+15, y+15, RGB2COLOR(184,158,131));
gdispDrawLine(x+15, y+7, x+15, y+15, RGB2COLOR(184,158,131));
gdispDrawLine(x+7, y-15, x+15, y-15, RGB565CONVERT(184,158,131));
gdispDrawLine(x+15, y-15, x+15, y-7, RGB565CONVERT(184,158,131));
gdispDrawLine(x+7, y-15, x+15, y-15, RGB2COLOR(184,158,131));
gdispDrawLine(x+15, y-15, x+15, y-7, RGB2COLOR(184,158,131));
}
static void _tsTransform(coord_t *x, coord_t *y) {
@ -159,9 +159,6 @@ static void _tsDo3PointCalibration(const coord_t (*cross)[2], coord_t (*points)[
* @api
*/
void tsInit(const TouchscreenDriver *ts) {
cal = (struct cal_t*)chHeapAlloc(NULL, sizeof(struct cal_t));
if(cal == NULL)
return;
/* Initialise Mutex */
//MUTEX_INIT
@ -173,11 +170,14 @@ void tsInit(const TouchscreenDriver *ts) {
#if TOUCHSCREEN_STORE_CALIBRATION
cal = ts_restore_calibration_lld();
if(cal == NULL) {
cal = (struct cal_t*)chHeapAlloc(NULL, sizeof(struct cal_t));
tsCalibrate();
}
if(cal != NULL)
return; // All done
#endif
cal = (struct cal_t*)chHeapAlloc(NULL, sizeof(struct cal_t));
if(cal == NULL)
return;
tsCalibrate();
}
/**
@ -206,9 +206,9 @@ coord_t tsReadX(void) {
case GDISP_ROTATE_90:
return y;
case GDISP_ROTATE_180:
return GDISP_SCREEN_WIDTH - x - 1;
return gdispGetWidth() - x - 1;
case GDISP_ROTATE_270:
return GDISP_SCREEN_HEIGHT - y - 1;
return gdispGetHeight() - y - 1;
}
return 0;
@ -238,9 +238,9 @@ coord_t tsReadY(void) {
case GDISP_ROTATE_0:
return y;
case GDISP_ROTATE_90:
return GDISP_SCREEN_WIDTH - x - 1;
return gdispGetWidth() - x - 1;
case GDISP_ROTATE_180:
return GDISP_SCREEN_HEIGHT - y - 1;
return gdispGetHeight() - y - 1;
case GDISP_ROTATE_270:
return x;
}