2012-05-23 11:29:39 +00:00
|
|
|
#ifndef GLCD_H
|
|
|
|
#define GLCD_H
|
|
|
|
|
2012-06-10 20:28:02 +00:00
|
|
|
#include "ch.h"
|
|
|
|
#include "hal.h"
|
|
|
|
#include "drivers/ssd1289_lld.h"
|
2012-06-11 14:16:08 +00:00
|
|
|
#include "drivers/s6d1121_lld.h"
|
2012-05-23 11:29:39 +00:00
|
|
|
|
2012-06-10 22:00:07 +00:00
|
|
|
#define SCREEN_WIDTH 240
|
|
|
|
#define SCREEN_HEIGHT 320
|
2012-05-23 11:29:39 +00:00
|
|
|
|
2012-06-06 21:31:00 +00:00
|
|
|
#define PORTRAIT (lcdGetOrientation() == portrait || lcdGetOrientation() == portraitInv)
|
|
|
|
#define LANDSCAPE (lcdGetOrientation() == landscape || lcdGetOrientation() == landscapeInv)
|
2012-06-01 09:46:30 +00:00
|
|
|
|
2012-06-07 20:49:58 +00:00
|
|
|
#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);
|
2012-05-23 11:29:39 +00:00
|
|
|
|
|
|
|
/* LCD color */
|
|
|
|
#define White 0xFFFF
|
|
|
|
#define Black 0x0000
|
|
|
|
#define Grey 0xF7DE
|
|
|
|
#define Blue 0x001F
|
|
|
|
#define Blue2 0x051F
|
|
|
|
#define Red 0xF800
|
|
|
|
#define Magenta 0xF81F
|
|
|
|
#define Green 0x07E0
|
|
|
|
#define Cyan 0x7FFF
|
|
|
|
#define Yellow 0xFFE0
|
|
|
|
|
2012-06-04 21:03:46 +00:00
|
|
|
#define RGB565CONVERT(red, green, blue) \
|
|
|
|
(uint16_t)( (( red >> 3 ) << 11 ) | (( green >> 2 ) << 5 ) | ( blue >> 3 ))
|
2012-05-23 11:29:39 +00:00
|
|
|
|
2012-05-29 00:04:04 +00:00
|
|
|
enum orientation {portrait, landscape, portraitInv, landscapeInv};
|
2012-06-04 21:06:05 +00:00
|
|
|
enum filled {frame, filled};
|
2012-05-28 17:18:23 +00:00
|
|
|
|
2012-05-23 11:29:39 +00:00
|
|
|
void lcdInit(void);
|
2012-05-28 17:18:23 +00:00
|
|
|
void lcdClear(uint16_t color);
|
2012-05-28 17:29:35 +00:00
|
|
|
void lcdSetOrientation(uint8_t newOrientation);
|
2012-06-07 23:41:56 +00:00
|
|
|
void lcdSetWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
|
2012-05-31 11:45:57 +00:00
|
|
|
void lcdFillArea(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
|
2012-06-07 23:41:56 +00:00
|
|
|
void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t point);
|
2012-05-23 11:29:39 +00:00
|
|
|
void lcdDrawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
|
2012-05-28 21:50:16 +00:00
|
|
|
void lcdDrawRect(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t filled, uint16_t color);
|
2012-05-29 20:24:49 +00:00
|
|
|
void lcdDrawRectString(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t* str, uint16_t fontColor, uint16_t bkColor);
|
2012-05-28 21:50:16 +00:00
|
|
|
void lcdDrawCircle(uint16_t x, uint16_t y, uint16_t radius, uint8_t filled, uint16_t color);
|
2012-06-11 10:39:26 +00:00
|
|
|
void lcdDrawString(uint16_t x, uint16_t y, const char *str, uint16_t color, uint16_t bkColor);
|
|
|
|
void lcdDrawChar(uint16_t x, uint16_t y, const char c, uint16_t charcolor, uint16_t bkColor);
|
2012-05-29 00:37:13 +00:00
|
|
|
uint16_t lcdGetHeight(void);
|
|
|
|
uint16_t lcdGetWidth(void);
|
2012-06-01 09:49:56 +00:00
|
|
|
uint16_t lcdGetOrientation(void);
|
2012-05-29 00:37:13 +00:00
|
|
|
uint16_t lcdBGR2RGB(uint16_t color);
|
2012-05-29 00:40:09 +00:00
|
|
|
uint16_t lcdGetPixelColor(uint16_t x, uint16_t y);
|
2012-05-23 11:29:39 +00:00
|
|
|
|
|
|
|
#endif
|