RetroBSD

2.11BSD operating system for microcontrollers
It is currently Sun Mar 29, 2020 9:10 pm

All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sat Oct 10, 2015 3:07 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
A new programming interface for the HX8357 TFT driver is finally finished. A set of supported ioctl calls has been extended with basis draw primitives like pixel, line, rectangle, filled rectangle, circle, image, character and string of characters. Proportonal and fixed fonts of arbitrary size are supported. Fonts are supplied from the user space.

The graphics display is available for the user programs via gpanel library. You can find a few examples in the /share/examples/gpanel directory. In case you have a Picadillo-35T board, you can try to run them. (do not forget to update your kernel and SD card first)
Code:
# cd /share/examples/gpanel
# make
cc  -o tft  tft.c
cc  -o tftetris  tftetris.c
cc  -o pixel  pixel.c -lgpanel
cc  -o line  line.c -lgpanel
cc  -o rect  rect.c -lgpanel
cc  -o fill  fill.c -lgpanel
cc  -o circle  circle.c -lgpanel
cc  -o 5x7.o -c fonts/5x7.c
cc  -o 6x9.o -c fonts/6x9.c
cc  -o digits20.o -c fonts/digits20.c
cc  -o digits32.o -c fonts/digits32.c
cc  -o lucidasans11.o -c fonts/lucidasans11.c
cc  -o lucidasans15.o -c fonts/lucidasans15.c
cc  -o lucidasans7.o -c fonts/lucidasans7.c
cc  -o lucidasans9.o -c fonts/lucidasans9.c
cc  -o verdana7.o -c fonts/verdana7.c
cc  -o font  font.c 5x7.o 6x9.o digits20.o digits32.o lucidasans11.o lucidasans15.o  lucidasans7.o lucidasans9.o verdana7.o -lgpanel
cc  -o color  color.c -lgpanel
cc  -o speed  speed.c lucidasans15.o -lgpanel
# ./pixel

Pixel demo displays a screen full of random colored dots, much like noise:
Attachment:
pixel.jpg
pixel.jpg [ 55.67 KiB | Viewed 31569 times ]

Line demo draws random lines of random colors:
Code:
# ./line
Attachment:
line.jpg
line.jpg [ 67.88 KiB | Viewed 31569 times ]

Rect demo draws random rectangle frames of random colors:
Code:
# ./rect
Attachment:
rect.jpg
rect.jpg [ 61.51 KiB | Viewed 31567 times ]

Fill demo shows rectangles filled with random colors:
Code:
# ./fill
Attachment:
fill.jpg
fill.jpg [ 21.55 KiB | Viewed 31567 times ]

Circle demo draws random circles:
Code:
# ./circle
Attachment:
circle.jpg
circle.jpg [ 63.23 KiB | Viewed 31567 times ]

The Picadillo-35T display supports 64k colors. Color demo tries to demonstrate available palette. Unfortunately, a photo camera of my smartphone had distorted the colors: in reality it looks more naturally.
Code:
# ./color
Attachment:
color.jpg
color.jpg [ 14.79 KiB | Viewed 31567 times ]

Font demo shows a few fonts of different sizes. You can find these font files in directory /share/examples/gpanel/fonts. The font data were generated from Lucida_Sans_Unicode.ttf and Verdana.ttf files using otf2bdf and convbdf utilities. You can generate your own fonts of needed typefaces, sizes and character sets. See Makefile in this directory for details.
Code:
# ./font
Screen size 480 x 320.
Draw fonts.
Press ^C to stop.
Font Lucida Sans 15: press Enter...
Font Lucida Sans 11: press Enter...
Font Lucida Sans 9: press Enter...
Font Lucida Sans 7: press Enter...
Font Verdana 7: press Enter...
Font Fixed 6x9: press Enter...
Font Fixed 5x7: press Enter...
Font Digits 32: press Enter...
Font Digits 20: press Enter...
^C
Attachment:
lucidasans15.jpg
lucidasans15.jpg [ 46.08 KiB | Viewed 31567 times ]
Attachment:
lucidasans11.jpg
lucidasans11.jpg [ 42.75 KiB | Viewed 31567 times ]
Attachment:
lucidasans9.jpg
lucidasans9.jpg [ 40.76 KiB | Viewed 31567 times ]
Attachment:
lucidasans7.jpg
lucidasans7.jpg [ 36.79 KiB | Viewed 31567 times ]
Attachment:
verdana7.jpg
verdana7.jpg [ 37.47 KiB | Viewed 31567 times ]
Attachment:
fixed6x9.jpg
fixed6x9.jpg [ 39.68 KiB | Viewed 31567 times ]
Attachment:
fixed5x7.jpg
fixed5x7.jpg [ 38.28 KiB | Viewed 31567 times ]
Attachment:
digits32.jpg
digits32.jpg [ 32.88 KiB | Viewed 31567 times ]
Attachment:
digits20.jpg
digits20.jpg [ 31.11 KiB | Viewed 31567 times ]

A performance of graphics primitives can be measured by the speed test:
Code:
# ./speed
Screen size 480 x 320.
Graphics speed:
 76045 pixels/second
 1764 lines/second
 486 rectangles/second
 816 circles/second
 6079 characters/second


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 6:39 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Fantastic!

