blob: a2a3b6fa94a8f7653250ca26a1a9fbee12ad13e7 [file] [log] [blame]
/*****************************************************************************
* | File : LCD_Driver.h
* | Author : Waveshare team
* | Function : LCD driver
* | Info :
*----------------
* | This version: V1.0
* | Date : 2018-12-18
* | Info :
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
******************************************************************************/
#ifndef __LCD_DRIVER_H
#define __LCD_DRIVER_H
#include "DEV_Config.h"
#include "fonts.h"
#define LCD_WIDTH 320 //LCD width
#define LCD_HEIGHT 240 //LCD height
#if defined(__cplusplus)
extern "C" {
#endif
void LCD_WriteData_Word(void* ctx, UWORD da);
void LCD_SetCursor(void* ctx, UWORD X, UWORD Y);
void LCD_SetWindow(void* ctx, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend);
void LCD_DrawPaint(void* ctx, UWORD x, UWORD y, UWORD Color);
void LCD_Init(void* ctx);
void LCD_Clear(void* ctx, UWORD Color);
void LCD_ClearToBuffer(void* ctx, uint16_t* buffer);
void LCD_ClearWindow(void* ctx, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,UWORD color);
void LCD_ClearToBufferWindow(void* ctx, uint16_t* buffer, UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend);
typedef struct {
UWORD Image[320 * 240];
UWORD Width;
UWORD Height;
UWORD WidthMemory;
UWORD HeightMemory;
UWORD Color;
UWORD Rotate;
UWORD Mirror;
UWORD WidthByte;
UWORD HeightByte;
} PAINT;
void Paint_NewImage(PAINT* Paint, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color);
void Paint_DrawString_EN(PAINT* Paint, UWORD Xstart, UWORD Ystart, const char * pString,
sFONT* Font, UWORD Color_Background, UWORD Color_Foreground );
#if defined(__cplusplus)
}
#endif
// Constants for Paint routines
#define WHITE 0xFFFF
#define BLACK 0x0000
#define BLUE 0x001F
#define BRED 0XF81F
#define GRED 0XFFE0
#define GBLUE 0X07FF
#define RED 0xF800
#define MAGENTA 0xF81F
#define GREEN 0x07E0
#define CYAN 0x7FFF
#define YELLOW 0xFFE0
#define BROWN 0XBC40
#define BRRED 0XFC07
#define GRAY 0X8430
#define DARKBLUE 0X01CF
#define LIGHTBLUE 0X7D7C
#define GRAYBLUE 0X5458
#define LIGHTGREEN 0X841F
#define LGRAY 0XC618
#define LGRAYBLUE 0XA651
#define LBBLUE 0X2B12
typedef enum {
MIRROR_NONE = 0x00,
MIRROR_HORIZONTAL = 0x01,
MIRROR_VERTICAL = 0x02,
MIRROR_ORIGIN = 0x03,
} MIRROR_IMAGE;
#define MIRROR_IMAGE_DFT MIRROR_NONE
#define ROTATE_0 0
#define ROTATE_90 90
#define ROTATE_180 180
#define ROTATE_270 270
#endif