Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Feaure request Using the Maixduino TFT Display
#1
Hello!

The Grove version of the Maixduino board bundles a 2.4" TFT display (& a camera). I am familiar with these TFT displays being driven through Arduino code. Is there any equivalent MicroPython library module for this purpose?

Thanks.
Reply
#2
(09-05-2019, 03:46 AM)baqwas Wrote: Hello!

The Grove version of the Maixduino board bundles a 2.4" TFT display (& a camera). I am familiar with these TFT displays being driven through Arduino code. Is there any equivalent MicroPython library module for this purpose?

Thanks.

Hoa you tried the Display module ?

The Camera module will be ready in a couple of days.
Reply
#3
(09-05-2019, 09:15 PM)lobo Wrote:
(09-05-2019, 03:46 AM)baqwas Wrote: Hello!

The Grove version of the Maixduino board bundles a 2.4" TFT display (& a camera). I am familiar with these TFT displays being driven through Arduino code. Is there any equivalent MicroPython library module for this purpose?

Thanks.

Hoa you tried the Display module ?

The Camera module will be ready in a couple of days.

Was looking in the wrong place (par for the course for me)! Yes, I can import the display module and instantiate an object successfully. Most of the operations that do not require physical output to the screen worked without any issue. Unfortunately, I must have a bad connection (poor cable mating practice on my part) and therefore direct commands for screen display fail (see example below). I will try to work on correcting this cable connection at my end.

Since the camera came pre-connected there should not be any cable connection worry (at least, I hope not!). Will give it a try once you release the module.

Kind regards.


Code:
Type "help()" for more information.
>>> import display
>>> myScreen = display.TFT()
>>> mySize = myScreen.fontSize()
>>> myScreen.clear()
E (149562937) FreeRTOS: (/home/reza/projects/MicroPython_K210_LoBo/k210-freertos/platform/sdk/kendryte-freertos-sdk/lib/freertos/kernel/devices.cpp:291) file >= HANDLE_OFFSET

M (3218) [MAIXPY]: Configuration loaded from flash
Q (7734) [MAIXPY]: PLL0=988000000, PLL1=398666666, PLL2=45066666, SPI3clk=494000000
Q (16067) [MAIXPY]: RAM buffer of 1024 bytes allocated at 0x80595e00

Boot menu, select an option
 F - force format File system
 B - do not execute 'boot.py'
 M - do not execute 'main.py'
 D - use default configuration
 Q - exit the menu
Reply
#4
Your myScreen = display.TFT() only creates the TFT display class instance.
You must initialize it with tft.init().
The default arguments should work, so just write your code as:
import display
myScreen = display.TFT()
myScreen.init()

mySize = myScreen.fontSize()
myScreen.clear()

You can add some simple test, like this:
myScreen.rect(0,0,320,240,myScreen.CYAN)
myScreen.rect(0,0,320,240,myScreen.CYAN, myScreen.BLUE)
myScreen.circle(160,120,80,myScreen.YELLOW, myScreen.RED)
myScreen.text(myScreen.CENTER, 5, "MicroPython for Kendryte K210", myScreen.YELLOW)
myScreen.show()
Reply
#5
Star 
Bingo again!

Your code snippets worked perfectly (cable is still loose - Wink ). My two mistakes were:
  • using all variations of structures for the color attribute except the way you illustrated
  • not realizing the need for  show()
This is really great. I have a whole slew of Arduino TFT screen tests that I can port. I will share these with you soon unless you have other suggestions.

On a personal note, I could not send beer money your way using PayPal. It is long story that I don't want to bore you with details. Is there an alternate way for me to express thanks with a very small token?

Kind regards.
Reply
#6
The color values can be given in several ways as explained in the Wiki - Colors.

show() is only needed if the framebuffer (Wiki) is used. The driver also supports drawing to the display directly if the frame buffer is not used (see Wiki).

Beer money is always welcomed, but the simple thanks is quite enough. Testing and reporting the issues and bugs are also useful contribution to my work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)