Dependents:   4180_lab4_project

Fork of 4DGL-uLCD-SE by Jonathan Austin

Committer:
hotwheelharry
Date:
Tue Oct 21 16:12:49 2014 +0000
Revision:
1:932d76a5b290

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hotwheelharry 1:932d76a5b290 1 //
hotwheelharry 1:932d76a5b290 2 // uLCD_4DGL is a class to drive 4D Systems TFT touch screens
hotwheelharry 1:932d76a5b290 3 //
hotwheelharry 1:932d76a5b290 4 // Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr>
hotwheelharry 1:932d76a5b290 5 // Modifed for Goldelox processor <2013> Jim Hamblen
hotwheelharry 1:932d76a5b290 6 //
hotwheelharry 1:932d76a5b290 7 // uLCD_4DGL is free software: you can redistribute it and/or modify
hotwheelharry 1:932d76a5b290 8 // it under the terms of the GNU General Public License as published by
hotwheelharry 1:932d76a5b290 9 // the Free Software Foundation, either version 3 of the License, or
hotwheelharry 1:932d76a5b290 10 // (at your option) any later version.
hotwheelharry 1:932d76a5b290 11 //
hotwheelharry 1:932d76a5b290 12 // uLCD_4DGL is distributed in the hope that it will be useful,
hotwheelharry 1:932d76a5b290 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
hotwheelharry 1:932d76a5b290 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
hotwheelharry 1:932d76a5b290 15 // GNU General Public License for more details.
hotwheelharry 1:932d76a5b290 16 //
hotwheelharry 1:932d76a5b290 17 // You should have received a copy of the GNU General Public License
hotwheelharry 1:932d76a5b290 18 // along with uLCD_4DGL. If not, see <http://www.gnu.org/licenses/>.
hotwheelharry 1:932d76a5b290 19
hotwheelharry 1:932d76a5b290 20 #include "mbed.h"
hotwheelharry 1:932d76a5b290 21 #include "uLCD_4DGL.h"
hotwheelharry 1:932d76a5b290 22
hotwheelharry 1:932d76a5b290 23 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 24 void uLCD_4DGL :: set_font_size(char width, char height) // set font size
hotwheelharry 1:932d76a5b290 25 {
hotwheelharry 1:932d76a5b290 26 if (current_orientation == IS_PORTRAIT) {
hotwheelharry 1:932d76a5b290 27 current_fx = width;
hotwheelharry 1:932d76a5b290 28 current_fy = height;
hotwheelharry 1:932d76a5b290 29 } else {
hotwheelharry 1:932d76a5b290 30 current_fy = height;
hotwheelharry 1:932d76a5b290 31 current_fx = width;
hotwheelharry 1:932d76a5b290 32 }
hotwheelharry 1:932d76a5b290 33 max_col = current_w / (current_fx*current_wf);
hotwheelharry 1:932d76a5b290 34 max_row = current_h / (current_fy*current_hf);
hotwheelharry 1:932d76a5b290 35 }
hotwheelharry 1:932d76a5b290 36
hotwheelharry 1:932d76a5b290 37 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 38 void uLCD_4DGL :: set_font(char mode) // set font - system or SD media
hotwheelharry 1:932d76a5b290 39 {
hotwheelharry 1:932d76a5b290 40 char command[3]= "";
hotwheelharry 1:932d76a5b290 41
hotwheelharry 1:932d76a5b290 42 command[0] = SETFONT;
hotwheelharry 1:932d76a5b290 43 command[1] = 0;
hotwheelharry 1:932d76a5b290 44 command[2] = mode;
hotwheelharry 1:932d76a5b290 45
hotwheelharry 1:932d76a5b290 46 current_font = mode;
hotwheelharry 1:932d76a5b290 47
hotwheelharry 1:932d76a5b290 48 if (current_orientation == IS_PORTRAIT) {
hotwheelharry 1:932d76a5b290 49 current_w = SIZE_X;
hotwheelharry 1:932d76a5b290 50 current_h = SIZE_Y;
hotwheelharry 1:932d76a5b290 51 } else {
hotwheelharry 1:932d76a5b290 52 current_w = SIZE_Y;
hotwheelharry 1:932d76a5b290 53 current_h = SIZE_X;
hotwheelharry 1:932d76a5b290 54 }
hotwheelharry 1:932d76a5b290 55
hotwheelharry 1:932d76a5b290 56 switch (mode) {
hotwheelharry 1:932d76a5b290 57 case FONT_5X7 :
hotwheelharry 1:932d76a5b290 58
hotwheelharry 1:932d76a5b290 59 current_fx = 6;
hotwheelharry 1:932d76a5b290 60 current_fy = 8;
hotwheelharry 1:932d76a5b290 61 break;
hotwheelharry 1:932d76a5b290 62 case FONT_7X8 :
hotwheelharry 1:932d76a5b290 63 current_fx = 7;
hotwheelharry 1:932d76a5b290 64 current_fy = 8;
hotwheelharry 1:932d76a5b290 65 break;
hotwheelharry 1:932d76a5b290 66 case FONT_8X8 :
hotwheelharry 1:932d76a5b290 67 current_fx = 8;
hotwheelharry 1:932d76a5b290 68 current_fy = 8;
hotwheelharry 1:932d76a5b290 69 break;
hotwheelharry 1:932d76a5b290 70 case FONT_8X12 :
hotwheelharry 1:932d76a5b290 71 current_fx = 8;
hotwheelharry 1:932d76a5b290 72 current_fy = 12;
hotwheelharry 1:932d76a5b290 73 break;
hotwheelharry 1:932d76a5b290 74 case FONT_12X16 :
hotwheelharry 1:932d76a5b290 75 current_fx = 12;
hotwheelharry 1:932d76a5b290 76 current_fy = 16;
hotwheelharry 1:932d76a5b290 77 break;
hotwheelharry 1:932d76a5b290 78 default:
hotwheelharry 1:932d76a5b290 79 current_fx = 8;
hotwheelharry 1:932d76a5b290 80 current_fy = 8;
hotwheelharry 1:932d76a5b290 81 }
hotwheelharry 1:932d76a5b290 82
hotwheelharry 1:932d76a5b290 83 max_col = current_w / (current_fx*current_wf);
hotwheelharry 1:932d76a5b290 84 max_row = current_h / (current_fy*current_hf);
hotwheelharry 1:932d76a5b290 85
hotwheelharry 1:932d76a5b290 86 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 87 }
hotwheelharry 1:932d76a5b290 88
hotwheelharry 1:932d76a5b290 89
hotwheelharry 1:932d76a5b290 90
hotwheelharry 1:932d76a5b290 91 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 92 void uLCD_4DGL :: text_mode(char mode) // set text mode
hotwheelharry 1:932d76a5b290 93 {
hotwheelharry 1:932d76a5b290 94 char command[3]= "";
hotwheelharry 1:932d76a5b290 95
hotwheelharry 1:932d76a5b290 96 command[0] = TEXTMODE;
hotwheelharry 1:932d76a5b290 97 command[1] = 0;
hotwheelharry 1:932d76a5b290 98 command[2] = mode;
hotwheelharry 1:932d76a5b290 99
hotwheelharry 1:932d76a5b290 100 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 101 }
hotwheelharry 1:932d76a5b290 102
hotwheelharry 1:932d76a5b290 103 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 104 void uLCD_4DGL :: text_bold(char mode) // set text mode
hotwheelharry 1:932d76a5b290 105 {
hotwheelharry 1:932d76a5b290 106 char command[3]= "";
hotwheelharry 1:932d76a5b290 107
hotwheelharry 1:932d76a5b290 108 command[0] = TEXTBOLD;
hotwheelharry 1:932d76a5b290 109 command[1] = 0;
hotwheelharry 1:932d76a5b290 110 command[2] = mode;
hotwheelharry 1:932d76a5b290 111
hotwheelharry 1:932d76a5b290 112 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 113 }
hotwheelharry 1:932d76a5b290 114
hotwheelharry 1:932d76a5b290 115 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 116 void uLCD_4DGL :: text_italic(char mode) // set text mode
hotwheelharry 1:932d76a5b290 117 {
hotwheelharry 1:932d76a5b290 118 char command[3]= "";
hotwheelharry 1:932d76a5b290 119
hotwheelharry 1:932d76a5b290 120 command[0] = TEXTITALIC;
hotwheelharry 1:932d76a5b290 121 command[1] = 0;
hotwheelharry 1:932d76a5b290 122 command[2] = mode;
hotwheelharry 1:932d76a5b290 123
hotwheelharry 1:932d76a5b290 124 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 125 }
hotwheelharry 1:932d76a5b290 126
hotwheelharry 1:932d76a5b290 127 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 128 void uLCD_4DGL :: text_inverse(char mode) // set text mode
hotwheelharry 1:932d76a5b290 129 {
hotwheelharry 1:932d76a5b290 130 char command[3]= "";
hotwheelharry 1:932d76a5b290 131
hotwheelharry 1:932d76a5b290 132 command[0] = TEXTINVERSE;
hotwheelharry 1:932d76a5b290 133 command[1] = 0;
hotwheelharry 1:932d76a5b290 134 command[2] = mode;
hotwheelharry 1:932d76a5b290 135
hotwheelharry 1:932d76a5b290 136 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 137 }
hotwheelharry 1:932d76a5b290 138
hotwheelharry 1:932d76a5b290 139 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 140 void uLCD_4DGL :: text_underline(char mode) // set text mode
hotwheelharry 1:932d76a5b290 141 {
hotwheelharry 1:932d76a5b290 142 char command[3]= "";
hotwheelharry 1:932d76a5b290 143
hotwheelharry 1:932d76a5b290 144 command[0] = TEXTUNDERLINE;
hotwheelharry 1:932d76a5b290 145 command[1] = 0;
hotwheelharry 1:932d76a5b290 146 command[2] = mode;
hotwheelharry 1:932d76a5b290 147
hotwheelharry 1:932d76a5b290 148 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 149 }
hotwheelharry 1:932d76a5b290 150
hotwheelharry 1:932d76a5b290 151 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 152 void uLCD_4DGL :: text_width(char width) // set text width
hotwheelharry 1:932d76a5b290 153 {
hotwheelharry 1:932d76a5b290 154 char command[3]= "";
hotwheelharry 1:932d76a5b290 155
hotwheelharry 1:932d76a5b290 156 command[0] = TEXTWIDTH;
hotwheelharry 1:932d76a5b290 157 command[1] = 0;
hotwheelharry 1:932d76a5b290 158 command[2] = width;
hotwheelharry 1:932d76a5b290 159 current_wf = width;
hotwheelharry 1:932d76a5b290 160 max_col = current_w / (current_fx*current_wf);
hotwheelharry 1:932d76a5b290 161 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 162 }
hotwheelharry 1:932d76a5b290 163
hotwheelharry 1:932d76a5b290 164 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 165 void uLCD_4DGL :: text_height(char height) // set text height
hotwheelharry 1:932d76a5b290 166 {
hotwheelharry 1:932d76a5b290 167 char command[3]= "";
hotwheelharry 1:932d76a5b290 168
hotwheelharry 1:932d76a5b290 169 command[0] = TEXTHEIGHT;
hotwheelharry 1:932d76a5b290 170 command[1] = 0;
hotwheelharry 1:932d76a5b290 171 command[2] = height;
hotwheelharry 1:932d76a5b290 172 current_hf = height;
hotwheelharry 1:932d76a5b290 173 max_row = current_h / (current_fy*current_hf);
hotwheelharry 1:932d76a5b290 174 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 175 }
hotwheelharry 1:932d76a5b290 176
hotwheelharry 1:932d76a5b290 177
hotwheelharry 1:932d76a5b290 178 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 179 void uLCD_4DGL :: text_char(char c, char col, char row, int color) // draw a text char
hotwheelharry 1:932d76a5b290 180 {
hotwheelharry 1:932d76a5b290 181 char command[6]= "";
hotwheelharry 1:932d76a5b290 182 command[0] = 0xE4; //move cursor
hotwheelharry 1:932d76a5b290 183 command[1] = 0;
hotwheelharry 1:932d76a5b290 184 command[2] = row;
hotwheelharry 1:932d76a5b290 185 command[3] = 0;
hotwheelharry 1:932d76a5b290 186 command[4] = col;
hotwheelharry 1:932d76a5b290 187 writeCOMMAND(command, 5);
hotwheelharry 1:932d76a5b290 188
hotwheelharry 1:932d76a5b290 189 command[0] = 0x7F; //set color
hotwheelharry 1:932d76a5b290 190
hotwheelharry 1:932d76a5b290 191 int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits
hotwheelharry 1:932d76a5b290 192 int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits
hotwheelharry 1:932d76a5b290 193 int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits
hotwheelharry 1:932d76a5b290 194
hotwheelharry 1:932d76a5b290 195 command[1] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
hotwheelharry 1:932d76a5b290 196 command[2] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
hotwheelharry 1:932d76a5b290 197 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 198
hotwheelharry 1:932d76a5b290 199 command[0] = TEXTCHAR; //print char
hotwheelharry 1:932d76a5b290 200 command[1] = 0;
hotwheelharry 1:932d76a5b290 201 command[2] = c;
hotwheelharry 1:932d76a5b290 202 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 203
hotwheelharry 1:932d76a5b290 204 }
hotwheelharry 1:932d76a5b290 205
hotwheelharry 1:932d76a5b290 206
hotwheelharry 1:932d76a5b290 207 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 208 void uLCD_4DGL :: text_string(char *s, char col, char row, char font, int color) // draw a text string
hotwheelharry 1:932d76a5b290 209 {
hotwheelharry 1:932d76a5b290 210
hotwheelharry 1:932d76a5b290 211 char command[1000]= "";
hotwheelharry 1:932d76a5b290 212 int size = strlen(s);
hotwheelharry 1:932d76a5b290 213 int i = 0;
hotwheelharry 1:932d76a5b290 214
hotwheelharry 1:932d76a5b290 215 set_font(font);
hotwheelharry 1:932d76a5b290 216
hotwheelharry 1:932d76a5b290 217 command[0] = 0xE4; //move cursor
hotwheelharry 1:932d76a5b290 218 command[1] = 0;
hotwheelharry 1:932d76a5b290 219 command[2] = row;
hotwheelharry 1:932d76a5b290 220 command[3] = 0;
hotwheelharry 1:932d76a5b290 221 command[4] = col;
hotwheelharry 1:932d76a5b290 222 writeCOMMAND(command, 5);
hotwheelharry 1:932d76a5b290 223
hotwheelharry 1:932d76a5b290 224 command[0] = 0x7F; //set color
hotwheelharry 1:932d76a5b290 225 int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits
hotwheelharry 1:932d76a5b290 226 int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits
hotwheelharry 1:932d76a5b290 227 int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits
hotwheelharry 1:932d76a5b290 228
hotwheelharry 1:932d76a5b290 229 command[1] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
hotwheelharry 1:932d76a5b290 230 command[2] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
hotwheelharry 1:932d76a5b290 231 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 232
hotwheelharry 1:932d76a5b290 233 command[0] = TEXTSTRING;
hotwheelharry 1:932d76a5b290 234 for (i=0; i<size; i++) command[1+i] = s[i];
hotwheelharry 1:932d76a5b290 235 command[1+size] = 0;
hotwheelharry 1:932d76a5b290 236 writeCOMMANDnull(command, 2 + size);
hotwheelharry 1:932d76a5b290 237 }
hotwheelharry 1:932d76a5b290 238
hotwheelharry 1:932d76a5b290 239
hotwheelharry 1:932d76a5b290 240
hotwheelharry 1:932d76a5b290 241 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 242 void uLCD_4DGL :: locate(char col, char row) // place text curssor at col, row
hotwheelharry 1:932d76a5b290 243 {
hotwheelharry 1:932d76a5b290 244 char command[5] = "";
hotwheelharry 1:932d76a5b290 245 current_col = col;
hotwheelharry 1:932d76a5b290 246 current_row = row;
hotwheelharry 1:932d76a5b290 247 command[0] = MOVECURSOR; //move cursor
hotwheelharry 1:932d76a5b290 248 command[1] = 0;
hotwheelharry 1:932d76a5b290 249 command[2] = current_row;
hotwheelharry 1:932d76a5b290 250 command[3] = 0;
hotwheelharry 1:932d76a5b290 251 command[4] = current_col;
hotwheelharry 1:932d76a5b290 252 writeCOMMAND(command, 5);
hotwheelharry 1:932d76a5b290 253 }
hotwheelharry 1:932d76a5b290 254
hotwheelharry 1:932d76a5b290 255 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 256 void uLCD_4DGL :: color(int color) // set text color
hotwheelharry 1:932d76a5b290 257 {
hotwheelharry 1:932d76a5b290 258 char command[5] = "";
hotwheelharry 1:932d76a5b290 259 current_color = color;
hotwheelharry 1:932d76a5b290 260 command[0] = 0x7F; //set color
hotwheelharry 1:932d76a5b290 261
hotwheelharry 1:932d76a5b290 262 int red5 = (color >> (16 + 3)) & 0x1F; // get red on 5 bits
hotwheelharry 1:932d76a5b290 263 int green6 = (color >> (8 + 2)) & 0x3F; // get green on 6 bits
hotwheelharry 1:932d76a5b290 264 int blue5 = (color >> (0 + 3)) & 0x1F; // get blue on 5 bits
hotwheelharry 1:932d76a5b290 265
hotwheelharry 1:932d76a5b290 266 command[1] = ((red5 << 3) + (green6 >> 3)) & 0xFF; // first part of 16 bits color
hotwheelharry 1:932d76a5b290 267 command[2] = ((green6 << 5) + (blue5 >> 0)) & 0xFF; // second part of 16 bits color
hotwheelharry 1:932d76a5b290 268 writeCOMMAND(command, 3);
hotwheelharry 1:932d76a5b290 269 }
hotwheelharry 1:932d76a5b290 270
hotwheelharry 1:932d76a5b290 271 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 272 void uLCD_4DGL :: putc(char c) // place char at current cursor position
hotwheelharry 1:932d76a5b290 273 //used by virtual printf function _putc
hotwheelharry 1:932d76a5b290 274 {
hotwheelharry 1:932d76a5b290 275 char command[6] ="";
hotwheelharry 1:932d76a5b290 276 if(c<0x20) {
hotwheelharry 1:932d76a5b290 277 if(c=='\n') {
hotwheelharry 1:932d76a5b290 278 current_col = 0;
hotwheelharry 1:932d76a5b290 279 current_row++;
hotwheelharry 1:932d76a5b290 280 command[0] = MOVECURSOR; //move cursor to start of next line
hotwheelharry 1:932d76a5b290 281 command[1] = 0;
hotwheelharry 1:932d76a5b290 282 command[2] = current_row;
hotwheelharry 1:932d76a5b290 283 command[3] = 0;
hotwheelharry 1:932d76a5b290 284 command[4] = current_col;
hotwheelharry 1:932d76a5b290 285 writeCOMMAND(command, 5);
hotwheelharry 1:932d76a5b290 286 }
hotwheelharry 1:932d76a5b290 287 if(c=='\r') {
hotwheelharry 1:932d76a5b290 288 current_col = 0;
hotwheelharry 1:932d76a5b290 289 command[0] = MOVECURSOR; //move cursor to start of line
hotwheelharry 1:932d76a5b290 290 command[1] = 0;
hotwheelharry 1:932d76a5b290 291 command[2] = current_row;
hotwheelharry 1:932d76a5b290 292 command[3] = 0;
hotwheelharry 1:932d76a5b290 293 command[4] = current_col;
hotwheelharry 1:932d76a5b290 294 writeCOMMAND(command, 5);
hotwheelharry 1:932d76a5b290 295 }
hotwheelharry 1:932d76a5b290 296 if(c=='\f') {
hotwheelharry 1:932d76a5b290 297 uLCD_4DGL::cls(); //clear screen on form feed
hotwheelharry 1:932d76a5b290 298 }
hotwheelharry 1:932d76a5b290 299 } else {
hotwheelharry 1:932d76a5b290 300 command[0] = PUTCHAR;
hotwheelharry 1:932d76a5b290 301 command[1] = 0x00;
hotwheelharry 1:932d76a5b290 302 command[2] = c;
hotwheelharry 1:932d76a5b290 303 writeCOMMAND(command,3);
hotwheelharry 1:932d76a5b290 304 current_col++;
hotwheelharry 1:932d76a5b290 305 }
hotwheelharry 1:932d76a5b290 306 if (current_col == max_col) {
hotwheelharry 1:932d76a5b290 307 current_col = 0;
hotwheelharry 1:932d76a5b290 308 current_row++;
hotwheelharry 1:932d76a5b290 309 command[0] = MOVECURSOR; //move cursor to next line
hotwheelharry 1:932d76a5b290 310 command[1] = 0;
hotwheelharry 1:932d76a5b290 311 command[2] = current_row;
hotwheelharry 1:932d76a5b290 312 command[3] = 0;
hotwheelharry 1:932d76a5b290 313 command[4] = current_col;
hotwheelharry 1:932d76a5b290 314 writeCOMMAND(command, 5);
hotwheelharry 1:932d76a5b290 315 }
hotwheelharry 1:932d76a5b290 316 if (current_row == max_row) {
hotwheelharry 1:932d76a5b290 317 current_row = 0;
hotwheelharry 1:932d76a5b290 318 command[0] = MOVECURSOR; //move cursor back to start
hotwheelharry 1:932d76a5b290 319 command[1] = 0;
hotwheelharry 1:932d76a5b290 320 command[2] = current_row;
hotwheelharry 1:932d76a5b290 321 command[3] = 0;
hotwheelharry 1:932d76a5b290 322 command[4] = current_col;
hotwheelharry 1:932d76a5b290 323 writeCOMMAND(command, 5);
hotwheelharry 1:932d76a5b290 324 }
hotwheelharry 1:932d76a5b290 325 }
hotwheelharry 1:932d76a5b290 326
hotwheelharry 1:932d76a5b290 327
hotwheelharry 1:932d76a5b290 328 //****************************************************************************************************
hotwheelharry 1:932d76a5b290 329 void uLCD_4DGL :: puts(char *s) // place string at current cursor position
hotwheelharry 1:932d76a5b290 330 {
hotwheelharry 1:932d76a5b290 331
hotwheelharry 1:932d76a5b290 332 text_string(s, current_col, current_row, current_font, current_color);
hotwheelharry 1:932d76a5b290 333
hotwheelharry 1:932d76a5b290 334 current_col += strlen(s);
hotwheelharry 1:932d76a5b290 335
hotwheelharry 1:932d76a5b290 336 if (current_col >= max_col) {
hotwheelharry 1:932d76a5b290 337 current_row += current_col / max_col;
hotwheelharry 1:932d76a5b290 338 current_col %= max_col;
hotwheelharry 1:932d76a5b290 339 }
hotwheelharry 1:932d76a5b290 340 if (current_row >= max_row) {
hotwheelharry 1:932d76a5b290 341 current_row %= max_row;
hotwheelharry 1:932d76a5b290 342 }
hotwheelharry 1:932d76a5b290 343 }