Spieler splodiert.
[hackover2013-badge-firmware.git] / drivers / displays / tft / hw / s6b33b6x.h
1 /**************************************************************************/
2 /*!
3 @file s6b33b6x.h
4 @author K. Townsend (www.adafruit.com)
5
6 @section LICENSE
7
8 Software License Agreement (BSD License)
9
10 Copyright (c) 2012, Adafruit Industries
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 __S6B33B6X_H__
37 #define __S6B33B6X_H__
38
39 #include "projectconfig.h"
40 #include "drivers/displays/tft/lcd.h"
41 #include "core/gpio/gpio.h"
42
43 /*=========================================================================
44 SPI modes
45 -----------------------------------------------------------------------
46 The display supports both 3-pin and 4-pin SPI modes
47
48 3-PIN MODE Saves one GPIO pin (D/C) by adding the D/C bit before
49 every transfer, meaning that 9 bits are sent every frame
50 instead of 8. You have slightly slower performance
51 but use less pins. Requires 3 GPIO pins (SCK, SID, RST)
52
53 4-PIN MODE Uses a normal SPI interface with 8-bits per transfer,
54 plus a dedicated D/C pin to indicate if this is a
55 command or data byte. Requires 4 GPIO pins (SCK, SID,
56 RST, DC).
57
58 To select one of the SPI modes, make sure the pins are correctly
59 set on the display and uncomment the appropriate define below.
60 -----------------------------------------------------------------------*/
61 // #define S6B33B6X_BUS_SPI3
62 #define S6B33B6X_BUS_SPI4
63 /*=========================================================================*/
64
65 // Control pins
66 #define S6B33B6X_SCK_PORT (2) // SCK
67 #define S6B33B6X_SCK_PIN (1)
68 #define S6B33B6X_SID_PORT (2) // DATAIN/MOSI
69 #define S6B33B6X_SID_PIN (2)
70 #define S6B33B6X_CS_PORT (2) // CS
71 #define S6B33B6X_CS_PIN (3)
72 #define S6B33B6X_RST_PORT (2) // RST
73 #define S6B33B6X_RST_PIN (4)
74 #define S6B33B6X_DC_PORT (2) // D/I (only required for 4-pin SPI)
75 #define S6B33B6X_DC_PIN (5)
76
77 // These registers allow fast single cycle clear+set of bits (see section 8.5.1 of LPC1343 UM)
78 #define S6B33B6X_GPIO2DATA_SCK (*(pREG32 (GPIO_GPIO2_BASE + ((1 << S6B33B6X_SCK_PIN) << 2))))
79 #define S6B33B6X_GPIO2DATA_SID (*(pREG32 (GPIO_GPIO2_BASE + ((1 << S6B33B6X_SID_PIN) << 2))))
80 #define S6B33B6X_GPIO2DATA_CS (*(pREG32 (GPIO_GPIO2_BASE + ((1 << S6B33B6X_CS_PIN) << 2))))
81 #define S6B33B6X_GPIO2DATA_RST (*(pREG32 (GPIO_GPIO2_BASE + ((1 << S6B33B6X_RST_PIN) << 2))))
82 #define S6B33B6X_GPIO2DATA_DC (*(pREG32 (GPIO_GPIO2_BASE + ((1 << S6B33B6X_DC_PIN) << 2))))
83
84 // Macros for control line state
85 #define CLR_SCK do { S6B33B6X_GPIO2DATA_SCK = (0); } while (0)
86 #define SET_SCK do { S6B33B6X_GPIO2DATA_SCK = (1 << S6B33B6X_SCK_PIN); } while (0)
87 #define CLR_SID do { S6B33B6X_GPIO2DATA_SID = (0); } while (0)
88 #define SET_SID do { S6B33B6X_GPIO2DATA_SID = (1 << S6B33B6X_SID_PIN); } while (0)
89 #define CLR_CS do { S6B33B6X_GPIO2DATA_CS = (0); } while (0)
90 #define SET_CS do { S6B33B6X_GPIO2DATA_CS = (1 << S6B33B6X_CS_PIN); } while (0)
91 #define CLR_RST do { S6B33B6X_GPIO2DATA_RST = (0); } while (0)
92 #define SET_RST do { S6B33B6X_GPIO2DATA_RST = (1 << S6B33B6X_RST_PIN); } while (0)
93 #define CLR_DC do { S6B33B6X_GPIO2DATA_DC = (0); } while (0)
94 #define SET_DC do { S6B33B6X_GPIO2DATA_DC = (1 << S6B33B6X_DC_PIN); } while (0)
95
96 // S6B33B6X Commands
97 enum
98 {
99 S6B33B6X_CMD_NOP = 0x00,
100 S6B33B6X_CMD_OSCILLATIONMODESET = 0x02,
101 S6B33B6X_CMD_DRIVEROUTPUTMODESET = 0x10,
102 S6B33B6X_CMD_MONITORSIGNALCONTROL = 0x18,
103 S6B33B6X_CMD_DCDCCONTROL = 0x20,
104 S6B33B6X_CMD_DCDCCLOCKDIVISIONSET = 0x24,
105 S6B33B6X_CMD_DCDCAMPONOFFSET = 0x26,
106 S6B33B6X_CMD_TEMPCOMPENSATIONSET = 0x28,
107 S6B33B6X_CMD_CONTRASTCONTROL = 0x2A,
108 S6B33B6X_CMD_STANDBYMODEOFF = 0x2C,
109 S6B33B6X_CMD_STANDBYMODEON = 0x2D,
110 S6B33B6X_CMD_ADDRESSINGMODESET = 0x30,
111 S6B33B6X_CMD_ROWVECTORMODESET = 0x32,
112 S6B33B6X_CMD_NBLOCKINVERSIONSET = 0x34,
113 S6B33B6X_CMD_DRIVINGMODESET = 0x36,
114 S6B33B6X_CMD_ENTRYMODESET = 0x40,
115 S6B33B6X_CMD_ROWADDRESSAREASET = 0x42,
116 S6B33B6X_CMD_COLUMNADDRESSAREASET = 0x43,
117 S6B33B6X_CMD_RAMSKIPAREASET = 0x45,
118 S6B33B6X_CMD_DISPLAYOFF = 0x50,
119 S6B33B6X_CMD_DISPLAYON = 0x51,
120 S6B33B6X_CMD_SPECIFIEDDISPLAYPATTERN = 0x53,
121 S6B33B6X_CMD_PARTIALDISPLAYMODESET = 0x55,
122 S6B33B6X_CMD_PARTIALDISPLAYSTARTLINE = 0x56,
123 S6B33B6X_CMD_PARTIALDISPLAYENDLINE = 0x57,
124 S6B33B6X_CMD_OTPMODEOFF = 0xEA,
125 S6B33B6X_CMD_OTPMODEON = 0xEB,
126 S6B33B6X_CMD_OFFSETVOLUMESET = 0xED,
127 S6B33B6X_CMD_OTPWRITEENABLE = 0xEF
128 };
129
130 void s6b33b6xSetCursor(uint8_t x, uint8_t y);
131 void s6b33b6xSendByte(uint8_t byte, uint8_t command);
132
133 #endif
This page took 0.046892 seconds and 5 git commands to generate.