Added ssd1289 low level driver to GDISP
Untested as I don't have the hardware. Back-ported from GLCD.
This commit is contained in:
parent
d7fc0795d5
commit
9ac85166b2
6 changed files with 1369 additions and 0 deletions
834
halext/drivers/gdispSsd1289/gdisp_lld.c
Normal file
834
halext/drivers/gdispSsd1289/gdisp_lld.c
Normal file
|
@ -0,0 +1,834 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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/RT 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/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
/*
|
||||
Concepts and parts of this file have been contributed by:
|
||||
Joel Bodenmann aka Tectu -> Maintainer
|
||||
Andrew Hannam aka inmarket -> framework
|
||||
Badger -> console implementation and FSMC
|
||||
Abhishek -> font rendering
|
||||
Ben William -> fastMath and lcdDrawEllipse()
|
||||
Dongxu Li aka dxli -> lcdDrawEllipse() filled option
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file gdispSsd1289/gdisp_lld.c
|
||||
* @brief GDISP Graphics Driver subsystem low level driver source for the Ssd1289 display.
|
||||
*
|
||||
* @addtogroup GDISP
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
#include "gdisp.h"
|
||||
#include "ssd1289_lld.h"
|
||||
|
||||
#if HAL_USE_GDISP || defined(__DOXYGEN__)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef UNUSED
|
||||
#elif defined(__GNUC__)
|
||||
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
|
||||
#elif defined(__LCLINT__)
|
||||
# define UNUSED(x) /*@unused@*/ x
|
||||
#else
|
||||
# define UNUSED(x) x
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if !defined(__DOXYGEN__)
|
||||
GDISPDriver GDISP1;
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef LCD_USE_GPIO
|
||||
static __inline void lld_lcdWriteIndex(uint16_t index) {
|
||||
Clr_RS;
|
||||
Set_RD;
|
||||
|
||||
lld_lcdWriteGPIO(index);
|
||||
|
||||
Clr_WR;
|
||||
Set_WR;
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteData(uint16_t data) {
|
||||
Set_RS;
|
||||
|
||||
lld_lcdWriteGPIO(data);
|
||||
|
||||
Clr_WR;
|
||||
Set_WR;
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteReg(uint16_t lcdReg,uint16_t lcdRegValue) {
|
||||
Clr_CS;
|
||||
|
||||
lld_lcdWriteIndex(lcdReg);
|
||||
lld_lcdWriteData(lcdRegValue);
|
||||
|
||||
Set_CS;
|
||||
}
|
||||
|
||||
static __inline uint16_t lld_lcdReadData(void) {
|
||||
uint16_t value;
|
||||
|
||||
Set_RS;
|
||||
Set_WR;
|
||||
Clr_RD;
|
||||
|
||||
value = lld_lcdReadGPIO();
|
||||
|
||||
Set_RD;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static __inline uint16_t lld_lcdReadReg(uint16_t lcdReg) {
|
||||
uint16_t lcdRAM;
|
||||
|
||||
Clr_CS;
|
||||
lld_lcdWriteIndex(lcdReg);
|
||||
lcdRAM = lld_lcdReadData();
|
||||
|
||||
Set_CS;
|
||||
|
||||
return lcdRAM;
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteStreamStart(void) {
|
||||
Clr_CS;
|
||||
|
||||
lld_lcdWriteIndex(0x0022);
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteStreamStop(void) {
|
||||
Set_CS;
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) {
|
||||
uint16_t i;
|
||||
|
||||
Set_RS;
|
||||
|
||||
for(i = 0; i < size; i++) {
|
||||
lld_lcdWriteGPIO(buffer[i]);
|
||||
Clr_WR;
|
||||
Set_WR;
|
||||
}
|
||||
}
|
||||
|
||||
static __inline void lld_lcdReadStreamStart(void) {
|
||||
Clr_CS
|
||||
|
||||
lld_lcdWriteIndex(0x0022);
|
||||
}
|
||||
|
||||
static __inline void lld_lcdReadStreamStop(void) {
|
||||
Set_CS;
|
||||
}
|
||||
|
||||
static __inline void lld_lcdReadStream(uint16_t *buffer, size_t size) {
|
||||
uint16_t i;
|
||||
volatile uint16_t dummy;
|
||||
|
||||
dummy = lld_lcdReadData();
|
||||
for(i = 0; i < size; i++)
|
||||
buffer[i] = lld_lcdReadData();
|
||||
}
|
||||
#endif // LCD_USE_GPIO
|
||||
|
||||
#ifdef LCD_USE_SPI
|
||||
/* TODO */
|
||||
#endif // LCD_USE_SPI
|
||||
|
||||
#ifdef LCD_USE_FSMC
|
||||
#define LCD_REG (*((volatile uint16_t *) 0x60000000)) /* RS = 0 */
|
||||
#define LCD_RAM (*((volatile uint16_t *) 0x60020000)) /* RS = 1 */
|
||||
|
||||
static __inline void lld_lcdWriteIndex(uint16_t index) {
|
||||
LCD_REG = index;
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteData(uint16_t data) {
|
||||
LCD_RAM = data;
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteReg(uint16_t lcdReg,uint16_t lcdRegValue) {
|
||||
LCD_REG = lcdReg;
|
||||
LCD_RAM = lcdRegValue;
|
||||
}
|
||||
|
||||
static __inline uint16_t lld_lcdReadData(void) {
|
||||
return (LCD_RAM);
|
||||
}
|
||||
|
||||
static __inline uint16_t lld_lcdReadReg(uint16_t lcdReg) {
|
||||
LCD_REG = lcdReg;
|
||||
volatile uint16_t dummy = LCD_RAM;
|
||||
return (LCD_RAM);
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteStreamStart(void) {
|
||||
LCD_REG = 0x0022;
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteStreamStop(void) {
|
||||
|
||||
}
|
||||
|
||||
static __inline void lld_lcdWriteStream(uint16_t *buffer, uint16_t size) {
|
||||
uint16_t i;
|
||||
for(i = 0; i < size; i++)
|
||||
LCD_RAM = buffer[i];
|
||||
}
|
||||
|
||||
static __inline void lld_lcdReadStreamStart(void) {
|
||||
LCD_REG = 0x0022;
|
||||
}
|
||||
|
||||
static __inline void lld_lcdReadStreamStop(void) {
|
||||
|
||||
}
|
||||
|
||||
static __inline void lld_lcdReadStream(uint16_t *buffer, size_t size) {
|
||||
uint16_t i;
|
||||
/* throw away first value read */
|
||||
volatile uint16_t dummy = LCD_RAM;
|
||||
|
||||
for(i = 0; i < size; i++) {
|
||||
buffer[i] = LCD_RAM;
|
||||
}
|
||||
}
|
||||
#endif // LCD_USE_FSMC
|
||||
|
||||
static __inline void lld_lcdDelay(uint16_t us) {
|
||||
chThdSleepMicroseconds(us);
|
||||
}
|
||||
|
||||
static void lld_lcdSetCursor(uint16_t x, uint16_t y) {
|
||||
/* Reg 0x004E is an 8 bit value
|
||||
* Reg 0x004F is 9 bit
|
||||
* Use a bit mask to make sure they are not set too high
|
||||
*/
|
||||
switch(GDISP1.Orientation) {
|
||||
case portraitInv:
|
||||
lld_lcdWriteReg(0x004e, (SCREEN_WIDTH-1-x) & 0x00FF);
|
||||
lld_lcdWriteReg(0x004f, (SCREEN_HEIGHT-1-y) & 0x01FF);
|
||||
break;
|
||||
case portrait:
|
||||
lld_lcdWriteReg(0x004e, x & 0x00FF);
|
||||
lld_lcdWriteReg(0x004f, y & 0x01FF);
|
||||
break;
|
||||
case landscape:
|
||||
lld_lcdWriteReg(0x004e, y & 0x00FF);
|
||||
lld_lcdWriteReg(0x004f, x & 0x01FF);
|
||||
break;
|
||||
case landscapeInv:
|
||||
lld_lcdWriteReg(0x004e, (SCREEN_WIDTH - y - 1) & 0x00FF);
|
||||
lld_lcdWriteReg(0x004f, (SCREEN_HEIGHT - x - 1) & 0x01FF);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) {
|
||||
lld_lcdSetCursor(x, y);
|
||||
|
||||
/* Reg 0x44 - Horizontal RAM address position
|
||||
* Upper Byte - HEA
|
||||
* Lower Byte - HSA
|
||||
* 0 <= HSA <= HEA <= 0xEF
|
||||
* Reg 0x45,0x46 - Vertical RAM address position
|
||||
* Lower 9 bits gives 0-511 range in each value
|
||||
* 0 <= Reg(0x45) <= Reg(0x46) <= 0x13F
|
||||
*/
|
||||
|
||||
switch(GDISP1.Orientation) {
|
||||
case portrait:
|
||||
lld_lcdWriteReg(0x44, (((x+cx-1) << 8) & 0xFF00 ) | (x & 0x00FF));
|
||||
lld_lcdWriteReg(0x45, y & 0x01FF);
|
||||
lld_lcdWriteReg(0x46, (y+cy-1) & 0x01FF);
|
||||
break;
|
||||
case landscape:
|
||||
lld_lcdWriteReg(0x44, (((x+cx-1) << 8) & 0xFF00) | ((y+cy) & 0x00FF));
|
||||
lld_lcdWriteReg(0x45, x & 0x01FF);
|
||||
lld_lcdWriteReg(0x46, (x+cx-1) & 0x01FF);
|
||||
break;
|
||||
case portraitInv:
|
||||
lld_lcdWriteReg(0x44, (((SCREEN_WIDTH-x-1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (x+cx)) & 0x00FF));
|
||||
lld_lcdWriteReg(0x45, (SCREEN_HEIGHT-(y+cy)) & 0x01FF);
|
||||
lld_lcdWriteReg(0x46, (SCREEN_HEIGHT-y-1) & 0x01FF);
|
||||
break;
|
||||
case landscapeInv:
|
||||
lld_lcdWriteReg(0x44, (((SCREEN_WIDTH - y - 1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (y+cy)) & 0x00FF));
|
||||
lld_lcdWriteReg(0x45, (SCREEN_HEIGHT - (x+cx)) & 0x01FF);
|
||||
lld_lcdWriteReg(0x46, (SCREEN_HEIGHT - x - 1) & 0x01FF);
|
||||
break;
|
||||
}
|
||||
|
||||
lld_lcdSetCursor(x, y);
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/* ---- Required Routines ---- */
|
||||
/*
|
||||
The following 2 routines are required.
|
||||
All other routines are optional.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Low level GDISP driver initialization.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_init(void) {
|
||||
uint16_t deviceCode;
|
||||
|
||||
#ifdef LCD_USE_FSMC
|
||||
/* FSMC setup. TODO: this only works for STM32F1 */
|
||||
rccEnableAHB(RCC_AHBENR_FSMCEN, 0);
|
||||
int FSMC_Bank = 0;
|
||||
/* timing structure */
|
||||
/* from datasheet:
|
||||
address setup: 0ns
|
||||
address hold: 0ns
|
||||
Data setup: 5ns
|
||||
Data hold: 5ns
|
||||
Data access: 250ns
|
||||
output hold: 100ns
|
||||
*/
|
||||
FSMC_Bank1->BTCR[FSMC_Bank+1] = FSMC_BTR1_ADDSET_1 | FSMC_BTR1_DATAST_1;
|
||||
|
||||
/* Bank1 NOR/SRAM control register configuration */
|
||||
FSMC_Bank1->BTCR[FSMC_Bank] = FSMC_BCR1_MWID_0 | FSMC_BCR1_WREN | FSMC_BCR1_MBKEN;
|
||||
#endif
|
||||
|
||||
deviceCode = lld_lcdReadReg(0x0000);
|
||||
|
||||
lld_lcdWriteReg(0x0000,0x0001); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0003,0xA8A4); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x000C,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x000D,0x080C); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x000E,0x2B00); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x001E,0x00B0); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0001,0x2B3F); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0002,0x0600); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0010,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0011,0x6070); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0005,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0006,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0016,0xEF1C); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0017,0x0003); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0007,0x0133); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x000B,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x000F,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0041,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0042,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0048,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0049,0x013F); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x004A,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x004B,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0044,0xEF00); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0045,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0046,0x013F); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0030,0x0707); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0031,0x0204); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0032,0x0204); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0033,0x0502); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0034,0x0507); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0035,0x0204); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0036,0x0204); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0037,0x0502); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x003A,0x0302); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x003B,0x0302); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0023,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0024,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x0025,0x8000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x004f,0x0000); lld_lcdDelay(5);
|
||||
lld_lcdWriteReg(0x004e,0x0000); lld_lcdDelay(5);
|
||||
|
||||
/* Initialise the GDISP structure */
|
||||
GDISP1.Width = SCREEN_WIDTH;
|
||||
GDISP1.Height = SCREEN_HEIGHT;
|
||||
GDISP1.Orientation = portrait;
|
||||
GDISP1.Powermode = powerOn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draws a pixel on the display.
|
||||
*
|
||||
* @param[in] x X location of the pixel
|
||||
* @param[in] y Y location of the pixel
|
||||
* @param[in] color The color of the pixel
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_drawpixel(coord_t x, coord_t y, color_t color) {
|
||||
#if GDISP_NEED_VALIDATION
|
||||
if (x >= GDISP1.Width || y >= GDISP1.Height) return;
|
||||
#endif
|
||||
lld_lcdSetCursor(x, y);
|
||||
lld_lcdWriteReg(0x0022, color);
|
||||
}
|
||||
|
||||
/* ---- Optional Routines ---- */
|
||||
/*
|
||||
All the below routines are optional.
|
||||
Defining them will increase speed but everything
|
||||
will work if they are not defined.
|
||||
If you are not using a routine - turn it off using
|
||||
the appropriate GDISP_HARDWARE_XXXX macro.
|
||||
Don't bother coding for obvious similar routines if
|
||||
there is no performance penalty as the emulation software
|
||||
makes a good job of using similar routines.
|
||||
eg. If gdisp_lld_fillarea() is defined there is little
|
||||
point in defining gdisp_lld_clear() unless the
|
||||
performance bonus is significant.
|
||||
For good performance it is suggested to implement
|
||||
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) {
|
||||
if (GDISP1.Powermode == powerMode)
|
||||
return;
|
||||
|
||||
switch(powerMode) {
|
||||
case powerOff:
|
||||
lld_lcdWriteReg(0x0010, 0x0000); // leave sleep mode
|
||||
lld_lcdWriteReg(0x0007, 0x0000); // halt operation
|
||||
lld_lcdWriteReg(0x0000, 0x0000); // turn off oszillator
|
||||
lld_lcdWriteReg(0x0010, 0x0001); // enter sleepmode
|
||||
break;
|
||||
case powerOn:
|
||||
lld_lcdWriteReg(0x0010, 0x0000); // leave sleep mode
|
||||
if (GDISP1.Powermode != powerSleep)
|
||||
gdisp_lld_init();
|
||||
break;
|
||||
case powerSleep:
|
||||
lld_lcdWriteReg(0x0010, 0x0001); // enter sleep mode
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
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) {
|
||||
if (GDISP1.Orientation == newOrientation)
|
||||
return;
|
||||
|
||||
switch(newOrientation) {
|
||||
case portrait:
|
||||
lld_lcdWriteReg(0x0001, 0x2B3F);
|
||||
/* ID = 11 AM = 0 */
|
||||
lld_lcdWriteReg(0x0011, 0x6070);
|
||||
GDISP1.Height = SCREEN_HEIGHT;
|
||||
GDISP1.Width = SCREEN_WIDTH;
|
||||
break;
|
||||
case landscape:
|
||||
lld_lcdWriteReg(0x0001, 0x293F);
|
||||
/* ID = 11 AM = 1 */
|
||||
lld_lcdWriteReg(0x0011, 0x6078);
|
||||
GDISP1.Height = SCREEN_WIDTH;
|
||||
GDISP1.Width = SCREEN_HEIGHT;
|
||||
break;
|
||||
case portraitInv:
|
||||
lld_lcdWriteReg(0x0001, 0x2B3F);
|
||||
/* ID = 01 AM = 0 */
|
||||
lld_lcdWriteReg(0x0011, 0x6040);
|
||||
GDISP1.Height = SCREEN_HEIGHT;
|
||||
GDISP1.Width = SCREEN_WIDTH;
|
||||
break;
|
||||
case landscapeInv:
|
||||
lld_lcdWriteReg(0x0001, 0x293F);
|
||||
/* ID = 01 AM = 1 */
|
||||
lld_lcdWriteReg(0x0011, 0x6048);
|
||||
GDISP1.Height = SCREEN_WIDTH;
|
||||
GDISP1.Width = SCREEN_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
GDISP1.Orientation = newOrientation;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_CLEARS || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Clear the display.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
*
|
||||
* @param[in] color The color of the pixel
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_clear(color_t color) {
|
||||
unsigned i = 0;
|
||||
|
||||
lld_lcdSetCursor(0, 0);
|
||||
lld_lcdWriteStreamStart();
|
||||
|
||||
for(i = 0; i < SCREEN_WIDTH * SCREEN_HEIGHT; i++)
|
||||
lld_lcdWriteData(color);
|
||||
|
||||
lld_lcdWriteStreamStop();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_LINES || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Draw a line.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
*
|
||||
* @param[in] x0, y0 The start of the line
|
||||
* @param[in] x1, y1 The end of the line
|
||||
* @param[in] color The color of the line
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_drawline(coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color) {
|
||||
/* NOT IMPLEMENTED */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_BOX || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Draw a box.
|
||||
* @pre The GDISP unit must be in powerOn or powerSleep mode.
|
||||
*
|
||||
* @param[in] x0,y0 The start position
|
||||
* @param[in] cx,cy The size of the box (outside dimensions)
|
||||
* @param[in] color The color to use
|
||||
* @param[in] filled Should the box should be filled
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_drawbox(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color) {
|
||||
/* NOT IMPLEMENTED */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_FILLS || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Fill an area with a color.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
*
|
||||
* @param[in] x, y The start filled area
|
||||
* @param[in] cx, cy The width and height to be filled
|
||||
* @param[in] color The color of the fill
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_fillarea(coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color) {
|
||||
#if GDISP_NEED_VALIDATION
|
||||
if (cx < 1 || cy < 1 || x >= GDISP1.Width || y >= GDISP1.Height) return;
|
||||
if (x+cx > GDISP1.Width) cx = GDISP1.Width - x;
|
||||
if (y+cy > GDISP1.Height) cy = GDISP1.Height - y;
|
||||
#endif
|
||||
|
||||
unsigned i, area;
|
||||
|
||||
area = cx*cy;
|
||||
lld_lcdSetViewPort(x, y, cx, cy);
|
||||
lld_lcdWriteStreamStart();
|
||||
for(i = 0; i < area; i++)
|
||||
lld_lcdWriteData(color);
|
||||
lld_lcdWriteStreamStop();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_BITFILLS || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Fill an area with a bitmap.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
*
|
||||
* @param[in] x, y The start filled area
|
||||
* @param[in] cx, cy The width and height to be filled
|
||||
* @param[in] buffer The pixels to use to fill the area.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_blitarea(coord_t x, coord_t y, coord_t cx, coord_t cy, pixel_t *buffer) {
|
||||
unsigned i, area;
|
||||
|
||||
#if GDISP_NEED_VALIDATION
|
||||
if (cx < 1 || cy < 1 || x >= GDISP1.Width || y >= GDISP1.Height) return;
|
||||
if (x+cx > GDISP1.Width) return;
|
||||
if (y+cy > GDISP1.Height) cy = GDISP1.Height - y;
|
||||
#endif
|
||||
|
||||
area = cx*cy;
|
||||
lld_lcdSetViewPort(x, y, cx, cy);
|
||||
lld_lcdWriteStreamStart();
|
||||
for(i = 0; i < area; i++)
|
||||
lld_lcdWriteData(*buffer++);
|
||||
lld_lcdWriteStreamStop();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Circular Drawing Functions */
|
||||
#if (GDISP_NEED_CIRCLE && GDISP_HARDWARE_CIRCLES) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Draw a circle.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
* @note If GDISP_NEED_CLIPPING is defined this routine MUST behave
|
||||
* correctly if the circle is over the edges of the screen.
|
||||
*
|
||||
* @param[in] x, y The centre of the circle
|
||||
* @param[in] radius The radius of the circle
|
||||
* @param[in] color The color of the circle
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_drawcircle(coord_t x, coord_t y, coord_t radius, color_t color) {
|
||||
/* NOT IMPLEMENTED */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (GDISP_NEED_CIRCLE && GDISP_HARDWARE_CIRCLEFILLS) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Create a filled circle.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
* @note If GDISP_NEED_CLIPPING is defined this routine MUST behave
|
||||
* correctly if the circle is over the edges of the screen.
|
||||
*
|
||||
* @param[in] x, y The centre of the circle
|
||||
* @param[in] radius The radius of the circle
|
||||
* @param[in] color The color of the circle
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_fillcircle(coord_t x, coord_t y, coord_t radius, color_t color) {
|
||||
/* NOT IMPLEMENTED */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (GDISP_NEED_ELLIPSE && GDISP_HARDWARE_ELLIPSES) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Draw an ellipse.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
* @note If GDISP_NEED_CLIPPING is defined this routine MUST behave
|
||||
* correctly if the ellipse is over the edges of the screen.
|
||||
*
|
||||
* @param[in] x, y The centre of the ellipse
|
||||
* @param[in] a, b The dimensions of the ellipse
|
||||
* @param[in] color The color of the ellipse
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_drawellipse(coord_t x, coord_t y, coord_t a, coord_t b, color_t color) {
|
||||
/* NOT IMPLEMENTED */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (GDISP_NEED_ELLIPSE && GDISP_HARDWARE_ELLIPSEFILLS) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Create a filled ellipse.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
* @note If GDISP_NEED_CLIPPING is defined this routine MUST behave
|
||||
* correctly if the ellipse is over the edges of the screen.
|
||||
*
|
||||
* @param[in] x, y The centre of the ellipse
|
||||
* @param[in] a, b The dimensions of the ellipse
|
||||
* @param[in] color The color of the ellipse
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_fillellipse(coord_t x, coord_t y, coord_t a, coord_t b, color_t color) {
|
||||
/* NOT IMPLEMENTED */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (GDISP_NEED_TEXT && GDISP_HARDWARE_TEXT) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Draw a character using a transparent background.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
*
|
||||
* @param[in] x, y The top-left corner of the text
|
||||
* @param[in] c The character to print
|
||||
* @param[in] color The color of the character
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_drawchar(coord_t x, coord_t y, char c, font_t font, color_t color) {
|
||||
/* NOT IMPLEMENTED */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (GDISP_NEED_TEXT && GDISP_HARDWARE_TEXTFILLS) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Draw a character using a filled background.
|
||||
* @note Optional - The high level driver can emulate using software.
|
||||
*
|
||||
* @param[in] x, y The top-left corner of the text
|
||||
* @param[in] c The character to print
|
||||
* @param[in] color The color of the character
|
||||
* @param[in] bgcolor The background color
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_fillchar(coord_t x, coord_t y, char c, font_t font, color_t color, color_t bgcolor) {
|
||||
/* NOT IMPLEMENTED */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (GDISP_NEED_PIXELREAD && GDISP_HARDWARE_PIXELREAD) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Get the color of a particular pixel.
|
||||
* @note Optional.
|
||||
* @note If x,y is off the screen, the result is undefined.
|
||||
*
|
||||
* @param[in] x, y The start of the text
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
color_t gdisp_lld_getpixelcolor(coord_t x, coord_t y) {
|
||||
color_t color;
|
||||
|
||||
#if GDISP_NEED_VALIDATION
|
||||
if (x >= GDISP1.Width || y >= GDISP1.Height) return 0;
|
||||
#endif
|
||||
|
||||
lld_lcdSetCursor(x, y);
|
||||
lld_lcdWriteStreamStart();
|
||||
|
||||
color = lld_lcdReadData();
|
||||
color = lld_lcdReadData();
|
||||
|
||||
lld_lcdWriteStreamStop();
|
||||
|
||||
return color;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (GDISP_NEED_SCROLL && GDISP_HARDWARE_SCROLL) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Scroll vertically a section of the screen.
|
||||
* @note Optional.
|
||||
* @note If x,y + cx,cy is off the screen, the result is undefined.
|
||||
* @note If lines is >= cy, it is equivelent to a area fill with bgcolor.
|
||||
*
|
||||
* @param[in] x, y The start of the area to be scrolled
|
||||
* @param[in] cx, cy The size of the area to be scrolled
|
||||
* @param[in] lines The number of lines to scroll (Can be positive or negative)
|
||||
* @param[in] bgcolor The color to fill the newly exposed area.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void gdisp_lld_verticalscroll(coord_t x, coord_t y, coord_t cx, coord_t cy, int lines, color_t bgcolor) {
|
||||
static color_t buf[((SCREEN_HEIGHT > SCREEN_WIDTH ) ? SCREEN_HEIGHT : SCREEN_WIDTH)];
|
||||
coord_t row0, row1;
|
||||
unsigned i, gap, abslines;
|
||||
|
||||
abslines = lines < 0 ? -lines : lines;
|
||||
|
||||
#if GDISP_NEED_VALIDATION
|
||||
if (cx < 1 || cy < 1 || x >= GDISP1.Width || y >= GDISP1.Height) return;
|
||||
if (x+cx > GDISP1.Width) cx = GDISP1.Width - x;
|
||||
if (y+cy > GDISP1.Height) cy = GDISP1.Height - y;
|
||||
#endif
|
||||
|
||||
if (!abslines) return;
|
||||
if (abslines >= cy) {
|
||||
abslines = cy;
|
||||
gap = 0;
|
||||
} else {
|
||||
gap = cy - abslines;
|
||||
for(i = 0; i < gap; i++) {
|
||||
if(lines > 0) {
|
||||
row0 = y + i + lines;
|
||||
row1 = y + i;
|
||||
} else {
|
||||
row0 = (y - i - 1) + lines;
|
||||
row1 = (y - i - 1);
|
||||
}
|
||||
|
||||
/* read row0 into the buffer and then write at row1*/
|
||||
lld_lcdSetViewPort(x, row0, cx, 1);
|
||||
lld_lcdReadStreamStart();
|
||||
lld_lcdReadStream(buf, cx);
|
||||
lld_lcdReadStreamStop();
|
||||
|
||||
lld_lcdSetViewPort(x, row1, cx, 1);
|
||||
lld_lcdWriteStreamStart();
|
||||
lld_lcdWriteStream(buf, cx);
|
||||
lld_lcdWriteStreamStop();
|
||||
}
|
||||
}
|
||||
|
||||
/* fill the remaining gap */
|
||||
lld_lcdSetViewPort(x, lines > 0 ? (y+gap) : y, cx, abslines);
|
||||
lld_lcdWriteStreamStart();
|
||||
gap = cx*abslines;
|
||||
for(i = 0; i < gap; i++) lld_lcdWriteData(color);
|
||||
lld_lcdWriteStreamStop();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAL_USE_GDISP */
|
||||
/** @} */
|
167
halext/drivers/gdispSsd1289/gdisp_lld.h
Normal file
167
halext/drivers/gdispSsd1289/gdisp_lld.h
Normal file
|
@ -0,0 +1,167 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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/RT 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/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
/*
|
||||
Concepts and parts of this file have been contributed by:
|
||||
Joel Bodenmann aka Tectu -> Maintainer
|
||||
Andrew Hannam aka inmarket -> framework
|
||||
Badger -> console implementation and FSMC
|
||||
Abhishek -> font rendering
|
||||
Ben William -> fastMath and lcdDrawEllipse()
|
||||
Dongxu Li aka dxli -> lcdDrawEllipse() filled option
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file gdispSsd1289/gdisp_lld.h
|
||||
* @brief GDISP Graphic Driver subsystem low level driver header for the Ssd1289 display.
|
||||
*
|
||||
* @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 GDISP1;
|
||||
#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 above.
|
||||
*/
|
||||
|
||||
/* 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 */
|
||||
/** @} */
|
5
halext/drivers/gdispSsd1289/gdisp_lld.mk
Normal file
5
halext/drivers/gdispSsd1289/gdisp_lld.mk
Normal file
|
@ -0,0 +1,5 @@
|
|||
# List the required driver.
|
||||
HALSRC += ${CHIBIOS}/os/halext/drivers/gdispSsd1289/gdisp_lld.c
|
||||
|
||||
# Required include directories
|
||||
HALINC += ${CHIBIOS}/os/halext/drivers/gdispSsd1289
|
224
halext/drivers/gdispSsd1289/gdisp_lld_config.h
Normal file
224
halext/drivers/gdispSsd1289/gdisp_lld_config.h
Normal file
|
@ -0,0 +1,224 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
|
||||
2011,2012 Giovanni Di Sirio.
|
||||
|
||||
This file is part of ChibiOS/RT.
|
||||
|
||||
ChibiOS/RT 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/RT 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/>.
|
||||
|
||||
---
|
||||
|
||||
A special exception to the GPL can be applied should you wish to distribute
|
||||
a combined work that includes ChibiOS/RT, without being obliged to provide
|
||||
the source code for any proprietary components. See the file exception.txt
|
||||
for full details of how and when the exception can be applied.
|
||||
*/
|
||||
/*
|
||||
Concepts and parts of this file have been contributed by:
|
||||
Joel Bodenmann aka Tectu -> Maintainer
|
||||
Andrew Hannam aka inmarket -> framework
|
||||
Badger -> console implementation and FSMC
|
||||
Abhishek -> font rendering
|
||||
Ben William -> fastMath and lcdDrawEllipse()
|
||||
Dongxu Li aka dxli -> lcdDrawEllipse() filled option
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file gdispSsd1289/gdisp_lld_config.h
|
||||
* @brief GDISP Graphic Driver subsystem low level driver header for the Ssd1289 display.
|
||||
*
|
||||
* @addtogroup GDISP
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_CONFIG_H
|
||||
#define _GDISP_LLD_CONFIG_H
|
||||
|
||||
#if HAL_USE_GDISP || defined(__DOXYGEN__)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @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 TRUE
|
||||
|
||||
/**
|
||||
* @brief Hardware supports power control.
|
||||
* @details If set to @p FALSE a software stubb is provided.
|
||||
*/
|
||||
#define GDISP_HARDWARE_POWERCONTROL TRUE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated line drawing.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_LINES FALSE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated box drawing.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_BOX FALSE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated screen clears.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_CLEARS TRUE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated rectangular fills.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_FILLS TRUE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated fills from an image.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_BITFILLS TRUE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated circles.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_CIRCLES FALSE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated filled circles.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_CIRCLEFILLS FALSE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated ellipses.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_ELLIPSES FALSE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated filled ellipses.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_ELLIPSEFILLS FALSE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated text drawing.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_TEXT FALSE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated text drawing with a filled background.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
*/
|
||||
#define GDISP_HARDWARE_TEXTFILLS FALSE
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated scrolling.
|
||||
* @details If set to @p FALSE there is no support for scrolling.
|
||||
*/
|
||||
#define GDISP_HARDWARE_SCROLL TRUE
|
||||
|
||||
/**
|
||||
* @brief Reading back of pixel values.
|
||||
* @details If set to @p FALSE there is no support for pixel read-back.
|
||||
*/
|
||||
#define GDISP_HARDWARE_PIXELREAD TRUE
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name GDISP software algorithm choices
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief For filled text drawing, use a background fill and then draw
|
||||
* the text instead of using a blit or direct pixel drawing.
|
||||
* @details If set to @p TRUE background fill and then text draw is used.
|
||||
* @note This is ignored if hardware accelerated text is supported.
|
||||
*/
|
||||
#define GDISP_SOFTWARE_TEXTFILLDRAW FALSE
|
||||
/**
|
||||
* @brief For filled text drawing, when using a bitmap blit
|
||||
* use a column by column buffer rather than a full character
|
||||
* buffer to save memory at a small performance cost.
|
||||
* @details If set to @p TRUE background fill one character column at a time.
|
||||
* @note This is ignored if software text using blit is not being used.
|
||||
*/
|
||||
#define GDISP_SOFTWARE_TEXTBLITCOLUMN FALSE
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name GDISP pixel format choices
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief The native pixel format for this device
|
||||
* @note One of the following should be defined:
|
||||
* GDISP_PIXELFORMAT_RGB565
|
||||
* GDISP_PIXELFORMAT_RGB888
|
||||
* GDISP_PIXELFORMAT_RGB444
|
||||
* GDISP_PIXELFORMAT_RGB332
|
||||
* GDISP_PIXELFORMAT_RGB666
|
||||
* GDISP_PIXELFORMAT_CUSTOM
|
||||
* @note If you define GDISP_PIXELFORMAT_CUSTOM you need to also define
|
||||
* color_t, RGB2COLOR(r,g,b), HTML2COLOR(h),
|
||||
* RED_OF(c), GREEN_OF(c), BLUE_OF(c),
|
||||
* COLOR(c) and MASKCOLOR.
|
||||
*/
|
||||
#define GDISP_PIXELFORMAT_RGB565
|
||||
|
||||
/**
|
||||
* @brief Do pixels require packing for a blit
|
||||
* @note Is only valid for a pixel format that doesn't fill it's datatype. ie formats:
|
||||
* GDISP_PIXELFORMAT_RGB888
|
||||
* GDISP_PIXELFORMAT_RGB444
|
||||
* GDISP_PIXELFORMAT_RGB666
|
||||
* GDISP_PIXELFORMAT_CUSTOM
|
||||
* @note If you use GDISP_PIXELFORMAT_CUSTOM and packed bit fills
|
||||
* you need to also define @P gdispPackPixels(buf,cx,x,y,c)
|
||||
* @note If you are using GDISP_HARDWARE_BITFILLS = FALSE then the pixel
|
||||
* format must not be a packed format as the software blit does
|
||||
* not support packed pixels
|
||||
* @note Very few cases should actually require packed pixels as the low
|
||||
* level driver can also pack on the fly as it is sending it
|
||||
* to the graphics device.
|
||||
*/
|
||||
#define GDISP_PACKED_PIXELS FALSE
|
||||
|
||||
/**
|
||||
* @brief Do lines of pixels require packing for a blit
|
||||
* @note Ignored if GDISP_PACKED_PIXELS is FALSE
|
||||
*/
|
||||
#define GDISP_PACKED_LINES FALSE
|
||||
|
||||
/**
|
||||
* @brief Do lines of pixels require packing for a blit
|
||||
* @note Ignored if GDISP_PACKED_PIXELS is FALSE
|
||||
*/
|
||||
#define GDISP_PACKED_LINES FALSE
|
||||
/** @} */
|
||||
|
||||
#endif /* HAL_USE_GDISP */
|
||||
|
||||
#endif /* _GDISP_LLD_CONFIG_H */
|
||||
/** @} */
|
8
halext/drivers/gdispSsd1289/readme.txt
Normal file
8
halext/drivers/gdispSsd1289/readme.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
To use this driver you need to define:
|
||||
One of:
|
||||
LCD_USE_GPIO
|
||||
LCD_USE_SPI - Not implemented yet
|
||||
LCD_USE_FSMC
|
||||
Need to define all of:
|
||||
SCREEN_WIDTH
|
||||
SCREEN_HEIGHT
|
131
halext/drivers/gdispSsd1289/ssd1289_lld.h
Normal file
131
halext/drivers/gdispSsd1289/ssd1289_lld.h
Normal file
|
@ -0,0 +1,131 @@
|
|||
#ifndef SSD1289_H
|
||||
#define SSD1289_H
|
||||
|
||||
#ifdef LCD_USE_GPIO
|
||||
#define Set_CS palSetPad(LCD_CMD_PORT, LCD_CS);
|
||||
#define Clr_CS palClearPad(LCD_CMD_PORT, LCD_CS);
|
||||
#define Set_RS palSetPad(LCD_CMD_PORT, LCD_RS);
|
||||
#define Clr_RS palClearPad(LCD_CMD_PORT, LCD_RS);
|
||||
#define Set_WR palSetPad(LCD_CMD_PORT, LCD_WR);
|
||||
#define Clr_WR palClearPad(LCD_CMD_PORT, LCD_WR);
|
||||
#define Set_RD palSetPad(LCD_CMD_PORT, LCD_RD);
|
||||
#define Clr_RD palClearPad(LCD_CMD_PORT, LCD_RD);
|
||||
#endif
|
||||
|
||||
#ifdef LCD_USE_SPI
|
||||
/* TODO */
|
||||
#endif
|
||||
|
||||
#ifdef LCD_USE_FSMC
|
||||
/* LCD Registers */
|
||||
#define R0 0x00
|
||||
#define R1 0x01
|
||||
#define R2 0x02
|
||||
#define R3 0x03
|
||||
#define R4 0x04
|
||||
#define R5 0x05
|
||||
#define R6 0x06
|
||||
#define R7 0x07
|
||||
#define R8 0x08
|
||||
#define R9 0x09
|
||||
#define R10 0x0A
|
||||
#define R12 0x0C
|
||||
#define R13 0x0D
|
||||
#define R14 0x0E
|
||||
#define R15 0x0F
|
||||
#define R16 0x10
|
||||
#define R17 0x11
|
||||
#define R18 0x12
|
||||
#define R19 0x13
|
||||
#define R20 0x14
|
||||
#define R21 0x15
|
||||
#define R22 0x16
|
||||
#define R23 0x17
|
||||
#define R24 0x18
|
||||
#define R25 0x19
|
||||
#define R26 0x1A
|
||||
#define R27 0x1B
|
||||
#define R28 0x1C
|
||||
#define R29 0x1D
|
||||
#define R30 0x1E
|
||||
#define R31 0x1F
|
||||
#define R32 0x20
|
||||
#define R33 0x21
|
||||
#define R34 0x22
|
||||
#define R36 0x24
|
||||
#define R37 0x25
|
||||
#define R40 0x28
|
||||
#define R41 0x29
|
||||
#define R43 0x2B
|
||||
#define R45 0x2D
|
||||
#define R48 0x30
|
||||
#define R49 0x31
|
||||
#define R50 0x32
|
||||
#define R51 0x33
|
||||
#define R52 0x34
|
||||
#define R53 0x35
|
||||
#define R54 0x36
|
||||
#define R55 0x37
|
||||
#define R56 0x38
|
||||
#define R57 0x39
|
||||
#define R59 0x3B
|
||||
#define R60 0x3C
|
||||
#define R61 0x3D
|
||||
#define R62 0x3E
|
||||
#define R63 0x3F
|
||||
#define R64 0x40
|
||||
#define R65 0x41
|
||||
#define R66 0x42
|
||||
#define R67 0x43
|
||||
#define R68 0x44
|
||||
#define R69 0x45
|
||||
#define R70 0x46
|
||||
#define R71 0x47
|
||||
#define R72 0x48
|
||||
#define R73 0x49
|
||||
#define R74 0x4A
|
||||
#define R75 0x4B
|
||||
#define R76 0x4C
|
||||
#define R77 0x4D
|
||||
#define R78 0x4E
|
||||
#define R79 0x4F
|
||||
#define R80 0x50
|
||||
#define R81 0x51
|
||||
#define R82 0x52
|
||||
#define R83 0x53
|
||||
#define R96 0x60
|
||||
#define R97 0x61
|
||||
#define R106 0x6A
|
||||
#define R118 0x76
|
||||
#define R128 0x80
|
||||
#define R129 0x81
|
||||
#define R130 0x82
|
||||
#define R131 0x83
|
||||
#define R132 0x84
|
||||
#define R133 0x85
|
||||
#define R134 0x86
|
||||
#define R135 0x87
|
||||
#define R136 0x88
|
||||
#define R137 0x89
|
||||
#define R139 0x8B
|
||||
#define R140 0x8C
|
||||
#define R141 0x8D
|
||||
#define R143 0x8F
|
||||
#define R144 0x90
|
||||
#define R145 0x91
|
||||
#define R146 0x92
|
||||
#define R147 0x93
|
||||
#define R148 0x94
|
||||
#define R149 0x95
|
||||
#define R150 0x96
|
||||
#define R151 0x97
|
||||
#define R152 0x98
|
||||
#define R153 0x99
|
||||
#define R154 0x9A
|
||||
#define R157 0x9D
|
||||
#define R192 0xC0
|
||||
#define R193 0xC1
|
||||
#define R229 0xE5
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue