ECE3849/Crystalfontz128x128_ST7735.h
2025-03-20 11:20:21 -04:00

114 lines
4.2 KiB
C

/* --COPYRIGHT--,BSD
* Copyright (c) 2015, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* --/COPYRIGHT--*/
//*****************************************************************************
//
// Crystalfontz128x128.h - Prototypes for the display driver for the Crystalfontz
// 128x128 display with ST7735 controller.
//
// Modified by Gene Bogdanov 8/30/2017
//
//*****************************************************************************
#ifndef __CRYSTALFONTZLCD_H__
#define __CRYSTALFONTZLCD_H__
#include <stdint.h>
#include <stdbool.h>
#include "grlib/grlib.h"
// LCD Screen Dimensions
#define LCD_VERTICAL_MAX 128
#define LCD_HORIZONTAL_MAX 128
#define LCD_ORIENTATION_UP 0
#define LCD_ORIENTATION_LEFT 1
#define LCD_ORIENTATION_DOWN 2
#define LCD_ORIENTATION_RIGHT 3
// ST7735 LCD controller Command Set
#define CM_NOP 0x00
#define CM_SWRESET 0x01
#define CM_RDDID 0x04
#define CM_RDDST 0x09
#define CM_SLPIN 0x10
#define CM_SLPOUT 0x11
#define CM_PTLON 0x12
#define CM_NORON 0x13
#define CM_INVOFF 0x20
#define CM_INVON 0x21
#define CM_GAMSET 0x26
#define CM_DISPOFF 0x28
#define CM_DISPON 0x29
#define CM_CASET 0x2A
#define CM_RASET 0x2B
#define CM_RAMWR 0x2C
#define CM_RGBSET 0x2d
#define CM_RAMRD 0x2E
#define CM_PTLAR 0x30
#define CM_MADCTL 0x36
#define CM_COLMOD 0x3A
#define CM_SETPWCTR 0xB1
#define CM_SETDISPL 0xB2
#define CM_FRMCTR3 0xB3
#define CM_SETCYC 0xB4
#define CM_SETBGP 0xb5
#define CM_SETVCOM 0xB6
#define CM_SETSTBA 0xC0
#define CM_SETID 0xC3
#define CM_GETHID 0xd0
#define CM_SETGAMMA 0xE0
#define CM_MADCTL_MY 0x80
#define CM_MADCTL_MX 0x40
#define CM_MADCTL_MV 0x20
#define CM_MADCTL_ML 0x10
#define CM_MADCTL_BGR 0x08
#define CM_MADCTL_MH 0x04
extern uint8_t Lcd_Orientation;
extern uint16_t Lcd_ScreenWidth, Lcd_ScreenHeigth;
extern uint8_t Lcd_PenSolid, Lcd_FontSolid, Lcd_FlagRead;
extern uint16_t Lcd_TouchTrim;
extern uint16_t Lcd_buffer[LCD_VERTICAL_MAX][LCD_HORIZONTAL_MAX];
extern const tDisplay g_sCrystalfontz128x128;
extern void Crystalfontz128x128_Init(void);
extern void Crystalfontz128x128_SetDrawFrame(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);
extern void Crystalfontz128x128_SetOrientation(uint8_t orientation);
#endif /* __CRYSTALFONTZLCD_H__ */