Jump to content
Rei Vilo

[Energia Library] LCD_screen Library Suite

Recommended Posts

The library for the Kentec 3.5" is close to completion. 

 

Thanks to its 8-bit parallel connection, writing to and reading from the screen are much faster!

 

49 ms only to copy-paste a 64x64 area instead of the 438 ms required by the SPI-connected HY28A.

 

post-389-14264605292958_thumb.jpg

 

I have still to finalise the touch interface and obviously the documentation...

 

Having the SRAM + EEPROM BoosterPack would be nice.

 

:)

Share this post


Link to post
Share on other sites

HY28A & ST7735 works great with LCD SCREEN LIBRARY SUITE !

 

On the photo - one stellaris, one wizfi210 and two displays together in action,

measuring the wifi signal strength: ST7735 gauge, HY28A histogram

 

post-574-14264605293136_thumb.jpg

 

TNX Rei!

Share this post


Link to post
Share on other sites

I'm experiencing unexpected difficulties with reading the coordinates from the 4-wire resistive touch-screen of the Kentec 3.5".

 

When moving my finger horizontally, both x and y coordinates change. Same for vertically.

 

Only one coordinate should change. I suspect some initialisation problem.

 

See the specific thread HELP - 4-Wire Resistive Touch-Screen Reading with Energia.

 

Thank you for your help!

Share this post


Link to post
Share on other sites

I have a ino file for old HY28A lib

this is 10x6 squares drawn in loop and tables of chars drawn in the same loop too...

 

I don't know if it will be useful for you:

//KEYBOARD
#define KBDROWS       5     //number of keyboard rows
#define KBDCOLS       10    //number of keyboard cols
#define KBDSTEP       32    //distance (in px) between the start of two buttons
#define KBDLEFT       2     //absolute distance from the left side of the display 
#define KBDTOP        48    //absolute distance from the top of the display
#define KBDFONTLEFT   4     //absolute distance from the left side of the display to the first letter (eq. 1,q,a,z,<)
#define KBDBTNSIZE    28    //button size (without frame)
#define KBDFONTSIZE   3     //keyboard font size
#define KBDFNCBTNSIZE 60    //function keys h size

#define  KEY_SPACE    0x20
#define  KEY_CLEAR    0x7f
#define  KEY_ENTER    0x0a
#define  KEY_EXIT     0xfe
#define  KEY_SHIFT    0xfd
#define  KEY_NULL     0xff 

const char  keyboard[51]= "1234567890qwertyuiopasdfghjkl:zxcvbnm,.?<>-+*/=[]'";
const char  keyboardshift[51]= "!@#$%^&_()QWERTYUIOPASDFGHJKL:ZXCVBNM<>?{}[]-+\";\\|";

void printquerty()
{
   uint8_t x,y;
   char onefont[2];
   for(y = 0; y < KBDROWS; y++)
   {
     for(x = 0; x < KBDCOLS; x++)
     {
       myScreen.dRectangle((KBDLEFT+(KBDSTEP*x)), (KBDTOP+(KBDSTEP*y)), KBDBTNSIZE, KBDBTNSIZE, grayColour);
       if ( SHIFT ) { onefont[0]=keyboardshift[((y*10)+x)]; } else { onefont[0]=keyboard[((y*10)+x)]; }
       myScreen.gText((KBDLEFT+KBDFONTLEFT+(KBDSTEP*x)), (KBDTOP+KBDFONTLEFT+(KBDSTEP*y)), (String)onefont[0], whiteColour, grayColour, KBDFONTSIZE, KBDFONTSIZE);
     }
   }
}

void printfunckeys()
{
    uint16_t funckeycolor;
    
    myScreen.dRectangle(KBDLEFT, (KBDTOP+(KBDSTEP*5)), KBDFNCBTNSIZE, KBDBTNSIZE, grayColour);
    myScreen.gText((KBDLEFT+(KBDFONTLEFT*4)), (KBDTOP+KBDFONTLEFT+(KBDSTEP*5)), "exit", whiteColour, grayColour, KBDFONTSIZE-2, KBDFONTSIZE);
    
    myScreen.dRectangle(KBDLEFT+(KBDSTEP*2), (KBDTOP+(KBDSTEP*5)), KBDFNCBTNSIZE, KBDBTNSIZE, grayColour);
    myScreen.gText(KBDLEFT+(KBDFONTLEFT*4)+(KBDSTEP*2), (KBDTOP+KBDFONTLEFT+(KBDSTEP*5)), "clear", whiteColour, grayColour, KBDFONTSIZE-2, KBDFONTSIZE);
    
    myScreen.dRectangle(KBDLEFT+(KBDSTEP*4), (KBDTOP+(KBDSTEP*5)), KBDFNCBTNSIZE, KBDBTNSIZE, grayColour);
    myScreen.gText(KBDLEFT+(KBDFONTLEFT*4)+(KBDSTEP*4), (KBDTOP+KBDFONTLEFT+(KBDSTEP*5)), "space", whiteColour, grayColour, KBDFONTSIZE-2, KBDFONTSIZE);
    
    myScreen.dRectangle(KBDLEFT+(KBDSTEP*6), (KBDTOP+(KBDSTEP*5)), KBDFNCBTNSIZE, KBDBTNSIZE, grayColour);
    if ( SHIFT ) { funckeycolor=blueColour; } else { funckeycolor=whiteColour; }   
    myScreen.gText(KBDLEFT+(KBDFONTLEFT*4)+(KBDSTEP*6), (KBDTOP+KBDFONTLEFT+(KBDSTEP*5)), "shift", funckeycolor, grayColour, KBDFONTSIZE-2, KBDFONTSIZE);
    
    myScreen.dRectangle(KBDLEFT+(KBDSTEP*8), (KBDTOP+(KBDSTEP*5)), KBDFNCBTNSIZE, KBDBTNSIZE, grayColour);
    myScreen.gText(KBDLEFT+(KBDFONTLEFT*4)+(KBDSTEP*8), (KBDTOP+KBDFONTLEFT+(KBDSTEP*5)), "enter", whiteColour, grayColour, KBDFONTSIZE-2, KBDFONTSIZE);    
}

void getkey()
{
  int xres, yres;
 
  xres=(int)(x-KBDLEFT)/KBDSTEP;  //x from myScreen.getTouch(x, y, z)
  yres=(int)(y-KBDTOP)/KBDSTEP;   //y from myScreen.getTouch(x, y, z)

  if ((xres<KBDCOLS) && (yres<KBDROWS))
  {
    if ( SHIFT ) { pressedkey[0]=keyboardshift[((yres*10)+xres)]; } else { pressedkey[0]=keyboard[((yres*10)+xres)]; } 
  }
  else if (yres==5)
  {
    switch(x) 
    {
      case KBDLEFT ... (KBDLEFT+KBDFNCBTNSIZE):
          pressedkey[0]=KEY_EXIT;
          break;
      case (KBDLEFT+(KBDSTEP*2)) ... (KBDLEFT+(KBDSTEP*2)+KBDFNCBTNSIZE):
          pressedkey[0]=KEY_CLEAR;
          break;
      case (KBDLEFT+(KBDSTEP*4)) ... (KBDLEFT+(KBDSTEP*4)+KBDFNCBTNSIZE):
          pressedkey[0]=KEY_SPACE;
          break; 
      case (KBDLEFT+(KBDSTEP*6)) ... (KBDLEFT+(KBDSTEP*6)+KBDFNCBTNSIZE):
          pressedkey[0]=KEY_SHIFT;
          break; 
      case (KBDLEFT+(KBDSTEP*8)) ... (KBDLEFT+(KBDSTEP*8)+KBDFNCBTNSIZE):
          pressedkey[0]=KEY_ENTER;
          break;              
    }      
  }
  else
    pressedkey[0]=KEY_NULL;   
}

Share this post


Link to post
Share on other sites

Nice :)

 

Many questions:

 

How to deal with the letters with accents. Most of the European language include many of them.

 

For example, to name a few:

  • In French: àâäæéèêëîïôöœùüû瀜
  • In Spanish: áäéëíïóöúüñ¿¡

Why not using a smartphone-like keyboard?

 

Some popular smartphone feature four pages, each page with 4 lines and up to 10 keys per line. It saves a lot of space.

 

How to deal with Backspace?

Share this post


Link to post
Share on other sites

This is only old example / concept, who used my old Terminal6x8 chars(all) without regional :(

 

Backspace realized by "clear" button on bottom line(KEY_CLEAR), in my case simply move cursor back (1 letter width),  not included in example above.

 

Smartphone-like keyboard? I use http://www.etaoikeyboard.com :D -> one line with 5 multi-keys ;)

 

BTW - I never thought about it, I just played with this a hour or two ;)

I think that You choose something suitable for most users

 

P.S. in Polish: ąĄćĆęĘłŁńŃóÓśŚźŹżŻ

Share this post


Link to post
Share on other sites

New issue:


    /// @bug    trim() doesn't work on Stellaris

    /// @see    http://github.com/energia/Energia/issues/257

 

Now fixed with a manual function: 

    uint8_t i = 0;
    uint8_t j = _text.length();
    while ((_text.charAt(i)==' ') && (i<j)) {
        i++;
    }
    while ((_text.charAt(j)==' ') && (j>0)) {
        j--;
    }
    if (j>i) _text = _text.substring(i, j);
    else _text = "";

Share this post


Link to post
Share on other sites

The library for the Kentec 3.5 BoosterPack is available here

 

The library wouldn't have been possible without the help of the forum and its members. Many thanks to them!

 

As a colourful example, I've included a tool for drawing.

 

post-389-14264605293662_thumb.jpg

 

This is a cross-post with the 43oh forum.

Share this post


Link to post
Share on other sites

@@abecedarian, yes :)

 

Ideally a in-between BoosterPack with room for

  • 2x 1Mb fast SRAM for caching 
  • enough EEPROM for fonts
  • SD-card or uSD-card slot

All this on one single hardware SPI bus with 3 CS, and ideally with jumpers to select the SPI bus among the 4 of the Launchpad Stellaris...

 

Well, back to the 8-bit parallel Kentec 3.5" screen...

 

I posted a Call for Design - SD-Card + EEPROM + SRAM BoosterPack for Stellaris LaunchPad and also at the sister 43oh website.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×