Sign in to follow this  
Followers 0
phenyl

Kentec Library (BOOSTXL-K350QVG)

5 posts in this topic

Hi All

First, I would like to thank @Rei Vilo for providing the Library for the Kentec (BOOSTXL-k350qvg) library with Energia.

I copied the code out of https://www.youtube.com/watch?v=XyeUpk6P4kA (as I didn't find the powerpoint or pdf) and got it to work with an MSP430F5529 launchpad. (Energia 18, Windows as the Mac version doesn't work atm). Then I compiled the same code on a MSP432P401R launchpad and it runs a lot slower than on the F5529 (I assume this is a known issue, due to slow SPI speed ( https://github.com/energia/msp432-core/issues/27 ) but also doesn't look the same, the fonts are "skinnier on the MSP432. This discrepancy, I cannot explain.

 

Another question: If I want to write a changing variable, in this case simply the x-coordinate of the touch to the screen, how do I locally clear the screen without redrawing everything (or if I want to make a bar graph that represents eg a changing value of a sensor? Do I always draw a black rectangle, then the bar/text etc? or is there a simpler way that is not immediately obvious to me now?

Next step: I have to learn more about state machines to switch screens (settings), do stuff there, come back to main without the program getting into badly readable territory.

Thank you very much for your help.

//First steps with the Kentec Display

#include "SPI.h"


#include "Screen_K35_SPI.h"
Screen_K35_SPI myScreen;

uint16_t colours[6];
uint16_t x;
uint16_t y;
uint16_t z;
uint8_t initFlag;

void setup() {
  Serial.begin(9600);
  Serial.println();
  Serial.println("hello");
  Serial.println();

  pinMode(RED_LED, OUTPUT);
  myScreen.begin();
  myScreen.clear();
  colours[0] = myScreen.calculateColour(255, 0, 0);
  colours[1] = myScreen.calculateColour(0, 255, 0);
  colours[2] = myScreen.calculateColour(0, 0, 255);
  colours[3] = myScreen.calculateColour(255, 255, 255);
  colours[4] = myScreen.calculateColour(255, 255, 0);
  colours[5] = myScreen.calculateColour(0, 0, 0);
  x = 0;
  y = 0;
  z = 0;

  myScreen.setPenSolid(true);
  myScreen.setFontSolid(false);
  myScreen.setFontSize(2);

  initFlag = 1;
}

void loop() {
  if (initFlag)
  {
    drawHomeScreen();
    initFlag = 0;
  }
  if (myScreen.isTouch() > 0)
  {
    myScreen.getTouch(x, y, z);
    myScreen.gText(10, 10, btoa(x, 8), colours[3]);
    Serial.print(x);
    Serial.print(" ");
    Serial.print(y);
    Serial.print(" ");
    Serial.println(z);
  }
  if (z > 100)
  {
    if ((x < 160 && x > 0) && (y < 240 && y > 100))
    {
      digitalWrite(RED_LED, HIGH);
    }
    else if ((x < 320 && x > 160) && (y > 100 && y < 240))
    {
      digitalWrite(RED_LED, LOW);
    }
    else if ((x < 320 && x > 160) && (y > 0 && y < 100))
    {
      drawSettingsScreen();
    }

  }
}



void drawHomeScreen()
{
  myScreen.clear();
  myScreen.gText(30, 50, "TOUCH LCD DEMO", colours[4]);
  myScreen.rectangle(0, 100, 160, 239, colours[1]);
  myScreen.gText(50, 180, "ON", colours[0]);
  myScreen.rectangle(160, 100, 319, 239, colours[0]);
  myScreen.gText(235, 180, "OFF", colours[1]);
  myScreen.rectangle(160, 0, 319, 100, colours[2]);
  myScreen.gText(180, 50, "SETTINGS", colours[3]);
}

void drawSettingsScreen()
{
  myScreen.clear();
  myScreen.gText(10, 10, "TOUCH LCD DEMO", colours[0]);
  myScreen.gText(10, 30, "TOUCH LCD DEMO", colours[1]);
  myScreen.gText(10, 50, "TOUCH LCD DEMO", colours[2]);
  myScreen.gText(10, 70, "TOUCH LCD DEMO", colours[3]);
  myScreen.gText(10, 90, "TOUCH LCD DEMO", colours[4]);
}

 

Share this post


Link to post
Share on other sites

I vaguely remember something a while back on the E2E forums with regard to the Kentec driver/library not being right on the 432.  If I recall correctly, there was an updated version referred to which sped up the display significantly and made the original poster happy.  A well worded search should find that thread.

EDIT:  Did a few searches and couldn't find it.  Perhaps it was not the 432 but a Tiva issue.  That's the trouble with vague memories....  You may want to try posting on E2E if you can't find it by searching.  If it is indeed the issue I seem to remember, then perhaps one of the TI guys might recall and be able to help out. 

phenyl likes this

Share this post


Link to post
Share on other sites
9 hours ago, dubnet said:

I vaguely remember something a while back on the E2E forums with regard to the Kentec driver/library not being right on the 432.  If I recall correctly, there was an updated version referred to which sped up the display significantly and made the original poster happy.  A well worded search should find that thread.

EDIT:  Did a few searches and couldn't find it.  Perhaps it was not the 432 but a Tiva issue.  That's the trouble with vague memories....  You may want to try posting on E2E if you can't find it by searching.  If it is indeed the issue I seem to remember, then perhaps one of the TI guys might recall and be able to help out. 

Hi @dubnet

Thank you very much for your answer, I think this issue was for ccs. With ccs6 there was a slow TI GraphicsLib and they sped it up significantly for ccs v7 but I am not sure that one can just drop that into energia and be done with it. I did run the CCSv7 Demo on the MSP432 and it was FAST. (I am not ready for jumping over to the world of direct register manipulation tho... Energia is a good compromise for me in order to get ahead with my hobby projects...)

 

Share this post


Link to post
Share on other sites
Quote

Another question: If I want to write a changing variable, in this case simply the x-coordinate of the touch to the screen, how do I locally clear the screen without redrawing everything (or if I want to make a bar graph that represents eg a changing value of a sensor? Do I always draw a black rectangle, then the bar/text etc? or is there a simpler way that is not immediately obvious to me now?

Just perform something like

  myScreen.setPenSolid(true);
  myScreen.dRectangle(x, y, a, b, myColours.black);

with x, y as coordinates, and a, b as size.

phenyl likes this

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
Sign in to follow this  
Followers 0