Merge branch 'master' of github.com:microbuilder/LPC1343CodeBase
[hackover2013-badge-firmware.git] / drivers / displays / tft / hw / st7735.h
1 /**************************************************************************/
2 /*!
3 @file ST7735.h
4 @author K. Townsend (microBuilder.eu)
5
6 @section LICENSE
7
8 Software License Agreement (BSD License)
9
10 Copyright (c) 2010, microBuilder SARL
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 1. Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 2. Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 3. Neither the name of the copyright holders nor the
21 names of its contributors may be used to endorse or promote products
22 derived from this software without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35 /**************************************************************************/
36 #ifndef __ST7735_H__
37 #define __ST7735_H__
38
39 #include "projectconfig.h"
40 #include "drivers/displays/tft/lcd.h"
41
42 /**************************************************************************
43 ST7735 CONNECTOR
44 -----------------------------------------------------------------------
45 Pin Function Notes
46 === ============== ===============================
47 1 NC
48 2 GND
49 3 LED K/-
50 4 LED A/+ 3.0V
51 5 GND
52 6 RESET
53 7 RS
54 8 SDA Serial Data
55 9 SCL Serial Clock
56 10 VCC 2.8-3.4V
57 11 VCC 2.8-3.4V
58 12 CS
59 13 GND
60 14 NC
61
62 **************************************************************************/
63
64 // Control pins
65 #define ST7735_GPIODATAREG (*(pREG32 (0x50023FFC))) // GPIO2DATA
66 #define ST7735_PORT (2)
67 #define ST7735_RS_PIN (1)
68 #define ST7735_SDA_PIN (2)
69 #define ST7735_SCL_PIN (3)
70 #define ST7735_CS_PIN (4)
71 #define ST7735_RES_PIN (5)
72 #define ST7735_BL_PIN (6)
73
74 // Macros for control line state
75 #define CLR_RS do { ST7735_GPIODATAREG &= ~(1<<ST7735_RS_PIN); } while(0)
76 #define SET_RS do { ST7735_GPIODATAREG &= ~(1<<ST7735_RS_PIN); ST7735_GPIODATAREG |= (1<<ST7735_RS_PIN); } while(0)
77 #define CLR_SDA do { ST7735_GPIODATAREG &= ~(1<<ST7735_SDA_PIN); } while(0)
78 #define SET_SDA do { ST7735_GPIODATAREG &= ~(1<<ST7735_SDA_PIN); ST7735_GPIODATAREG |= (1<<ST7735_SDA_PIN); } while(0)
79 #define CLR_SCL do { ST7735_GPIODATAREG &= ~(1<<ST7735_SCL_PIN); } while(0)
80 #define SET_SCL do { ST7735_GPIODATAREG &= ~(1<<ST7735_SCL_PIN); ST7735_GPIODATAREG |= (1<<ST7735_SCL_PIN); } while(0)
81 #define CLR_CS do { ST7735_GPIODATAREG &= ~(1<<ST7735_CS_PIN); } while(0)
82 #define SET_CS do { ST7735_GPIODATAREG &= ~(1<<ST7735_CS_PIN); ST7735_GPIODATAREG |= (1<<ST7735_CS_PIN); } while(0)
83 #define CLR_RES do { ST7735_GPIODATAREG &= ~(1<<ST7735_RES_PIN); } while(0)
84 #define SET_RES do { ST7735_GPIODATAREG &= ~(1<<ST7735_RES_PIN); ST7735_GPIODATAREG |= (1<<ST7735_RES_PIN); } while(0)
85 #define CLR_BL do { ST7735_GPIODATAREG &= ~(1<<ST7735_BL_PIN); } while(0)
86 #define SET_BL do { ST7735_GPIODATAREG &= ~(1<<ST7735_BL_PIN); ST7735_GPIODATAREG |= (1<<ST7735_BL_PIN); } while(0)
87
88 #define ST7735_NOP (0x0)
89 #define ST7735_SWRESET (0x01)
90 #define ST7735_SLPIN (0x10)
91 #define ST7735_SLPOUT (0x11)
92 #define ST7735_PTLON (0x12)
93 #define ST7735_NORON (0x13)
94 #define ST7735_INVOFF (0x20)
95 #define ST7735_INVON (0x21)
96 #define ST7735_DISPON (0x29)
97 #define ST7735_CASET (0x2A)
98 #define ST7735_RASET (0x2B)
99 #define ST7735_RAMWR (0x2C)
100 #define ST7735_COLMOD (0x3A)
101 #define ST7735_MADCTL (0x36)
102 #define ST7735_FRMCTR1 (0xB1)
103 #define ST7735_INVCTR (0xB4)
104 #define ST7735_DISSET5 (0xB6)
105 #define ST7735_PWCTR1 (0xC0)
106 #define ST7735_PWCTR2 (0xC1)
107 #define ST7735_PWCTR3 (0xC2)
108 #define ST7735_VMCTR1 (0xC5)
109 #define ST7735_PWCTR6 (0xFC)
110 #define ST7735_GMCTRP1 (0xE0)
111 #define ST7735_GMCTRN1 (0xE1)
112
113 #endif
This page took 0.05477 seconds and 5 git commands to generate.