And now the obvious question - how do I connect my junk box tft displays - ie. SPI ones: 2.2in w/ ILI9341, 1.8in w/ ST7735, not mentioned a 3.5in 16bit one I ran once because of a lot of wires :) ??
All the displays work fine under arduino with adafruit libs..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 6:48 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
You will need to create a driver for every type of display controller. Use Matt's HX8357 driver as a prototype. Adafruit sources can help a lot.


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 7:14 am 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Serge and Pito and all,

And the 2nd 'obvious' question.

What about a graphics html5 or java output.

So I can use the WebSocket protocol to drive my attached [usb or wifi] cheap phone.

Wiz


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 7:41 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Hi Wiz,

I still don't understand how do you plan to connect pic32 to the phone. Neither usb not wifi are available.

The only way I could imagine is to use the W5100 Ethernet shield and to create an application which implements a web server with WebSocket support. This is possible right now: RetroBSD already has everything required for this task. The only challenge is to fit a web server into 96 kbytes of user memory.

It has nothing to do with graphics library and TFT driver, though.

--Serge


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 8:27 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Pito wrote:
And now the obvious question - how do I connect my junk box tft displays - ie. SPI ones: 2.2in w/ ILI9341, 1.8in w/ ST7735,

I have a display shield based on ST7781 controller. May be I'll make a driver for it someday. The interface seems pretty simple.

Image


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 8:48 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
There is maybe dozen of tft's ILI or ST chips :)
And there are 3 variants of the ST7735 chip based 1.8in tft's - red, black, green :) which differ in few ST chip settings..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 11:45 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
If you want drivers to adapt that are written mainly with the pic32 in mind you can pick your way through DisplayCore: https://github.com/MajenkoLibraries/DisplayCore

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 11:46 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Pito wrote:
There is maybe dozen of tft's ILI or ST chips :)
And there are 3 variants of the ST7735 chip based 1.8in tft's - red, black, green :) which differ in few ST chip settings..

They're not variants of the chip - they are variants of the display panel the chip is used with - mainly to do with RGB/BGR ordering.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 11:55 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Yes, exactly.

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 3:45 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Serge,

How to connect html5 or java from PIC32 to phone?

Good point. I don't know how to connect it right now either.

But given even a little starting point, maybe java or html5 in a file to load to the phone and some data to drive the phone, I bet I can get it going :). [ maybe :) ]

I notice that the SDR in the Netherlands uses html5/java over WebSocket so that might be copied to get a starting point?

I am assuming the PIC32 will send java/html5 to the phone and then 'talk' to that java/html5 with 'real-time' data carried eventually by the WebSocket protocol.

I haven't looked at the 5th wire of usb on the go, but maybe that can carry some of the required data. [ I assume it is some sort of serial protocol associated with the 'regular' USB handshake(s). ]

Besides we all need a 'real' challenge once and a while :).

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Sat Oct 10, 2015 8:25 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Quote:
I haven't looked at the 5th wire of usb on the go, but maybe that can carry some of the required data. [ I assume it is some sort of serial protocol associated with the 'regular' USB handshake(s). ]

No, it is a simple digital input to the MCU. Either HIGH or LOW. One indicates it's to run in host mode, the other for device mode (I forget which is which off hand). It can't carry any data. An OTG cable hard wires that pin either to +5V or GND.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Wed Oct 14, 2015 2:44 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Pito wrote:
There is maybe dozen of tft's ILI or ST chips :)
And there are 3 variants of the ST7735 chip based 1.8in tft's - red, black, green :) which differ in few ST chip settings..

I have ordered two more shields of this kind: with spfd5408 and ili9340 controllers. It should be possible to autodetect the chip in the driver.

majenko wrote:
If you want drivers to adapt that are written mainly with the pic32 in mind you can pick your way through DisplayCore: https://github.com/MajenkoLibraries/DisplayCore

Thank you for DisplayCore library - it's a great source of information.


Top
 Profile  
 
PostPosted: Wed Oct 14, 2015 10:25 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
In the future it would be nice to have a template for SPI based TFTs, ie ILI9341.
There is a lot of such tfts in users junkboxes - easier to connect (less wires) :), but still good for none-video streaming apps..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Wed Oct 14, 2015 5:38 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Pito wrote:
In the future it would be nice to have a template for SPI based TFTs, ie ILI9341.
There is a lot of such tfts in users junkboxes - easier to connect (less wires) :), but still good for none-video streaming apps..
Someday, someday.


Top
 Profile  
 
PostPosted: Wed Oct 14, 2015 10:11 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
An exercise for long winter evenings :)

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Wed Oct 14, 2015 10:40 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
They don't get those in californ-i-a.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Wed Oct 14, 2015 10:55 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Would a move to Alaska (or nearby Siberia) help? In Oymyakon I would be happy to sit in a small warm room writing drivers :)

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Wed Oct 14, 2015 11:12 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Personally I'd prefer Jokkmokk. It's nice there, though the mosquitoes can be a bit of a pain in the summer (both days of it).

I speak from personal experience there...

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Thu Oct 15, 2015 1:24 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
You don't have to wait until I move to Oymyakon or Jokkmokk.
Just sit and write your own driver. :)
All the building blocks are already there: the SPI layer and ST7781 driver as a prototype.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission