Hello. I'm new at arduino. I'm writing a library for 3.5" TFT display with ILI9327 controller. My problem is about Turkish characters "ĞÜŞİÖÇğüşıöç". My String printing function is:
void YAZI(String yaz, uint8_t x, uint8_t y, uint16_t renk, uint16_t ardrenk) { // x and y are coordinates, renk is color and ardrenk is background color.
uint8_t uz=yaz.length();
char buf[uz+1];
yaz.toCharArray(buf, uz+1);
for(uint8_t a=0;a<uz;a++) {
KARAKTER(buf[a], x + (a*8), y, renk, ardrenk); //KARAKTER function prints a char.
}
}
and my character printing function is:
void KARAKTER(char harf, uint8_t x, uint8_t y, uint16_t renk, uint16_t ardrenk) { //harf is the character going to be written.
SETXY(x,y,x+7,y+11); //My font data has 8 pixels of width and 12 pixels of height.
if(harf<0x7F&&harf>0){ // I want to control is the char ASCII or NON-ASCII character. It detects well.
byte ch;
for(uint8_t j=0;j<12;j++) {
ch =pgm_read_byte(&SmallFont[harf-32][j]);
for(uint8_t k=0;k<8;k++) {
if((ch&(1<<(7-k)))!=0)
{
NOKTA(renk); //sets a pixel at font color
}
else
{
NOKTA(ardrenk); //sets a pixel at background color
}
}
}
}
}
So the char datatype is 8 bit and my non-ascii characters are more than 8 bit. And I use String.toCharArray function for creating a character array that contains the text data.
I tried to
char ch='Ğ';
int i = ch; // I tried int, byte, long, etc.
this code for converting non-ascii to integer but It gives same results for a couple of characters.
I want to do something like this:
if(ch=='Ğ') {
ch=128;
}
Sorry for long post and bad English.