Go Down

Topic: MCUFRIEND_kbv Library for Uno 2.4, 2.8, 3.5, 3.6, 3.95 inch mcufriend Shields (Read 231386 times) previous topic - next topic

paulofeju

Every time that I see your smiling picture,   I think that you must have mislaid your shirt.

Think about it.   A 24BMP has got 3 bytes for every pixel.   You can always treat a special colour as transparent.

It means that you have to stop blitting with pushColors().   Reset the current window position to the first non-transparent pixel and continue blitting.   

It gets a little untidy.   I intend to post an animated GIF sketch that does exactly this.
Note that GIFs need a massive amout of SRAM.   Only possible with Due, Teensy, Zero, ...

Your BMP rendering needs very little SRAM.    I have never heard of "transparent" BMP before.

David.
hahahahaha... Where's my shirt?    Thank you David!!!

Bricki

Hi David,

I'm using your library successfully with Teensy 3.2 boards and Newhaven TFTs with ST7789 controller. No I have another display (transflective) with the same controller (ST7789), but with a SPI Interface. Your library is for 8bit interface only, isn't it?

I haven't found any part inside the library to switch to SPI mode. I also wasn't lucky to find any SPI-library for the ST7789 controller.

Any idea or hint?
Thanks
Peter

david_prentice

No,  MCUFRIEND_kbv is for 8080-8 interface (and SPECIAL for 8080-16)

It should be very straightforward to adapt any xxx_ILI9341_xxx SPI library for ST7789.
ILI9341 and ST7789 are both 240x320 MIPI-compliant controllers.
The initialisation sequence is different.   Reading registers is different.

I do not have a public ILI9341_kbv library.
Please remind me whether you have a GitHub account and what programming experience you have.

You could start a ST7789_SPI thread.    Provide links to your hardware.

David.

luddiluddludde

Greetings all :). I have read and read, and tried to figure things out, but I am a bit stuck... The only thing I have learnt is that there is a lot of different MCUFriend TFTs out there...

I have been able to get mine working, sort of. When running a tft.readID I get LCD Driver chip 7783.

So, I have added the Adafruit_GFX, SWTFT and Touchscreen libraries (not sure they are all needed...) and I have been able to get the screen to respond correctly. I have set the rotation to 1 to get it in landscape mode, and I am using the Adafruit_GFX_Button funtion(?) to create a button.
However, when I try to check if the button is pressed or not, the touchscreen responds when I tap in a different area than the button, like shown in the picture:

The code I am using to generate the button is:
Defining:
Adafruit_GFX_Button btn1;

In setup:
btn1.initButton(&tft,70,70,130,40,WHITE,CYAN,BLACK,"Button1",2);
btn1.drawButton();

In loop:
if(btn1.contains(p.x,p.y){
btn1.press(true);
}
...and some other code...


It seems like the touchscreen is in portrait mode while I have the screen in landscape.

Edit: I just added another button, and the area on the screen I have to touch to get button2 to react, is just above the response area in the post here... This means that the touchscreen portion of my sketch is in portrait mode while the screen is in landscape... now how do I fix that?

Any ideas?

Bricki

Hi David,

I don't have a github account so far and my programming experience is quite low. I'm happy to find some libraries to get my stuff work :-)

I'll open a ST7789V SPI thread today.

Thanks
Peter

beryindo



tashiwangdue

Dear Mr. David prentice, 
Thank you so much for making this library available, it was great use for me.  I bought several of the mcufriend tft lcd. now all of these are working great with me. thank you so much.

But there is little more request. I am using mcufriend tft lcd 2.4" for sometimes now, I am native Tibetan living in Himalaya region. I tried my best to display Tibetan character on the display... but some how I am not able to make this display Tibetan character at all.  please help me or teach me how can I make this lcd to display Tibetan character. Thank you so much in advance.

david_prentice

I am an English speaker.   So I am quite happy with ascii character set for both programming and text.

I presume that Cyrillic, Greek, Arabic, ... text is required for non-English users
But programmers still have to use ASCII keywords for writing programs for a C++ Compiler.

The Adafruit 7x5 font in gfxfont.c could be changed for different character sets.
You could leave characters 32-127 as they are.   Change characters 128-255.

Or you could use a Tibetan font in a FreeFont format.
There is a utility for converting standard PC fonts to FreeFont format.

There must be many Russian, Greek, Arab, Hindi, ... members of this Forum.
Perhaps they can offer advice.

David.

arctos

American Standard Code for Information Interchange or ASCII
Is simply a 8 bit code that covers the English alphabet plus more (a lot more).

But computers that only understand 1's and 0's have no concept of either America or the English alphabet.

Fonts (in a MCU system) are a collection of on / off pixel that create a visible glyph.

By all this I mean you can create any font using any language that you choose. A byte(char)  is only references to a point in memory for the image (glyph) you require.

How many characters are in the Tibetan alphabet and how well do the align with English.

As I said ASCII covers the full English alphabet with extras using 8 bits and it is limited to 256 characters.
In most modern computer system we have extended the character to 16 bits meaning we now have 65535 possible glyphs which is enough to cover all known alphabets.

