Created
June 10, 2018 20:25
-
-
Save qwerty13/c1600248b2ec1f2ecddfc27c01381b71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Persian Writing Function in 5110 Nokia LCD | |
* Created by qwerty13 | |
* Share it with Permision only! | |
* qwerty13.ir | |
* 0937-6095913 | |
* | |
*/ | |
#include <SPI.h> | |
#include <Adafruit_GFX.h> | |
#include <Adafruit_PCD8544.h> | |
Adafruit_PCD8544 display = Adafruit_PCD8544(2, 3, 4, 5, 6);// SCK DIN D/C CS RST | |
const unsigned char alef1 [] PROGMEM= { | |
0x00, 0x1C, 0x20, 0x08, 0x08, 0x08, 0x08, 0x00, | |
}; | |
const unsigned char alef2 [] PROGMEM= { | |
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, | |
}; | |
const unsigned char alef3 [] PROGMEM= { | |
0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, | |
}; | |
const unsigned char be1 [] PROGMEM= { | |
0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 0x02, | |
}; | |
const unsigned char be2 [] PROGMEM= { | |
0x00, 0x00, 0x40, 0x81, 0x81, 0x7E, 0x00, 0x10, | |
}; | |
const unsigned char pe1 [] PROGMEM= { | |
0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 0x07, | |
}; | |
const unsigned char pe2 [] PROGMEM= { | |
0x00, 0x00, 0x40, 0x81, 0x81, 0x7E, 0x00, 0x38, | |
}; | |
const unsigned char te1 [] PROGMEM= { | |
0x00, 0x03, 0x00, 0x01, 0x01, 0x06, 0x00, 0x00, | |
}; | |
const unsigned char te2 [] PROGMEM= { | |
0x00, 0x14, 0x40, 0x81, 0x81, 0x7E, 0x00, 0x00, | |
}; | |
const unsigned char the1 [] PROGMEM= { | |
0x02, 0x05, 0x00, 0x01, 0x01, 0x06, 0x00, 0x00, | |
}; | |
const unsigned char the2 [] PROGMEM= { | |
0x08, 0x14, 0x40, 0x81, 0x81, 0x7E, 0x00, 0x00, | |
}; | |
const unsigned char jim1 [] PROGMEM= { | |
0x00, 0x00, 0x0C, 0x12, 0x01, 0x3E, 0x00, 0x04, | |
}; | |
const unsigned char jim2 [] PROGMEM= { | |
0x00, 0x00, 0x0C, 0x12, 0x01, 0x3E, 0x40, 0x3A, | |
}; | |
const unsigned char che1 [] PROGMEM= { | |
0x00, 0x00, 0x0C, 0x12, 0x01, 0x3E, 0x00, 0x1C, | |
}; | |
const unsigned char che2 [] PROGMEM= { | |
0x00, 0x00, 0x0C, 0x12, 0x01, 0x3E, 0x40, 0x37, | |
}; | |
const unsigned char hee1 [] PROGMEM= { | |
0x00, 0x00, 0x0C, 0x12, 0x01, 0x3E, 0x00, 0x00, | |
}; | |
const unsigned char hee2 [] PROGMEM= { | |
0x00, 0x00, 0x0C, 0x12, 0x01, 0x3E, 0x40, 0x38, | |
}; | |
const unsigned char khe1 [] PROGMEM= { | |
0x00, 0x20, 0x0C, 0x12, 0x01, 0x3E, 0x00, 0x00, | |
}; | |
const unsigned char khe2 [] PROGMEM= { | |
0x00, 0x20, 0x0C, 0x12, 0x01, 0x3E, 0x40, 0x38, | |
}; | |
const unsigned char dal [] PROGMEM= { | |
0x00, 0x00, 0x04, 0x02, 0x01, 0x12, 0x0C, 0x00, | |
}; | |
const unsigned char zal [] PROGMEM= { | |
0x00, 0x10, 0x04, 0x02, 0x01, 0x12, 0x0C, 0x00, | |
}; | |
const unsigned char re [] PROGMEM= { | |
0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x0C, | |
}; | |
const unsigned char ze [] PROGMEM= { | |
0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x02, 0x0C, | |
}; | |
const unsigned char zhe [] PROGMEM= { | |
0x02, 0x05, 0x00, 0x01, 0x01, 0x01, 0x02, 0x0C, | |
}; | |
const unsigned char sin1 [] PROGMEM= { | |
0x00, 0x00, 0x00, 0x15, 0x15, 0x6A, 0x00, 0x00, | |
}; | |
const unsigned char sin2 [] PROGMEM= { | |
0x00, 0x00, 0x00, 0x15, 0x95, 0x9A, 0x90, 0x60, | |
}; | |
const unsigned char shin1 [] PROGMEM= { | |
0x04, 0x0A, 0x00, 0x15, 0x15, 0x6A, 0x00, 0x00, | |
}; | |
const unsigned char shin2 [] PROGMEM= { | |
0x04, 0x0A, 0x00, 0x15, 0x95, 0x9A, 0x90, 0x60, | |
}; | |
const unsigned char sad1 [] PROGMEM= { | |
0x00, 0x00, 0x06, 0x29, 0x31, 0x5E, 0x00, 0x00, | |
}; | |
const unsigned char sad2 [] PROGMEM= { | |
0x00, 0x00, 0x06, 0x49, 0x91, 0x9E, 0x90, 0x60, | |
}; | |
const unsigned char zad1 [] PROGMEM= { | |
0x00, 0x10, 0x06, 0x29, 0x31, 0x5E, 0x00, 0x00, | |
}; | |
const unsigned char zad2 [] PROGMEM= { | |
0x00, 0x10, 0x06, 0x49, 0x91, 0x9E, 0x90, 0x60, | |
}; | |
const unsigned char taa [] PROGMEM= { | |
0x00, 0x20, 0x26, 0x29, 0x31, 0x7E, 0x00, 0x00, | |
}; | |
const unsigned char zaa [] PROGMEM= { | |
0x00, 0x28, 0x26, 0x29, 0x31, 0x7E, 0x00, 0x00, | |
}; | |
const unsigned char ein1 [] PROGMEM= { | |
0x00, 0x00, 0x03, 0x04, 0x04, 0x0F, 0x00, 0x00, | |
}; | |
const unsigned char ein2 [] PROGMEM= { | |
0x00, 0x00, 0x1E, 0x22, 0x1C, 0x77, 0x00, 0x00, | |
}; | |
const unsigned char ein3 [] PROGMEM= { | |
0x00, 0x1E, 0x22, 0x1C, 0x24, 0x23, 0x20, 0x1C, | |
}; | |
const unsigned char ein4 [] PROGMEM= { | |
0x00, 0x03, 0x04, 0x04, 0x0F, 0x10, 0x10, 0x0F, | |
}; | |
const unsigned char qein1 [] PROGMEM= { | |
0x00, 0x08, 0x03, 0x04, 0x04, 0x0F, 0x00, 0x00, | |
}; | |
const unsigned char qein2 [] PROGMEM= { | |
0x08, 0x00, 0x1E, 0x22, 0x1C, 0x77, 0x00, 0x00, | |
}; | |
const unsigned char qein3 [] PROGMEM= { | |
0x40, 0x1E, 0x22, 0x1C, 0x24, 0x23, 0x20, 0x1C, | |
}; | |
const unsigned char qein4 [] PROGMEM= { | |
0x08, 0x03, 0x04, 0x04, 0x0F, 0x10, 0x10, 0x0F, | |
}; | |
const unsigned char fe1 [] PROGMEM= { | |
0x04, 0x00, 0x06, 0x09, 0x09, 0x1E, 0x00, 0x00, | |
}; | |
const unsigned char fe2 [] PROGMEM= { | |
0x04, 0x00, 0x06, 0x89, 0x89, 0x7E, 0x00, 0x00, | |
}; | |
const unsigned char qaf1 [] PROGMEM= { | |
0x06, 0x00, 0x06, 0x09, 0x09, 0x1E, 0x00, 0x00, | |
}; | |
const unsigned char qaf2 [] PROGMEM= { | |
0x06, 0x00, 0x06, 0x09, 0x49, 0x47, 0x41, 0x3E, | |
}; | |
const unsigned char kaf1 [] PROGMEM= { | |
0x00, 0x0F, 0x10, 0x1E, 0x01, 0x3E, 0x00, 0x00, | |
}; | |
const unsigned char kaf2 [] PROGMEM= { | |
0x00, 0x07, 0x08, 0x8E, 0x81, 0x7E, 0x00, 0x00, | |
}; | |
const unsigned char gaf1 [] PROGMEM= { | |
0x07, 0x0F, 0x10, 0x1E, 0x01, 0x3E, 0x00, 0x00, | |
}; | |
const unsigned char gaf2 [] PROGMEM= { | |
0x07, 0x0F, 0x10, 0x9E, 0x81, 0x7E, 0x00, 0x00, | |
}; | |
const unsigned char lam1 [] PROGMEM= { | |
0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x00, | |
}; | |
const unsigned char lam2 [] PROGMEM= { | |
0x00, 0x01, 0x01, 0x11, 0x21, 0x22, 0x1C, 0x00, | |
}; | |
const unsigned char mim1 [] PROGMEM= { | |
0x00, 0x00, 0x06, 0x09, 0x09, 0x36, 0x00, 0x00, | |
}; | |
const unsigned char mim2 [] PROGMEM= { | |
0x00, 0x04, 0x0A, 0x19, 0x29, 0x46, 0x40, 0x20, | |
}; | |
const unsigned char noon1 [] PROGMEM= { | |
0x00, 0x02, 0x00, 0x01, 0x01, 0x06, 0x00, 0x00, | |
}; | |
const unsigned char noon2 [] PROGMEM= { | |
0x00, 0x00, 0x08, 0x21, 0x41, 0x41, 0x22, 0x1C, | |
}; | |
const unsigned char vaav [] PROGMEM= { | |
0x00, 0x00, 0x06, 0x09, 0x09, 0x07, 0x01, 0x0E, | |
}; | |
const unsigned char he1 [] PROGMEM= { | |
0x08, 0x04, 0x0A, 0x15, 0x09, 0x36, 0x00, 0x00, | |
}; | |
const unsigned char he2 [] PROGMEM= { | |
0x00, 0x00, 0x30, 0x48, 0x56, 0xE9, 0x50, 0x20, | |
}; | |
const unsigned char he3 [] PROGMEM= { | |
0x00, 0x07, 0x09, 0x09, 0x05, 0x00, 0x00, 0x00, | |
}; | |
const unsigned char he4 [] PROGMEM= { | |
0x00, 0x08, 0x04, 0x0A, 0x11, 0x11, 0x0E, 0x00, | |
}; | |
const unsigned char ye1 [] PROGMEM= { | |
0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 0x06, | |
}; | |
const unsigned char ye2 [] PROGMEM= { | |
0x00, 0x00, 0x00, 0x4C, 0x92, 0x89, 0x84, 0x78, | |
}; | |
const unsigned char ye3 [] PROGMEM= { | |
0x00, 0x06, 0x29, 0x48, 0x46, 0x41, 0x21, 0x1E, | |
}; | |
const unsigned char soal [] PROGMEM= { | |
0x0C, 0x12, 0x10, 0x08, 0x04, 0x00, 0x04, 0x00, | |
}; | |
const unsigned char tajob [] PROGMEM= { | |
0x00, 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x00, | |
}; | |
const unsigned char vir [] PROGMEM= { | |
0x00, 0x00, 0x00, 0x04, 0x08, 0x0C, 0x0C, 0x00, | |
}; | |
const unsigned char kmn1 [] PROGMEM= { | |
0x10, 0x08, 0x04, 0x04, 0x04, 0x04, 0x08, 0x10, | |
}; | |
const unsigned char kmn2 [] PROGMEM= { | |
0x04, 0x08, 0x10, 0x10, 0x10, 0x10, 0x08, 0x04, | |
}; | |
void setup() { | |
display.setRotation(0); | |
display.begin(); | |
display.setContrast(46); | |
display_delay(500); | |
display.setTextSize(1); | |
display.setTextColor(BLACK); | |
display.setCursor(0,10); | |
display.drawRoundRect(0, 0, 84, 44, 3, BLACK); | |
display.fillRoundRect(0, 36, 84, 12, 3, BLACK); | |
fa_write("(فارسی نویسی در السیدی نوکیا ؟!.:،)",82,3,1,BLACK); | |
fa_write("کیوورتی سیزده :)",79,38,1,WHITE); | |
display.display(); | |
} | |
void loop() { | |
} | |
void fa_write(char *Text, int x, int y, int dis, uint16_t color){ | |
int cursor_x = x-8; | |
int cursor_y = y; | |
int haalat = 0; | |
unsigned char qloghat = ' '; | |
unsigned char loghat; | |
unsigned char bloghat; | |
unsigned char le; | |
while((le = *Text++)){ | |
if(le >= 128){ loghat = *Text++;loghat += 32;le += 32; | |
if(loghat == 207){if(le == 218||le == 250){ loghat = 144; //گ | |
}}else if(loghat == 166){ if(le == 218||le == 250){ //چ | |
loghat = 141;}else{ loghat = 228; //ن | |
}}}else{loghat = le;} | |
if(loghat==172){if(le==248||le==32){loghat=44;}} | |
le = *Text++; | |
if(le >= 128){bloghat = *Text++; bloghat += 32; le += 32; | |
if(bloghat == 207){if(le == 218||le == 250){ bloghat = 144; //گ | |
}}else if(bloghat == 166){if(le == 218||le == 250){ //چ | |
bloghat = 141; }else{bloghat = 228; //ن | |
}} | |
*Text--; *Text--;}else{bloghat = le; *Text--;} | |
if(bloghat==172){if(le==248||le==32){bloghat=44;}} | |
int isunk = 0; | |
if(qloghat==32||qloghat=='\0'||qloghat==199||qloghat==194||qloghat==207||qloghat==208||qloghat==209||qloghat==210||qloghat==184||qloghat==168||qloghat==191||qloghat==40||qloghat==41||qloghat==46||qloghat==33||qloghat==44||qloghat==58||qloghat==248){ | |
if(bloghat==32||bloghat=='\0'||bloghat==191||bloghat==40||bloghat==41||bloghat==46||bloghat==33||bloghat==44||bloghat==58||bloghat==248){ | |
haalat = 0; //دو ور غیر چسبان | |
}else{ | |
haalat = 1; //آخر چسبان | |
} | |
}else{ | |
if(bloghat==32||bloghat=='\0'||bloghat==191||bloghat==40||bloghat==41||bloghat==46||bloghat==33||bloghat==44||bloghat==58||bloghat==248){ | |
haalat = 2; //اول چسبان آخر غیر چسبان | |
}else{ | |
haalat = 3; //دو ور چسبان | |
} | |
} | |
switch(loghat){ | |
case 32: //فاصله | |
cursor_x -= 2; | |
break; | |
case 191: //؟ | |
display.drawBitmap(cursor_x, cursor_y, soal, 8, 8, color); | |
cursor_x -= 6; | |
break; | |
case 33: //! | |
display.drawBitmap(cursor_x, cursor_y, tajob, 8, 8, color); | |
cursor_x -= 3; | |
break; | |
case 46: //. | |
display.drawPixel(cursor_x+6, cursor_y+5, color); | |
display.drawPixel(cursor_x+6, cursor_y+6, color); | |
display.drawPixel(cursor_x+5, cursor_y+5, color); | |
display.drawPixel(cursor_x+5, cursor_y+6, color); | |
cursor_x -= 4; | |
break; | |
case 58: //: | |
display.drawPixel(cursor_x+6, cursor_y+2, color); | |
display.drawPixel(cursor_x+6, cursor_y+5, color); | |
cursor_x -= 3; | |
break; | |
case ',': //، | |
display.drawBitmap(cursor_x, cursor_y, vir, 8, 8, color); | |
cursor_x -= 5; | |
break; | |
case 40: //( | |
display.drawBitmap(cursor_x, cursor_y, kmn1, 8, 8, color); | |
cursor_x -= 7; | |
break; | |
case 41: //) | |
display.drawBitmap(cursor_x, cursor_y, kmn2, 8, 8, color); | |
cursor_x -= 7; | |
break; | |
case 194: //آ | |
display.drawBitmap(cursor_x, cursor_y, alef1, 8, 8, color); | |
cursor_x -= 7; | |
break; | |
case 199: //ا | |
if(haalat == 0 || haalat == 1){ | |
display.drawBitmap(cursor_x, cursor_y, alef2, 8, 8, color); | |
cursor_x -= 3; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, alef3, 8, 8, color); | |
cursor_x -= 2; | |
} | |
break; | |
case 200: //ب | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, be1, 8, 8, color); | |
cursor_x -= 3; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, be2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 222: //پ | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, pe1, 8, 8, color); | |
cursor_x -= 3; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, pe2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 202: //ت | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, te1, 8, 8, color); | |
cursor_x -= 3; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, te2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 203: //ث | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, the1, 8, 8, color); | |
cursor_x -= 3; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, the2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 204: //ج | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, jim1, 8, 8, color); | |
cursor_x -= 6; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, jim2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 141: //چ | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, che1, 8, 8, color); | |
cursor_x -= 6; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, che2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 205: //ح | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, hee1, 8, 8, color); | |
cursor_x -= 6; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, hee2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 206: //خ | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, khe1, 8, 8, color); | |
cursor_x -= 6; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, khe2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 207: //د | |
display.drawBitmap(cursor_x, cursor_y, dal, 8, 8, color); | |
cursor_x -= 6; | |
break; | |
case 208: //ذ | |
display.drawBitmap(cursor_x, cursor_y, zal, 8, 8, color); | |
cursor_x -= 6; | |
break; | |
case 209: //ر | |
display.drawBitmap(cursor_x, cursor_y, re, 8, 8, color); | |
cursor_x -= 5; | |
break; | |
case 210: //ز | |
display.drawBitmap(cursor_x, cursor_y, ze, 8, 8, color); | |
cursor_x -= 5; | |
break; | |
case 184: //ژ | |
display.drawBitmap(cursor_x, cursor_y, zhe, 8, 8, color); | |
cursor_x -= 5; | |
break; | |
case 211: //س | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, sin1, 8, 8, color); | |
cursor_x -= 7; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, sin2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 212: //ش | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, shin1, 8, 8, color); | |
cursor_x -= 7; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, shin2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 213: //ص | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, sad1, 8, 8, color); | |
cursor_x -= 7; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, sad2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 214: //ض | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, zad1, 8, 8, color); | |
cursor_x -= 7; | |
}else if(haalat == 0 || haalat == 2){ | |
display.drawBitmap(cursor_x, cursor_y, zad2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 215: //ط | |
display.drawBitmap(cursor_x, cursor_y, taa, 8, 8, color); | |
cursor_x -= 7; | |
break; | |
case 216: //ظ | |
display.drawBitmap(cursor_x, cursor_y, zaa, 8, 8, color); | |
cursor_x -= 7; | |
break; | |
case 217: //ع | |
if(haalat == 0){ | |
display.drawBitmap(cursor_x, cursor_y, ein4, 8, 8, color); | |
cursor_x -= 5; | |
}else if(haalat == 1){ | |
display.drawBitmap(cursor_x, cursor_y, ein1, 8, 8, color); | |
cursor_x -= 4; | |
}else if(haalat == 2){ | |
display.drawBitmap(cursor_x, cursor_y, ein3, 8, 8, color); | |
cursor_x -= 6; | |
}else if(haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, ein2, 8, 8, color); | |
cursor_x -= 7; | |
} | |
break; | |
case 218: //غ | |
if(haalat == 0){ | |
display.drawBitmap(cursor_x, cursor_y, qein4, 8, 8, color); | |
cursor_x -= 5; | |
}else if(haalat == 1){ | |
display.drawBitmap(cursor_x, cursor_y, qein1, 8, 8, color); | |
cursor_x -= 4; | |
}else if(haalat == 2){ | |
display.drawBitmap(cursor_x, cursor_y, qein3, 8, 8, color); | |
cursor_x -= 6; | |
}else if(haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, qein2, 8, 8, color); | |
cursor_x -= 7; | |
} | |
break; | |
case 161: //ف | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, fe1, 8, 8, color); | |
cursor_x -= 5; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, fe2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 162: //ق | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, qaf1, 8, 8, color); | |
cursor_x -= 5; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, qaf2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 201: //ک | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, kaf1, 8, 8, color); | |
cursor_x -= 6; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, kaf2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 144: //گ | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, gaf1, 8, 8, color); | |
cursor_x -= 6; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, gaf2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 164: //ل | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, lam1, 8, 8, color); | |
cursor_x -= 2; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, lam2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 165: //م | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, mim1, 8, 8, color); | |
cursor_x -= 6; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, mim2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 228: //ن | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, noon1, 8, 8, color); | |
cursor_x -= 3; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, noon2, 8, 8, color); | |
cursor_x -= 9; | |
} | |
break; | |
case 168: //و | |
display.drawBitmap(cursor_x, cursor_y, vaav, 8, 8, color); | |
cursor_x -= 5; | |
break; | |
case 167: //ه | |
if(haalat == 0){ | |
display.drawBitmap(cursor_x, cursor_y, he4, 8, 8, color); | |
cursor_x -= 6; | |
}else if(haalat == 1){ | |
display.drawBitmap(cursor_x, cursor_y, he1, 8, 8, color); | |
cursor_x -= 6; | |
}else if(haalat == 2){ | |
display.drawBitmap(cursor_x, cursor_y, he3, 8, 8, color); | |
cursor_x -= 5; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, he2, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
case 172: //ی | |
if(haalat == 1 || haalat == 3){ | |
display.drawBitmap(cursor_x, cursor_y, ye1, 8, 8, color); | |
cursor_x -= 3; | |
}else if(haalat == 2){ | |
display.drawBitmap(cursor_x, cursor_y, ye2, 8, 8, color); | |
cursor_x -= 8; | |
}else{ | |
display.drawBitmap(cursor_x, cursor_y, ye3, 8, 8, color); | |
cursor_x -= 8; | |
} | |
break; | |
default: | |
//display.drawBitmap(cursor_x, cursor_y, soal, 8, 8, color); | |
//cursor_x -= 8; | |
isunk = 1; | |
break; | |
} | |
// display.print(loghat); | |
//// display.print("*"); | |
//// display.print(le); | |
// display.print("#"); | |
if(isunk == 0){ | |
qloghat = loghat; | |
} | |
if(cursor_x < 0){ | |
cursor_x = display.width() - 8; | |
cursor_y += 8+dis; | |
} | |
} | |
} | |
void display_delay(int Delay){ | |
display.display(); | |
delay(Delay); | |
display.clearDisplay(); | |
display.display(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment