Here is my uLCD driver for the 4dSystems picaso display's

Hello All,

I like to contribute my work for my uLCD display from 4dSystems ([url]http://www.4dsystems.com.au/[/url]).
It is a small static class with all the graphic and touch functions that can be used with the
serial communication protocol firmware ([url]http://www.4dsystems.com.au/prod.php?id=87[/url].
This firmware need to be loaded into your display.
Please note that every screen has his own firmware.

for the code see: [url]http://www.fezzer.com/project/183/4dsystems-ulcd-graphic-driver-/[/url]

enjoy

Looks nice! How about a video? ;D

Video? Pictures? Wiki project? :slight_smile:

Yeah i working on that :wink:

EDIT: BTW. Gus, i have already tried to start a wiki page but i have no idea how to start a new one. When you have a min, can you drop by the chat and help me in the right direction?

I will help you, give me a sec.

oke here is a demo picture:

Cool display! 8)

Is the domino inside the enclosure?

Seeing the cables coming out of it I would say no :stuck_out_tongue:

Gus: sadly there is no space enough in the bottom section to store a domino look-a-like, im hopping i that a FEZ-mini can fit inside it. But then i need to buy an other FEZ and this time the mini.
I will do that after i have done all development and i only need to place all parts inside the enclosure etc.
here is a small video:

[url]- YouTube

I wonder how much you can do with such display and Domino since those displays are expensive!

Very nice, although it would be nice if there were a few comments in that code :wink:

Okay, thank you Chris for your idea.
I have modified first post with some comments.

Very nice. The XML comments look great!

I have modified it slightly to cope with the uOLED-128, which has only byte values for width and height,
on a contentious note - there is a lot of new byte[] { 0x00, (byte)width… etc going on, now that is all very fine for pc .Net, but personally I think you would be better off having a static byte buffer and filling it in each time, that way you dont overstress the GC, depends on how often these things are called of course…

Hello peter,

can you give me a code example how to do this?
then i love to change it that way.

I working now on some nice extensions to display windows etc.

OK, I think that is the way I would structure it, ie have the base 4dclass implement the raw commands and then a much more usable api sitting on top, ie take the DrawLine and Rectangle functions - it is much nicer to call with a point and a size rather than 2 points, as this is more in keeping with the GDI stuff in .NET, but maybe thats what I grew up with…

On an efficiency note, I was just thinking that rather than use a new byte[] for every command to just have a static buffer and fill each position with the byte and then send the array out to the port, Ill send some code when I have finished playing,

Of course that shouldnt compromise your cool extra window stuff should you change the way the raw commands are implemented… thats the beauty of C#

btw…I didnt mean to be critical, just raising a debate to benefit all of us, the code you contributed is nicely done…

Don’t worry about it, i like to learn as much how to program using C# i’m a delphi/PHP programmer.

Can you view me an example of what you mean?

I think I would have something like this…


        // UART doesnt have a PutByte
        // for outputting bytes and int16s
        private byte[] buffer = new byte[ 2 ];

        private void Tx( byte b )
        {
            buffer[0] = b;
            UART.Write( buffer, 0, 1 );
        }

        private void Tx( int i )
        {
            buffer[0] = (byte)(i >> 8);
            buffer[1] = (byte)i;
            UART.Write( buffer, 0, 2 );
        }

        private void Tx( byte[] data )
        {
            UART.Write( data, 0, data.Length );
        }

and for the commands


        static public void Rectangle( int x1, int y1, int x2, int y2, int color )
        {
            //SendData2( new byte[] { 0x72, (byte)(x1 >>8),     (byte)x1, (byte)(y1 >>8), (byte)y1, 
            //                                (byte)(x2 >>8),     (byte)x2, (byte)(y2 >>8), (byte)y2, 
            //                                (byte)(color >>8) , (byte)color} );
            Tx( 0x72 );
            Tx( x1 );
            Tx( y1 );
            Tx( x2 );
            Tx( y2 );
            Tx( color );
            CheckResponse();
        }

This code isnt as pretty but is less wasteful in memory allocations

spot the deliberate mistake, the Tx overloads need to be


        private void Tx( byte b )
        {
            buffer[0] = b;
            UART.Write( buffer, 0, 1 );
        }

        private void Tx2( int i )
        {
            buffer[0] = (byte)(i >> 8);
            buffer[1] = (byte)i;
            UART.Write( buffer, 0, 2 );
        }

otherwise you have to be careful about which overload gets called