So back to your problem, as David pointed out there is a tool that comes with the Adafruit library that will map most computer fonts to a format that can be used on Arduino but at the same time you will have to map the English character to the Tibetan ones so you know which of the 256 possibilities represent the glyph you want.

jcunha

Hello, I'm arduino Uno R3 with a 3.5 display. I'm using the UTFTGLUE.h library instead of MCUFRIEND_kbv.h because it refreshes the screen faster. I'm having trouble changing the font. Even if I change the code code for instance the BigFont ( for example in the GLUE_Demo_480x320), it always shows the SmallFont on the screen. Would love some help, thank you

david_prentice

Hello, I'm arduino Uno R3 with a 3.5 display. I'm using the UTFTGLUE.h library instead of MCUFRIEND_kbv.h because it refreshes the screen faster. I'm having trouble changing the font. Even if I change the code code for instance the BigFont, it always shows the SmallFont on the screen. Would love some help, thank you
I am intrigued.   UTFTGLUE simply converts UTFT methods to call the underlying MCUFRIEND_kbv class.    It will be marginally slower than native MCUFRIEND_kbv.

The real difference is in human brains.   UTFT has very inconvenient syntax and style.
Most humans will find Adafruit_GFX graphics easier to use.

If you want to use different fonts, edit the UTFTGLUE.h file
Code: [Select]

#undef _GFXFONT_H_     //comment this line to enable FreeFonts

i.e. change this line to:
Code: [Select]

//#undef _GFXFONT_H_     //comment this line to enable FreeFonts


The ugly UTFT fonts are now available (as FreeFonts)
Of course you can include any of the attractive FreeFonts that came with your Adafruit_GFX installation.    Just like you would with a regular MCUFRIEND_kbv object.

David.

jcunha

I am intrigued.   UTFTGLUE simply converts UTFT methods to call the underlying MCUFRIEND_kbv class.    It will be marginally slower than native MCUFRIEND_kbv.

The real difference is in human brains.   UTFT has very inconvenient syntax and style.
Most humans will find Adafruit_GFX graphics easier to use.

If you want to use different fonts, edit the UTFTGLUE.h file
Code: [Select]

#undef _GFXFONT_H_     //comment this line to enable FreeFonts

i.e. change this line to:
Code: [Select]

//#undef _GFXFONT_H_     //comment this line to enable FreeFonts


The ugly UTFT fonts are now available (as FreeFonts)
Of course you can include any of the attractive FreeFonts that came with your Adafruit_GFX installation.    Just like you would with a regular MCUFRIEND_kbv object.

David.
I am intrigued.   UTFTGLUE simply converts UTFT methods to call the underlying MCUFRIEND_kbv class.    It will be marginally slower than native MCUFRIEND_kbv.

The real difference is in human brains.   UTFT has very inconvenient syntax and style.
Most humans will find Adafruit_GFX graphics easier to use.

If you want to use different fonts, edit the UTFTGLUE.h file
Code: [Select]

#undef _GFXFONT_H_     //comment this line to enable FreeFonts

i.e. change this line to:
Code: [Select]

//#undef _GFXFONT_H_     //comment this line to enable FreeFonts


The ugly UTFT fonts are now available (as FreeFonts)
Of course you can include any of the attractive FreeFonts that came with your Adafruit_GFX installation.    Just like you would with a regular MCUFRIEND_kbv object.

David.
Thanks a lot for the precise and quick answer. I really don't know why but I just used a simple code to show a main page of a menu and with some buttons (like up and down) highlight the option I would want to choose from the menu. The refresh of the highlighted option takes more like half a second to finish with MCUFRIEND_kbv. But since you say it's not supposed to happen i'll try to figure out if it's something else I'm not seeing.

david_prentice


david_prentice

Dear Mr. David prentice,  
Thank you so much for making this library available, it was great use for me.  I bought several of the mcufriend tft lcd. now all of these are working great with me. thank you so much.

But there is little more request. I am using mcufriend tft lcd 2.4" for sometimes now, I am native Tibetan living in Himalaya region. I tried my best to display Tibetan character on the display... but some how I am not able to make this display Tibetan character at all.  please help me or teach me how can I make this lcd to display Tibetan character. Thank you so much in advance.
Googling "Tibetan Fonts" gives some very weird looking results.
Likewise there are some strange looking European fonts.

Please post a link to a typical font that you would like to use.
How many characters do you need?  e.g. letters, digits, symbols.
Are these commonly used characters in consecutive Unicode values?

It should be possible to convert a Tibetan font in TTF format to FreeFont format on the PC.

Then it is simply a matter of mapping the Unicode values to convenient 0-255 range of values for existing Adafruit_GFX methods.

As I said earlier.   Russians,  Greeks, Chinese ... all have complex Unicode fonts.
So these users can offer advice.

You have asked the same question in many Forum Topics.   This is a good idea to reach Indian, Chinese,  ... members.
Please mark all of these threads when you get a solution.   Or edit each thread to link to one place.
Members get annoyed when there are duplicate threads.

David.

Go Up