For Nokia Mobile LCD

Dependents:   PE_08-08_MobileLCD

Committer:
robt
Date:
Fri Sep 28 15:06:16 2012 +0000
Revision:
0:39daa30e0eb3
[mbed] converted /mbed_08c_MobileLCD/MobileLCD

Who changed what in which revision?

UserRevisionLine numberNew contents of line
robt 0:39daa30e0eb3 1 /* mbed Library - MobileLCD
robt 0:39daa30e0eb3 2 * Copyright (c) 2007, sford
robt 0:39daa30e0eb3 3 */
robt 0:39daa30e0eb3 4
robt 0:39daa30e0eb3 5 #include "MobileLCD.h"
robt 0:39daa30e0eb3 6
robt 0:39daa30e0eb3 7 #include "mbed.h"
robt 0:39daa30e0eb3 8
robt 0:39daa30e0eb3 9 using namespace mbed;
robt 0:39daa30e0eb3 10
robt 0:39daa30e0eb3 11 const unsigned char FONT8x8[97][8] = {
robt 0:39daa30e0eb3 12 0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00, // columns, rows, num_bytes_per_char
robt 0:39daa30e0eb3 13 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // space 0x20
robt 0:39daa30e0eb3 14 0x30,0x78,0x78,0x30,0x30,0x00,0x30,0x00, // !
robt 0:39daa30e0eb3 15 0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00, // "
robt 0:39daa30e0eb3 16 0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00, // #
robt 0:39daa30e0eb3 17 0x18,0x3E,0x60,0x3C,0x06,0x7C,0x18,0x00, // $
robt 0:39daa30e0eb3 18 0x00,0x63,0x66,0x0C,0x18,0x33,0x63,0x00, // %
robt 0:39daa30e0eb3 19 0x1C,0x36,0x1C,0x3B,0x6E,0x66,0x3B,0x00, // &
robt 0:39daa30e0eb3 20 0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00, // '
robt 0:39daa30e0eb3 21 0x0C,0x18,0x30,0x30,0x30,0x18,0x0C,0x00, // (
robt 0:39daa30e0eb3 22 0x30,0x18,0x0C,0x0C,0x0C,0x18,0x30,0x00, // )
robt 0:39daa30e0eb3 23 0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00, // *
robt 0:39daa30e0eb3 24 0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00, // +
robt 0:39daa30e0eb3 25 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x30, // ,
robt 0:39daa30e0eb3 26 0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00, // -
robt 0:39daa30e0eb3 27 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00, // .
robt 0:39daa30e0eb3 28 0x03,0x06,0x0C,0x18,0x30,0x60,0x40,0x00, // / (forward slash)
robt 0:39daa30e0eb3 29 0x3E,0x63,0x63,0x6B,0x63,0x63,0x3E,0x00, // 0 0x30
robt 0:39daa30e0eb3 30 0x18,0x38,0x58,0x18,0x18,0x18,0x7E,0x00, // 1
robt 0:39daa30e0eb3 31 0x3C,0x66,0x06,0x1C,0x30,0x66,0x7E,0x00, // 2
robt 0:39daa30e0eb3 32 0x3C,0x66,0x06,0x1C,0x06,0x66,0x3C,0x00, // 3
robt 0:39daa30e0eb3 33 0x0E,0x1E,0x36,0x66,0x7F,0x06,0x0F,0x00, // 4
robt 0:39daa30e0eb3 34 0x7E,0x60,0x7C,0x06,0x06,0x66,0x3C,0x00, // 5
robt 0:39daa30e0eb3 35 0x1C,0x30,0x60,0x7C,0x66,0x66,0x3C,0x00, // 6
robt 0:39daa30e0eb3 36 0x7E,0x66,0x06,0x0C,0x18,0x18,0x18,0x00, // 7
robt 0:39daa30e0eb3 37 0x3C,0x66,0x66,0x3C,0x66,0x66,0x3C,0x00, // 8
robt 0:39daa30e0eb3 38 0x3C,0x66,0x66,0x3E,0x06,0x0C,0x38,0x00, // 9
robt 0:39daa30e0eb3 39 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00, // :
robt 0:39daa30e0eb3 40 0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x30, // ;
robt 0:39daa30e0eb3 41 0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00, // <
robt 0:39daa30e0eb3 42 0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00, // =
robt 0:39daa30e0eb3 43 0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00, // >
robt 0:39daa30e0eb3 44 0x3C,0x66,0x06,0x0C,0x18,0x00,0x18,0x00, // ?
robt 0:39daa30e0eb3 45 0x3E,0x63,0x6F,0x69,0x6F,0x60,0x3E,0x00, // @ 0x40
robt 0:39daa30e0eb3 46 0x18,0x3C,0x66,0x66,0x7E,0x66,0x66,0x00, // A
robt 0:39daa30e0eb3 47 0x7E,0x33,0x33,0x3E,0x33,0x33,0x7E,0x00, // B
robt 0:39daa30e0eb3 48 0x1E,0x33,0x60,0x60,0x60,0x33,0x1E,0x00, // C
robt 0:39daa30e0eb3 49 0x7C,0x36,0x33,0x33,0x33,0x36,0x7C,0x00, // D
robt 0:39daa30e0eb3 50 0x7F,0x31,0x34,0x3C,0x34,0x31,0x7F,0x00, // E
robt 0:39daa30e0eb3 51 0x7F,0x31,0x34,0x3C,0x34,0x30,0x78,0x00, // F
robt 0:39daa30e0eb3 52 0x1E,0x33,0x60,0x60,0x67,0x33,0x1F,0x00, // G
robt 0:39daa30e0eb3 53 0x66,0x66,0x66,0x7E,0x66,0x66,0x66,0x00, // H
robt 0:39daa30e0eb3 54 0x3C,0x18,0x18,0x18,0x18,0x18,0x3C,0x00, // I
robt 0:39daa30e0eb3 55 0x0F,0x06,0x06,0x06,0x66,0x66,0x3C,0x00, // J
robt 0:39daa30e0eb3 56 0x73,0x33,0x36,0x3C,0x36,0x33,0x73,0x00, // K
robt 0:39daa30e0eb3 57 0x78,0x30,0x30,0x30,0x31,0x33,0x7F,0x00, // L
robt 0:39daa30e0eb3 58 0x63,0x77,0x7F,0x7F,0x6B,0x63,0x63,0x00, // M
robt 0:39daa30e0eb3 59 0x63,0x73,0x7B,0x6F,0x67,0x63,0x63,0x00, // N
robt 0:39daa30e0eb3 60 0x3E,0x63,0x63,0x63,0x63,0x63,0x3E,0x00, // O
robt 0:39daa30e0eb3 61 0x7E,0x33,0x33,0x3E,0x30,0x30,0x78,0x00, // P 0x50
robt 0:39daa30e0eb3 62 0x3C,0x66,0x66,0x66,0x6E,0x3C,0x0E,0x00, // Q
robt 0:39daa30e0eb3 63 0x7E,0x33,0x33,0x3E,0x36,0x33,0x73,0x00, // R
robt 0:39daa30e0eb3 64 0x3C,0x66,0x30,0x18,0x0C,0x66,0x3C,0x00, // S
robt 0:39daa30e0eb3 65 0x7E,0x5A,0x18,0x18,0x18,0x18,0x3C,0x00, // T
robt 0:39daa30e0eb3 66 0x66,0x66,0x66,0x66,0x66,0x66,0x7E,0x00, // U
robt 0:39daa30e0eb3 67 0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00, // V
robt 0:39daa30e0eb3 68 0x63,0x63,0x63,0x6B,0x7F,0x77,0x63,0x00, // W
robt 0:39daa30e0eb3 69 0x63,0x63,0x36,0x1C,0x1C,0x36,0x63,0x00, // X
robt 0:39daa30e0eb3 70 0x66,0x66,0x66,0x3C,0x18,0x18,0x3C,0x00, // Y
robt 0:39daa30e0eb3 71 0x7F,0x63,0x46,0x0C,0x19,0x33,0x7F,0x00, // Z
robt 0:39daa30e0eb3 72 0x3C,0x30,0x30,0x30,0x30,0x30,0x3C,0x00, // [
robt 0:39daa30e0eb3 73 0x60,0x30,0x18,0x0C,0x06,0x03,0x01,0x00, // \ (back slash)
robt 0:39daa30e0eb3 74 0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00, // ]
robt 0:39daa30e0eb3 75 0x08,0x1C,0x36,0x63,0x00,0x00,0x00,0x00, // ^
robt 0:39daa30e0eb3 76 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, // _
robt 0:39daa30e0eb3 77 0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00, // ` 0x60
robt 0:39daa30e0eb3 78 0x00,0x00,0x3C,0x06,0x3E,0x66,0x3B,0x00, // a
robt 0:39daa30e0eb3 79 0x70,0x30,0x3E,0x33,0x33,0x33,0x6E,0x00, // b
robt 0:39daa30e0eb3 80 0x00,0x00,0x3C,0x66,0x60,0x66,0x3C,0x00, // c
robt 0:39daa30e0eb3 81 0x0E,0x06,0x3E,0x66,0x66,0x66,0x3B,0x00, // d
robt 0:39daa30e0eb3 82 0x00,0x00,0x3C,0x66,0x7E,0x60,0x3C,0x00, // e
robt 0:39daa30e0eb3 83 0x1C,0x36,0x30,0x78,0x30,0x30,0x78,0x00, // f
robt 0:39daa30e0eb3 84 0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x7C, // g
robt 0:39daa30e0eb3 85 0x70,0x30,0x36,0x3B,0x33,0x33,0x73,0x00, // h
robt 0:39daa30e0eb3 86 0x18,0x00,0x38,0x18,0x18,0x18,0x3C,0x00, // i
robt 0:39daa30e0eb3 87 0x06,0x00,0x06,0x06,0x06,0x66,0x66,0x3C, // j
robt 0:39daa30e0eb3 88 0x70,0x30,0x33,0x36,0x3C,0x36,0x73,0x00, // k
robt 0:39daa30e0eb3 89 0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00, // l
robt 0:39daa30e0eb3 90 0x00,0x00,0x66,0x7F,0x7F,0x6B,0x63,0x00, // m
robt 0:39daa30e0eb3 91 0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x00, // n
robt 0:39daa30e0eb3 92 0x00,0x00,0x3C,0x66,0x66,0x66,0x3C,0x00, // o
robt 0:39daa30e0eb3 93 0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x78, // p
robt 0:39daa30e0eb3 94 0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x0F, // q
robt 0:39daa30e0eb3 95 0x00,0x00,0x6E,0x3B,0x33,0x30,0x78,0x00, // r
robt 0:39daa30e0eb3 96 0x00,0x00,0x3E,0x60,0x3C,0x06,0x7C,0x00, // s
robt 0:39daa30e0eb3 97 0x08,0x18,0x3E,0x18,0x18,0x1A,0x0C,0x00, // t
robt 0:39daa30e0eb3 98 0x00,0x00,0x66,0x66,0x66,0x66,0x3B,0x00, // u
robt 0:39daa30e0eb3 99 0x00,0x00,0x66,0x66,0x66,0x3C,0x18,0x00, // v
robt 0:39daa30e0eb3 100 0x00,0x00,0x63,0x6B,0x7F,0x7F,0x36,0x00, // w
robt 0:39daa30e0eb3 101 0x00,0x00,0x63,0x36,0x1C,0x36,0x63,0x00, // x
robt 0:39daa30e0eb3 102 0x00,0x00,0x66,0x66,0x66,0x3E,0x06,0x7C, // y
robt 0:39daa30e0eb3 103 0x00,0x00,0x7E,0x4C,0x18,0x32,0x7E,0x00, // z
robt 0:39daa30e0eb3 104 0x0E,0x18,0x18,0x70,0x18,0x18,0x0E,0x00, // {
robt 0:39daa30e0eb3 105 0x0C,0x0C,0x0C,0x00,0x0C,0x0C,0x0C,0x00, // |
robt 0:39daa30e0eb3 106 0x70,0x18,0x18,0x0E,0x18,0x18,0x70,0x00, // }
robt 0:39daa30e0eb3 107 0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00, // ~
robt 0:39daa30e0eb3 108 0x1C,0x36,0x36,0x1C,0x00,0x00,0x00,0x00}; // DEL
robt 0:39daa30e0eb3 109
robt 0:39daa30e0eb3 110 void MobileLCD::command(int value) {
robt 0:39daa30e0eb3 111 _spi.write(value & 0xFF);
robt 0:39daa30e0eb3 112 }
robt 0:39daa30e0eb3 113
robt 0:39daa30e0eb3 114 void MobileLCD::data(int value) {
robt 0:39daa30e0eb3 115 _spi.write(value | 0x100);
robt 0:39daa30e0eb3 116 }
robt 0:39daa30e0eb3 117
robt 0:39daa30e0eb3 118 void MobileLCD::_select() {
robt 0:39daa30e0eb3 119 _cs = 0;
robt 0:39daa30e0eb3 120 }
robt 0:39daa30e0eb3 121
robt 0:39daa30e0eb3 122 void MobileLCD::_deselect() {
robt 0:39daa30e0eb3 123 _cs = 1;
robt 0:39daa30e0eb3 124 }
robt 0:39daa30e0eb3 125
robt 0:39daa30e0eb3 126 int MobileLCD::width() {
robt 0:39daa30e0eb3 127 return _width;
robt 0:39daa30e0eb3 128 }
robt 0:39daa30e0eb3 129
robt 0:39daa30e0eb3 130 int MobileLCD::height() {
robt 0:39daa30e0eb3 131 return _height;
robt 0:39daa30e0eb3 132 }
robt 0:39daa30e0eb3 133
robt 0:39daa30e0eb3 134 int MobileLCD::columns() {
robt 0:39daa30e0eb3 135 return _columns;
robt 0:39daa30e0eb3 136 }
robt 0:39daa30e0eb3 137
robt 0:39daa30e0eb3 138 int MobileLCD::rows() {
robt 0:39daa30e0eb3 139 return _rows;
robt 0:39daa30e0eb3 140 }
robt 0:39daa30e0eb3 141
robt 0:39daa30e0eb3 142 void MobileLCD::foreground(int v) {
robt 0:39daa30e0eb3 143 _foreground = v;
robt 0:39daa30e0eb3 144 }
robt 0:39daa30e0eb3 145
robt 0:39daa30e0eb3 146 void MobileLCD::background(int v) {
robt 0:39daa30e0eb3 147 _background = v;
robt 0:39daa30e0eb3 148 }
robt 0:39daa30e0eb3 149
robt 0:39daa30e0eb3 150 void MobileLCD::locate(int column, int row) {
robt 0:39daa30e0eb3 151 _row = row;
robt 0:39daa30e0eb3 152 _column = column;
robt 0:39daa30e0eb3 153 }
robt 0:39daa30e0eb3 154
robt 0:39daa30e0eb3 155 void MobileLCD::newline() {
robt 0:39daa30e0eb3 156 _column = 0;
robt 0:39daa30e0eb3 157 _row++;
robt 0:39daa30e0eb3 158 if(_row >= _rows) {
robt 0:39daa30e0eb3 159 _row = 0;
robt 0:39daa30e0eb3 160 }
robt 0:39daa30e0eb3 161 }
robt 0:39daa30e0eb3 162
robt 0:39daa30e0eb3 163 /*************************************************************************/
robt 0:39daa30e0eb3 164
robt 0:39daa30e0eb3 165 MobileLCD::MobileLCD(PinName mosi, PinName miso, PinName clk, PinName cs, PinName rst)
robt 0:39daa30e0eb3 166 : _spi(mosi, miso, clk)
robt 0:39daa30e0eb3 167 , _rst(rst)
robt 0:39daa30e0eb3 168 , _cs(cs) {
robt 0:39daa30e0eb3 169
robt 0:39daa30e0eb3 170 _row = 0;
robt 0:39daa30e0eb3 171 _column = 0;
robt 0:39daa30e0eb3 172 _rows = 16;
robt 0:39daa30e0eb3 173 _columns = 16;
robt 0:39daa30e0eb3 174 _width = 130;
robt 0:39daa30e0eb3 175 _height = 130;
robt 0:39daa30e0eb3 176 foreground(0xFFFFFF);
robt 0:39daa30e0eb3 177 background(0x000000);
robt 0:39daa30e0eb3 178 reset();
robt 0:39daa30e0eb3 179 }
robt 0:39daa30e0eb3 180
robt 0:39daa30e0eb3 181 void MobileLCD::reset() {
robt 0:39daa30e0eb3 182
robt 0:39daa30e0eb3 183 _cs = 1;
robt 0:39daa30e0eb3 184 _rst = 0;
robt 0:39daa30e0eb3 185 _spi.format(9);
robt 0:39daa30e0eb3 186 _spi.frequency(5000000);
robt 0:39daa30e0eb3 187
robt 0:39daa30e0eb3 188 wait_ms(1);
robt 0:39daa30e0eb3 189
robt 0:39daa30e0eb3 190 _rst = 1;
robt 0:39daa30e0eb3 191
robt 0:39daa30e0eb3 192 wait_ms(1);
robt 0:39daa30e0eb3 193
robt 0:39daa30e0eb3 194 _select();
robt 0:39daa30e0eb3 195
robt 0:39daa30e0eb3 196 command(0xCA); // display control
robt 0:39daa30e0eb3 197 data(0x0);
robt 0:39daa30e0eb3 198 data(31);
robt 0:39daa30e0eb3 199 data(0x0);
robt 0:39daa30e0eb3 200
robt 0:39daa30e0eb3 201 command(0xBB); // scan
robt 0:39daa30e0eb3 202 data(0x1);
robt 0:39daa30e0eb3 203
robt 0:39daa30e0eb3 204 command(0xD1); // oscillator on
robt 0:39daa30e0eb3 205 command(0x94); // sleep out
robt 0:39daa30e0eb3 206 command(0x20); // power control
robt 0:39daa30e0eb3 207 data(0x0F);
robt 0:39daa30e0eb3 208
robt 0:39daa30e0eb3 209 command(0xA7); // invert display
robt 0:39daa30e0eb3 210
robt 0:39daa30e0eb3 211 command(0x81); // Voltage control
robt 0:39daa30e0eb3 212 data(39); // contrast setting: 0..63
robt 0:39daa30e0eb3 213 data(3); // resistance ratio
robt 0:39daa30e0eb3 214
robt 0:39daa30e0eb3 215 wait_ms(1);
robt 0:39daa30e0eb3 216
robt 0:39daa30e0eb3 217 command(0xBC); // data control
robt 0:39daa30e0eb3 218 data(0x0); // scan dirs
robt 0:39daa30e0eb3 219 data(0x0); // RGB
robt 0:39daa30e0eb3 220 data(0x2); // grayscale
robt 0:39daa30e0eb3 221
robt 0:39daa30e0eb3 222 command(0xAF); // turn on the display
robt 0:39daa30e0eb3 223
robt 0:39daa30e0eb3 224 _deselect();
robt 0:39daa30e0eb3 225
robt 0:39daa30e0eb3 226 cls();
robt 0:39daa30e0eb3 227 }
robt 0:39daa30e0eb3 228
robt 0:39daa30e0eb3 229 void MobileLCD::_window(int x, int y, int width, int height) {
robt 0:39daa30e0eb3 230 int x1, x2, y1, y2;
robt 0:39daa30e0eb3 231 x1 = x + 0;
robt 0:39daa30e0eb3 232 y1 = y + 2;
robt 0:39daa30e0eb3 233 x2 = x1 + width - 1;
robt 0:39daa30e0eb3 234 y2 = y1 + height - 1;
robt 0:39daa30e0eb3 235 command(0x15); // column
robt 0:39daa30e0eb3 236 data(x1);
robt 0:39daa30e0eb3 237 data(x2);
robt 0:39daa30e0eb3 238 command(0x75); // page
robt 0:39daa30e0eb3 239 data(y1);
robt 0:39daa30e0eb3 240 data(y2);
robt 0:39daa30e0eb3 241 command(0x5C); // start write to ram
robt 0:39daa30e0eb3 242 }
robt 0:39daa30e0eb3 243
robt 0:39daa30e0eb3 244 void MobileLCD::fill(int x, int y, int width, int height, int colour) {
robt 0:39daa30e0eb3 245 _select();
robt 0:39daa30e0eb3 246 _window(x, y, width, height);
robt 0:39daa30e0eb3 247
robt 0:39daa30e0eb3 248 int r4 = (colour >> (16 + 4)) & 0xF;
robt 0:39daa30e0eb3 249 int g4 = (colour >> (8 + 4)) & 0xF;
robt 0:39daa30e0eb3 250 int b4 = (colour >> (0 + 4)) & 0xF;
robt 0:39daa30e0eb3 251
robt 0:39daa30e0eb3 252 int d1 = (r4 << 4) | g4;
robt 0:39daa30e0eb3 253 int d2 = (b4 << 4) | r4;
robt 0:39daa30e0eb3 254 int d3 = (g4 << 4) | b4;
robt 0:39daa30e0eb3 255
robt 0:39daa30e0eb3 256 for(int i=0; i<(width*height+1)/2; i++) {
robt 0:39daa30e0eb3 257 data(d1);
robt 0:39daa30e0eb3 258 data(d2);
robt 0:39daa30e0eb3 259 data(d3);
robt 0:39daa30e0eb3 260 }
robt 0:39daa30e0eb3 261 _deselect();
robt 0:39daa30e0eb3 262 }
robt 0:39daa30e0eb3 263
robt 0:39daa30e0eb3 264 void MobileLCD::bitblit(int x, int y, int width, int height, const char* bitstream) {
robt 0:39daa30e0eb3 265 _select();
robt 0:39daa30e0eb3 266 _window(x, y, width, height);
robt 0:39daa30e0eb3 267 for(int i=0; i<height*width/2; i++) {
robt 0:39daa30e0eb3 268 int byte1 = (i*2) / 8;
robt 0:39daa30e0eb3 269 int bit1 = (i*2) % 8;
robt 0:39daa30e0eb3 270 int colour1 = ((bitstream[byte1] << bit1) & 0x80) ? _foreground : _background;
robt 0:39daa30e0eb3 271 int byte2 = (i*2+1) / 8;
robt 0:39daa30e0eb3 272 int bit2 = (i*2+1) % 8;
robt 0:39daa30e0eb3 273 int colour2 = ((bitstream[byte2] << bit2) & 0x80) ? _foreground : _background;
robt 0:39daa30e0eb3 274
robt 0:39daa30e0eb3 275 int r41 = (colour1 >> (16 + 4)) & 0xF;
robt 0:39daa30e0eb3 276 int g41 = (colour1 >> (8 + 4)) & 0xF;
robt 0:39daa30e0eb3 277 int b41 = (colour1 >> (0 + 4)) & 0xF;
robt 0:39daa30e0eb3 278
robt 0:39daa30e0eb3 279 int r42 = (colour2 >> (16 + 4)) & 0xF;
robt 0:39daa30e0eb3 280 int g42 = (colour2 >> (8 + 4)) & 0xF;
robt 0:39daa30e0eb3 281 int b42 = (colour2 >> (0 + 4)) & 0xF;
robt 0:39daa30e0eb3 282 int d1 = (r41 << 4) | g41;
robt 0:39daa30e0eb3 283 int d2 = (b41 << 4) | r42;
robt 0:39daa30e0eb3 284 int d3 = (g42 << 4) | b42;
robt 0:39daa30e0eb3 285 data(d1);
robt 0:39daa30e0eb3 286 data(d2);
robt 0:39daa30e0eb3 287 data(d3);
robt 0:39daa30e0eb3 288 }
robt 0:39daa30e0eb3 289 _deselect();
robt 0:39daa30e0eb3 290 }
robt 0:39daa30e0eb3 291
robt 0:39daa30e0eb3 292 void MobileLCD::cls() {
robt 0:39daa30e0eb3 293 fill(0, 0, 130, 130, _background);
robt 0:39daa30e0eb3 294 _row = 0;
robt 0:39daa30e0eb3 295 _column = 0;
robt 0:39daa30e0eb3 296 }
robt 0:39daa30e0eb3 297
robt 0:39daa30e0eb3 298 int MobileLCD::_putc(int value) {
robt 0:39daa30e0eb3 299 int x = _column * 8; // FIXME: Char sizes
robt 0:39daa30e0eb3 300 int y = _row * 8;
robt 0:39daa30e0eb3 301 bitblit(x + 1, y + 1, 8, 8, (char*)&(FONT8x8[value - 0x1F][0]));
robt 0:39daa30e0eb3 302
robt 0:39daa30e0eb3 303 _column++;
robt 0:39daa30e0eb3 304
robt 0:39daa30e0eb3 305 if(_column >= _columns) {
robt 0:39daa30e0eb3 306 _row++;
robt 0:39daa30e0eb3 307 _column = 0;
robt 0:39daa30e0eb3 308 }
robt 0:39daa30e0eb3 309
robt 0:39daa30e0eb3 310 if(_row >= _rows) {
robt 0:39daa30e0eb3 311 _row = 0;
robt 0:39daa30e0eb3 312 }
robt 0:39daa30e0eb3 313
robt 0:39daa30e0eb3 314 return value;
robt 0:39daa30e0eb3 315 }
robt 0:39daa30e0eb3 316
robt 0:39daa30e0eb3 317 void MobileLCD::pixel(int x, int y, int colour) {
robt 0:39daa30e0eb3 318 fill(x, y, 1, 1, colour);
robt 0:39daa30e0eb3 319 }
robt 0:39daa30e0eb3 320