older Version without DMA
Fork of SPI_TFT by
SPI_TFT.h@2:0cc880f230ad, 2011-07-13 (annotated)
- Committer:
- dreschpe
- Date:
- Wed Jul 13 08:35:20 2011 +0000
- Revision:
- 2:0cc880f230ad
- Parent:
- 1:aa3356b16080
- Child:
- 3:5be1edd3a543
doxigen fix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreschpe | 0:cccc5726bdf3 | 1 | /* mbed library for 240*320 pixel display TFT based on HX8347D LCD Controller |
dreschpe | 0:cccc5726bdf3 | 2 | * Copyright (c) 2011 Peter Drescher - DC2PD |
dreschpe | 0:cccc5726bdf3 | 3 | * |
dreschpe | 0:cccc5726bdf3 | 4 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
dreschpe | 0:cccc5726bdf3 | 5 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
dreschpe | 0:cccc5726bdf3 | 6 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
dreschpe | 0:cccc5726bdf3 | 7 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
dreschpe | 0:cccc5726bdf3 | 8 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
dreschpe | 0:cccc5726bdf3 | 9 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
dreschpe | 0:cccc5726bdf3 | 10 | * THE SOFTWARE. |
dreschpe | 0:cccc5726bdf3 | 11 | */ |
dreschpe | 0:cccc5726bdf3 | 12 | |
dreschpe | 0:cccc5726bdf3 | 13 | #ifndef MBED_SPI_TFT_H |
dreschpe | 0:cccc5726bdf3 | 14 | #define MBED_SPI_TFT_H |
dreschpe | 0:cccc5726bdf3 | 15 | |
dreschpe | 1:aa3356b16080 | 16 | /** Display control class, based on GraphicsDisplay and TextDisplay |
dreschpe | 1:aa3356b16080 | 17 | * |
dreschpe | 1:aa3356b16080 | 18 | * Example: |
dreschpe | 1:aa3356b16080 | 19 | * @code |
dreschpe | 1:aa3356b16080 | 20 | * #include "stdio.h" |
dreschpe | 1:aa3356b16080 | 21 | * #include "mbed.h" |
dreschpe | 1:aa3356b16080 | 22 | * #include "SPI_TFT.h" |
dreschpe | 1:aa3356b16080 | 23 | * #include "string" |
dreschpe | 1:aa3356b16080 | 24 | * #include "Arial12x12.h" |
dreschpe | 1:aa3356b16080 | 25 | * #include "Arial24x23.h" |
dreschpe | 1:aa3356b16080 | 26 | * |
dreschpe | 1:aa3356b16080 | 27 | * |
dreschpe | 1:aa3356b16080 | 28 | * |
dreschpe | 1:aa3356b16080 | 29 | * // the TFT is connected to SPI pin 5-7 |
dreschpe | 1:aa3356b16080 | 30 | * SPI_TFT TFT(p5, p6, p7, p8, p15,"TFT"); // mosi, miso, sclk, cs, reset |
dreschpe | 1:aa3356b16080 | 31 | * |
dreschpe | 1:aa3356b16080 | 32 | * int main() { |
dreschpe | 1:aa3356b16080 | 33 | * TFT.claim(stdout); // send stdout to the TFT display |
dreschpe | 1:aa3356b16080 | 34 | * //TFT.claim(stderr); // send stderr to the TFT display |
dreschpe | 1:aa3356b16080 | 35 | * |
dreschpe | 1:aa3356b16080 | 36 | * TFT.background(Black); // set background to black |
dreschpe | 1:aa3356b16080 | 37 | * TFT.foreground(White); // set chars to white |
dreschpe | 1:aa3356b16080 | 38 | * TFT.cls(); // clear the screen |
dreschpe | 1:aa3356b16080 | 39 | * TFT.set_font((unsigned char*) Arial12x12); // select the font |
dreschpe | 1:aa3356b16080 | 40 | * |
dreschpe | 1:aa3356b16080 | 41 | * TFT.set_orientation(0); |
dreschpe | 1:aa3356b16080 | 42 | * TFT.locate(0,0); |
dreschpe | 1:aa3356b16080 | 43 | * printf(" Hello Mbed 0"); |
dreschpe | 1:aa3356b16080 | 44 | * TFT.set_font((unsigned char*) Arial24x23); // select font 2 |
dreschpe | 1:aa3356b16080 | 45 | * TFT.locate(2,5); |
dreschpe | 1:aa3356b16080 | 46 | * TFT.printf("Bigger Font"); |
dreschpe | 1:aa3356b16080 | 47 | * } |
dreschpe | 1:aa3356b16080 | 48 | * @endcode |
dreschpe | 1:aa3356b16080 | 49 | */ |
dreschpe | 1:aa3356b16080 | 50 | |
dreschpe | 1:aa3356b16080 | 51 | |
dreschpe | 0:cccc5726bdf3 | 52 | #include "mbed.h" |
dreschpe | 0:cccc5726bdf3 | 53 | #include "GraphicsDisplay.h" |
dreschpe | 0:cccc5726bdf3 | 54 | |
dreschpe | 0:cccc5726bdf3 | 55 | #define RGB(r,g,b) (((r&0xF8)<<8)|((g&0xFC)<<3)|((b&0xF8)>>3)) //5 red | 6 green | 5 blue |
dreschpe | 0:cccc5726bdf3 | 56 | |
dreschpe | 0:cccc5726bdf3 | 57 | #define SPI_START (0x70) /* Start byte for SPI transfer */ |
dreschpe | 0:cccc5726bdf3 | 58 | #define SPI_RD (0x01) /* WR bit 1 within start */ |
dreschpe | 0:cccc5726bdf3 | 59 | #define SPI_WR (0x00) /* WR bit 0 within start */ |
dreschpe | 0:cccc5726bdf3 | 60 | #define SPI_DATA (0x02) /* RS bit 1 within start byte */ |
dreschpe | 0:cccc5726bdf3 | 61 | #define SPI_INDEX (0x00) /* RS bit 0 within start byte */ |
dreschpe | 0:cccc5726bdf3 | 62 | |
dreschpe | 0:cccc5726bdf3 | 63 | |
dreschpe | 0:cccc5726bdf3 | 64 | /* some RGB color definitions */ |
dreschpe | 0:cccc5726bdf3 | 65 | #define Black 0x0000 /* 0, 0, 0 */ |
dreschpe | 0:cccc5726bdf3 | 66 | #define Navy 0x000F /* 0, 0, 128 */ |
dreschpe | 0:cccc5726bdf3 | 67 | #define DarkGreen 0x03E0 /* 0, 128, 0 */ |
dreschpe | 0:cccc5726bdf3 | 68 | #define DarkCyan 0x03EF /* 0, 128, 128 */ |
dreschpe | 0:cccc5726bdf3 | 69 | #define Maroon 0x7800 /* 128, 0, 0 */ |
dreschpe | 0:cccc5726bdf3 | 70 | #define Purple 0x780F /* 128, 0, 128 */ |
dreschpe | 0:cccc5726bdf3 | 71 | #define Olive 0x7BE0 /* 128, 128, 0 */ |
dreschpe | 0:cccc5726bdf3 | 72 | #define LightGrey 0xC618 /* 192, 192, 192 */ |
dreschpe | 0:cccc5726bdf3 | 73 | #define DarkGrey 0x7BEF /* 128, 128, 128 */ |
dreschpe | 0:cccc5726bdf3 | 74 | #define Blue 0x001F /* 0, 0, 255 */ |
dreschpe | 0:cccc5726bdf3 | 75 | #define Green 0x07E0 /* 0, 255, 0 */ |
dreschpe | 0:cccc5726bdf3 | 76 | #define Cyan 0x07FF /* 0, 255, 255 */ |
dreschpe | 0:cccc5726bdf3 | 77 | #define Red 0xF800 /* 255, 0, 0 */ |
dreschpe | 0:cccc5726bdf3 | 78 | #define Magenta 0xF81F /* 255, 0, 255 */ |
dreschpe | 0:cccc5726bdf3 | 79 | #define Yellow 0xFFE0 /* 255, 255, 0 */ |
dreschpe | 0:cccc5726bdf3 | 80 | #define White 0xFFFF /* 255, 255, 255 */ |
dreschpe | 0:cccc5726bdf3 | 81 | |
dreschpe | 0:cccc5726bdf3 | 82 | |
dreschpe | 0:cccc5726bdf3 | 83 | |
dreschpe | 1:aa3356b16080 | 84 | |
dreschpe | 1:aa3356b16080 | 85 | |
dreschpe | 0:cccc5726bdf3 | 86 | class SPI_TFT : public GraphicsDisplay { |
dreschpe | 0:cccc5726bdf3 | 87 | public: |
dreschpe | 1:aa3356b16080 | 88 | |
dreschpe | 2:0cc880f230ad | 89 | /** Create a SPI_TFT object connected to SPI and two pins |
dreschpe | 2:0cc880f230ad | 90 | * |
dreschpe | 2:0cc880f230ad | 91 | * @param mosi,miso,sclk SPI |
dreschpe | 2:0cc880f230ad | 92 | * @param cs pin connected to CS of display |
dreschpe | 2:0cc880f230ad | 93 | * @param reset pin connected to RESET of display |
dreschpe | 2:0cc880f230ad | 94 | * |
dreschpe | 2:0cc880f230ad | 95 | */ |
dreschpe | 2:0cc880f230ad | 96 | SPI_TFT(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset,const char* name ="TFT"); |
dreschpe | 1:aa3356b16080 | 97 | |
dreschpe | 2:0cc880f230ad | 98 | /** Get the width of the screen in pixel |
dreschpe | 2:0cc880f230ad | 99 | * |
dreschpe | 2:0cc880f230ad | 100 | * @param |
dreschpe | 2:0cc880f230ad | 101 | * @returns width of screen in pixel |
dreschpe | 2:0cc880f230ad | 102 | * |
dreschpe | 2:0cc880f230ad | 103 | */ |
dreschpe | 2:0cc880f230ad | 104 | virtual int width(); |
dreschpe | 1:aa3356b16080 | 105 | |
dreschpe | 2:0cc880f230ad | 106 | /** Get the height of the screen in pixel |
dreschpe | 2:0cc880f230ad | 107 | * |
dreschpe | 2:0cc880f230ad | 108 | * @returns height of screen in pixel |
dreschpe | 2:0cc880f230ad | 109 | * |
dreschpe | 2:0cc880f230ad | 110 | */ |
dreschpe | 2:0cc880f230ad | 111 | virtual int height(); |
dreschpe | 1:aa3356b16080 | 112 | |
dreschpe | 2:0cc880f230ad | 113 | /** Draw a pixel at x,y with color |
dreschpe | 2:0cc880f230ad | 114 | * |
dreschpe | 2:0cc880f230ad | 115 | * @param x horizontal position |
dreschpe | 2:0cc880f230ad | 116 | * @param y vertical position |
dreschpe | 2:0cc880f230ad | 117 | * @param color 16 bit pixel color |
dreschpe | 2:0cc880f230ad | 118 | */ |
dreschpe | 2:0cc880f230ad | 119 | virtual void pixel(int x, int y, int colour); |
dreschpe | 1:aa3356b16080 | 120 | |
dreschpe | 2:0cc880f230ad | 121 | /** draw a circle |
dreschpe | 2:0cc880f230ad | 122 | * |
dreschpe | 2:0cc880f230ad | 123 | * @param x0,y0 center |
dreschpe | 2:0cc880f230ad | 124 | * @param r radius |
dreschpe | 2:0cc880f230ad | 125 | * @param color 16 bit color * |
dreschpe | 2:0cc880f230ad | 126 | * |
dreschpe | 2:0cc880f230ad | 127 | */ |
dreschpe | 2:0cc880f230ad | 128 | void circle(int x, int y, int r, int colour); |
dreschpe | 1:aa3356b16080 | 129 | |
dreschpe | 2:0cc880f230ad | 130 | /** draw a 1 pixel line |
dreschpe | 2:0cc880f230ad | 131 | * |
dreschpe | 2:0cc880f230ad | 132 | * @param x0,y0 start point |
dreschpe | 2:0cc880f230ad | 133 | * @param x1,y1 stop point |
dreschpe | 2:0cc880f230ad | 134 | * @param color 16 bit color |
dreschpe | 2:0cc880f230ad | 135 | * |
dreschpe | 2:0cc880f230ad | 136 | */ |
dreschpe | 2:0cc880f230ad | 137 | void line(int x0, int y0, int x1, int y1, int colour); |
dreschpe | 1:aa3356b16080 | 138 | |
dreschpe | 2:0cc880f230ad | 139 | /** draw a rect |
dreschpe | 2:0cc880f230ad | 140 | * |
dreschpe | 2:0cc880f230ad | 141 | * @param x0,y0 top left corner |
dreschpe | 2:0cc880f230ad | 142 | * @param x1,y1 down right corner |
dreschpe | 2:0cc880f230ad | 143 | * @param color 16 bit color |
dreschpe | 2:0cc880f230ad | 144 | * * |
dreschpe | 2:0cc880f230ad | 145 | */ |
dreschpe | 2:0cc880f230ad | 146 | void rect(int x0, int y0, int x1, int y1, int colour); |
dreschpe | 1:aa3356b16080 | 147 | |
dreschpe | 2:0cc880f230ad | 148 | /** draw a filled rect |
dreschpe | 2:0cc880f230ad | 149 | * |
dreschpe | 2:0cc880f230ad | 150 | * @param x0,y0 top left corner |
dreschpe | 2:0cc880f230ad | 151 | * @param x1,y1 down right corner |
dreschpe | 2:0cc880f230ad | 152 | * @param color 16 bit color |
dreschpe | 2:0cc880f230ad | 153 | * |
dreschpe | 2:0cc880f230ad | 154 | */ |
dreschpe | 2:0cc880f230ad | 155 | void fillrect(int x0, int y0, int x1, int y1, int colour); |
dreschpe | 1:aa3356b16080 | 156 | |
dreschpe | 2:0cc880f230ad | 157 | /** setup cursor position |
dreschpe | 2:0cc880f230ad | 158 | * |
dreschpe | 2:0cc880f230ad | 159 | * @param column 0 to max |
dreschpe | 2:0cc880f230ad | 160 | * @param row 0 to max |
dreschpe | 2:0cc880f230ad | 161 | * max depend on font size |
dreschpe | 2:0cc880f230ad | 162 | */ |
dreschpe | 2:0cc880f230ad | 163 | void locate(int column, int row); |
dreschpe | 1:aa3356b16080 | 164 | |
dreschpe | 2:0cc880f230ad | 165 | /** Fill the screen with _backgroun color |
dreschpe | 2:0cc880f230ad | 166 | * |
dreschpe | 2:0cc880f230ad | 167 | */ |
dreschpe | 2:0cc880f230ad | 168 | virtual void cls (void); |
dreschpe | 1:aa3356b16080 | 169 | |
dreschpe | 2:0cc880f230ad | 170 | /** calculate the max number of char in a line |
dreschpe | 2:0cc880f230ad | 171 | * |
dreschpe | 2:0cc880f230ad | 172 | * @returns max columns |
dreschpe | 2:0cc880f230ad | 173 | * depends on actual font size |
dreschpe | 2:0cc880f230ad | 174 | * |
dreschpe | 2:0cc880f230ad | 175 | */ |
dreschpe | 2:0cc880f230ad | 176 | int columns(void); |
dreschpe | 1:aa3356b16080 | 177 | |
dreschpe | 2:0cc880f230ad | 178 | /** calculate the max number of columns |
dreschpe | 2:0cc880f230ad | 179 | * |
dreschpe | 2:0cc880f230ad | 180 | * @returns max column |
dreschpe | 2:0cc880f230ad | 181 | * depends on actual font size |
dreschpe | 2:0cc880f230ad | 182 | * |
dreschpe | 2:0cc880f230ad | 183 | */ |
dreschpe | 2:0cc880f230ad | 184 | int rows(void); |
dreschpe | 1:aa3356b16080 | 185 | |
dreschpe | 2:0cc880f230ad | 186 | /** put a char on the screen |
dreschpe | 2:0cc880f230ad | 187 | * |
dreschpe | 2:0cc880f230ad | 188 | * @param value char to print |
dreschpe | 2:0cc880f230ad | 189 | * @returns printed char |
dreschpe | 2:0cc880f230ad | 190 | * |
dreschpe | 2:0cc880f230ad | 191 | */ |
dreschpe | 2:0cc880f230ad | 192 | int _putc(int value); |
dreschpe | 1:aa3356b16080 | 193 | |
dreschpe | 2:0cc880f230ad | 194 | /** draw a character on given position out of the active font to the TFT |
dreschpe | 2:0cc880f230ad | 195 | * |
dreschpe | 2:0cc880f230ad | 196 | * @param col column |
dreschpe | 2:0cc880f230ad | 197 | * @param row row |
dreschpe | 2:0cc880f230ad | 198 | * @param c char to print |
dreschpe | 2:0cc880f230ad | 199 | * |
dreschpe | 2:0cc880f230ad | 200 | */ |
dreschpe | 2:0cc880f230ad | 201 | virtual void character(int col, int row, int c); |
dreschpe | 1:aa3356b16080 | 202 | |
dreschpe | 2:0cc880f230ad | 203 | /** paint a bitmap on the TFT |
dreschpe | 2:0cc880f230ad | 204 | * |
dreschpe | 2:0cc880f230ad | 205 | * @param x,y : upper left corner |
dreschpe | 2:0cc880f230ad | 206 | * @param w width of bitmap |
dreschpe | 2:0cc880f230ad | 207 | * @param h high of bitmap |
dreschpe | 2:0cc880f230ad | 208 | * @param *bitmap pointer to the bitmap data |
dreschpe | 2:0cc880f230ad | 209 | * |
dreschpe | 2:0cc880f230ad | 210 | * bitmap format: 16 bit R5 G6 B5 |
dreschpe | 2:0cc880f230ad | 211 | * |
dreschpe | 2:0cc880f230ad | 212 | * use Gimp to create / load , save as BMP, option 16 bit R5 G6 B5 |
dreschpe | 2:0cc880f230ad | 213 | * use winhex to load this file and mark data stating at offset 0x46 to end |
dreschpe | 2:0cc880f230ad | 214 | * use edit -> copy block -> C Source to export C array |
dreschpe | 2:0cc880f230ad | 215 | * paste this array into your program |
dreschpe | 2:0cc880f230ad | 216 | * |
dreschpe | 2:0cc880f230ad | 217 | */ |
dreschpe | 2:0cc880f230ad | 218 | void Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap); |
dreschpe | 1:aa3356b16080 | 219 | |
dreschpe | 2:0cc880f230ad | 220 | /** select the font to use |
dreschpe | 2:0cc880f230ad | 221 | * |
dreschpe | 2:0cc880f230ad | 222 | * @param f pointer to font array |
dreschpe | 2:0cc880f230ad | 223 | * |
dreschpe | 2:0cc880f230ad | 224 | * font array can created with GLCD Font Creator from http://www.mikroe.com |
dreschpe | 2:0cc880f230ad | 225 | * you have to add 4 parameter at the beginning of the font array to use: |
dreschpe | 2:0cc880f230ad | 226 | * - the number of byte / char |
dreschpe | 2:0cc880f230ad | 227 | * - the vertial size in pixel |
dreschpe | 2:0cc880f230ad | 228 | * - the horizontal size in pixel |
dreschpe | 2:0cc880f230ad | 229 | * - the number of byte per vertical line |
dreschpe | 2:0cc880f230ad | 230 | * you also have to change the array to char[] |
dreschpe | 2:0cc880f230ad | 231 | * |
dreschpe | 2:0cc880f230ad | 232 | */ |
dreschpe | 2:0cc880f230ad | 233 | void set_font(unsigned char* f); |
dreschpe | 1:aa3356b16080 | 234 | |
dreschpe | 2:0cc880f230ad | 235 | /** Set the orientation of the screen |
dreschpe | 2:0cc880f230ad | 236 | * x,y: 0,0 is always top left |
dreschpe | 2:0cc880f230ad | 237 | * |
dreschpe | 2:0cc880f230ad | 238 | * @param o direction to use the screen (0-3) 90° Steps |
dreschpe | 2:0cc880f230ad | 239 | * |
dreschpe | 2:0cc880f230ad | 240 | */ |
dreschpe | 2:0cc880f230ad | 241 | void set_orientation(unsigned int o); |
dreschpe | 0:cccc5726bdf3 | 242 | |
dreschpe | 2:0cc880f230ad | 243 | SPI _spi; |
dreschpe | 2:0cc880f230ad | 244 | DigitalOut _cs; |
dreschpe | 2:0cc880f230ad | 245 | DigitalOut _reset; |
dreschpe | 2:0cc880f230ad | 246 | unsigned char* font; |
dreschpe | 2:0cc880f230ad | 247 | |
dreschpe | 0:cccc5726bdf3 | 248 | protected: |
dreschpe | 1:aa3356b16080 | 249 | |
dreschpe | 2:0cc880f230ad | 250 | /** draw a horizontal line |
dreschpe | 2:0cc880f230ad | 251 | * |
dreschpe | 2:0cc880f230ad | 252 | * @param x0 horizontal start |
dreschpe | 2:0cc880f230ad | 253 | * @param x1 horizontal stop |
dreschpe | 2:0cc880f230ad | 254 | * @param y vertical position |
dreschpe | 2:0cc880f230ad | 255 | * @param color 16 bit color |
dreschpe | 2:0cc880f230ad | 256 | * |
dreschpe | 2:0cc880f230ad | 257 | */ |
dreschpe | 2:0cc880f230ad | 258 | void hline(int x0, int x1, int y, int colour); |
dreschpe | 1:aa3356b16080 | 259 | |
dreschpe | 2:0cc880f230ad | 260 | /** draw a vertical line |
dreschpe | 2:0cc880f230ad | 261 | * |
dreschpe | 2:0cc880f230ad | 262 | * @param x horizontal position |
dreschpe | 2:0cc880f230ad | 263 | * @param y0 vertical start |
dreschpe | 2:0cc880f230ad | 264 | * @param y1 vertical stop |
dreschpe | 2:0cc880f230ad | 265 | * @param color 16 bit color |
dreschpe | 2:0cc880f230ad | 266 | */ |
dreschpe | 2:0cc880f230ad | 267 | void vline(int y0, int y1, int x, int colour); |
dreschpe | 1:aa3356b16080 | 268 | |
dreschpe | 2:0cc880f230ad | 269 | /** Set draw window region |
dreschpe | 2:0cc880f230ad | 270 | * |
dreschpe | 2:0cc880f230ad | 271 | * @param x horizontal position |
dreschpe | 2:0cc880f230ad | 272 | * @param y vertical position |
dreschpe | 2:0cc880f230ad | 273 | * @param w window width in pixel |
dreschpe | 2:0cc880f230ad | 274 | * @param h window height in pixels |
dreschpe | 2:0cc880f230ad | 275 | */ |
dreschpe | 2:0cc880f230ad | 276 | void window (unsigned int x, unsigned int y, unsigned int w, unsigned int h); |
dreschpe | 1:aa3356b16080 | 277 | |
dreschpe | 1:aa3356b16080 | 278 | /** Set draw window region to whole screen |
dreschpe | 2:0cc880f230ad | 279 | * |
dreschpe | 2:0cc880f230ad | 280 | */ |
dreschpe | 2:0cc880f230ad | 281 | void WindowMax (void); |
dreschpe | 1:aa3356b16080 | 282 | |
dreschpe | 2:0cc880f230ad | 283 | /** Init the HX8347D controller |
dreschpe | 2:0cc880f230ad | 284 | * |
dreschpe | 2:0cc880f230ad | 285 | */ |
dreschpe | 2:0cc880f230ad | 286 | void tft_reset(); |
dreschpe | 1:aa3356b16080 | 287 | |
dreschpe | 2:0cc880f230ad | 288 | /** Write data to the LCD controller |
dreschpe | 2:0cc880f230ad | 289 | * |
dreschpe | 2:0cc880f230ad | 290 | * @param dat data written to LCD controller |
dreschpe | 2:0cc880f230ad | 291 | * |
dreschpe | 2:0cc880f230ad | 292 | */ |
dreschpe | 2:0cc880f230ad | 293 | void wr_dat(int value); |
dreschpe | 1:aa3356b16080 | 294 | |
dreschpe | 2:0cc880f230ad | 295 | /** Write a command the LCD controller |
dreschpe | 2:0cc880f230ad | 296 | * |
dreschpe | 2:0cc880f230ad | 297 | * @param cmd: command to be written |
dreschpe | 2:0cc880f230ad | 298 | * |
dreschpe | 2:0cc880f230ad | 299 | */ |
dreschpe | 2:0cc880f230ad | 300 | void wr_cmd(int value); |
dreschpe | 1:aa3356b16080 | 301 | |
dreschpe | 2:0cc880f230ad | 302 | /** Start data sequence to the LCD controller |
dreschpe | 2:0cc880f230ad | 303 | * |
dreschpe | 2:0cc880f230ad | 304 | */ |
dreschpe | 2:0cc880f230ad | 305 | void wr_dat_start(); |
dreschpe | 1:aa3356b16080 | 306 | |
dreschpe | 2:0cc880f230ad | 307 | /** Stop of data writing to the LCD controller |
dreschpe | 2:0cc880f230ad | 308 | * |
dreschpe | 2:0cc880f230ad | 309 | */ |
dreschpe | 2:0cc880f230ad | 310 | void wr_dat_stop(); |
dreschpe | 1:aa3356b16080 | 311 | |
dreschpe | 2:0cc880f230ad | 312 | /** write data to the LCD controller |
dreschpe | 2:0cc880f230ad | 313 | * |
dreschpe | 2:0cc880f230ad | 314 | * @param data to be written |
dreschpe | 2:0cc880f230ad | 315 | * * |
dreschpe | 2:0cc880f230ad | 316 | */ |
dreschpe | 2:0cc880f230ad | 317 | void wr_dat_only(unsigned short dat); |
dreschpe | 1:aa3356b16080 | 318 | |
dreschpe | 2:0cc880f230ad | 319 | /** Read data from the LCD controller |
dreschpe | 2:0cc880f230ad | 320 | * |
dreschpe | 2:0cc880f230ad | 321 | * @returns data from LCD controller |
dreschpe | 2:0cc880f230ad | 322 | * |
dreschpe | 2:0cc880f230ad | 323 | */ |
dreschpe | 2:0cc880f230ad | 324 | unsigned short rd_dat(void); |
dreschpe | 1:aa3356b16080 | 325 | |
dreschpe | 2:0cc880f230ad | 326 | /** Write a value to the to a LCD register |
dreschpe | 2:0cc880f230ad | 327 | * |
dreschpe | 2:0cc880f230ad | 328 | * @param reg register to be written |
dreschpe | 2:0cc880f230ad | 329 | * @param val data to be written |
dreschpe | 2:0cc880f230ad | 330 | */ |
dreschpe | 2:0cc880f230ad | 331 | void wr_reg (unsigned char reg, unsigned short val); |
dreschpe | 1:aa3356b16080 | 332 | |
dreschpe | 2:0cc880f230ad | 333 | /** Read a LCD register |
dreschpe | 2:0cc880f230ad | 334 | * |
dreschpe | 2:0cc880f230ad | 335 | * @param reg register to be read |
dreschpe | 2:0cc880f230ad | 336 | * @returns value of the register |
dreschpe | 2:0cc880f230ad | 337 | */ |
dreschpe | 2:0cc880f230ad | 338 | unsigned short rd_reg (unsigned char reg); |
dreschpe | 0:cccc5726bdf3 | 339 | |
dreschpe | 2:0cc880f230ad | 340 | unsigned int orientation; |
dreschpe | 2:0cc880f230ad | 341 | unsigned int char_x; |
dreschpe | 0:cccc5726bdf3 | 342 | |
dreschpe | 0:cccc5726bdf3 | 343 | }; |
dreschpe | 0:cccc5726bdf3 | 344 | |
dreschpe | 0:cccc5726bdf3 | 345 | #endif |