This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/EK-TM4C1294XL: Keyboard Widget on Kentec display

Part Number: EK-TM4C1294XL

Tool/software: Code Composer Studio

Hi,

I'm trying to use the Keyboard Widget with the Kentec LCD boosterpack (SPI version), it draws into the screen nicely and apparently it is responding to touch, but it does nothing, doesn't call any function. I've tried to search the Graphics Library User's Guide and the internet, but I can't seem to find a solution to this. How can I write something with the keyboard and pass it to a string to process? Or something like that? 

The code:

#include "command/includes.h"

char g_program[4];

bool g_state = false;

extern tCanvasWidget g_psPanels[];
extern tCanvasWidget g_sIntroduction;
extern tKeyboardWidget g_sKeyboard;

void OnKeyPress(tWidget *pWidget);

tCanvasWidget g_psPanels[] =
{
 CanvasStruct(0, 0, &g_sIntroduction, &g_sKentec320x240x16_SSD2119, 0, 24,
              320, 166, CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0),
};

Canvas(g_sHeading, &g_sIntroduction, 0, &g_sKeyboard,
       &g_sKentec320x240x16_SSD2119, 0, 0, 320, 23,
       (CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT),
       ClrBlack, ClrLightGreen, ClrWhiteSmoke, g_psFontCm20, "Keyboard", 0, 0);

Canvas(g_sIntroduction, g_psPanels, 0, &g_sHeading,
       &g_sKentec320x240x16_SSD2119, 0, 23, 320, (240 - 23),
       CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0);

Keyboard(g_sKeyboard, &g_sHeading, 0, 0,
         &g_sKentec320x240x16_SSD2119, 8, 90, 300, 140,
         KEYBOARD_STYLE_TEXT | KEYBOARD_STYLE_FILL |
         KEYBOARD_STYLE_AUTO_REPEAT | KEYBOARD_STYLE_BG,
         ClrBlack, ClrGray, ClrDarkGray, ClrGray, ClrWhite, g_psFontCmss14,
         100, 50, NUM_KEYBOARD_US_ENGLISH, g_psKeyboardUSEnglish, OnKeyPress);

void OnKeyPress(tWidget *pWidget)
{
    g_state = true;

    UARTprintf("Pressed any key\n\n");

    snprintf(g_program, sizeof(g_program), "%s", "adc");
}

int main(void)
{
    g_SysClock = CPUClock_Set(XTAL25_W_PLL_VCO480, FREQ_120M);
    UART0_Init(PIOSC, FREQ_PIOSC, 921600);
    ROM_FPUEnable();
    ROM_FPULazyStackingEnable();
    ROM_IntMasterEnable();

    Kentec320x240x16_SSD2119Init(g_SysClock);
    TouchScreenInit(g_SysClock);
    TouchScreenCallbackSet(WidgetPointerMessage);

    while(1)
    {
        WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels);
        WidgetPaint(WIDGET_ROOT);

        while(!g_state)
            WidgetMessageQueueProcess();

        g_state = !g_state;

        WidgetRemove((tWidget *)g_psPanels);

        CmdLineProcess(g_program);
    }
}

Also, when I compile it gives me this warning:

"Description Resource Path Location Type #145-D a value of type "void (*)(tWidget *)" cannot be used to initialize an entity of type "void (*)(tWidget *, uint32_t, uint32_t)" Proj_Instrumentacao.c /Proj_Instrumentacao line 28 C/C++ Problem"

Thanks in advance!

  • Hi Helder,

    Even i went through this phase of searching for solution for the same issue. However will make it easy for you,
    Follow the path ->Tivaware folder in your C directory ->examples->boards->dk-tm4c129->qs_weather application.
    Take a look at the keyboard part of the code. Youtube link to the demo of the application is mentioned below
    www.youtube.com/watch ( if the link dosent work , search "tivaware qs weather" on youtube)

    Take a look at the video ( keyboard part) and co relate with the code. It will help you understand how the keyboard widget works.

    I got mine working in the same way. Thanks me later :)
  • Well, it'll take some time for me to understand it totally, but at least it works. Thank you very much!
  • Actually, there is another problem, while I can now deal with the Keyboard Widget, if I add more than one widget and try to use them before the keyboard, I can't remove them and draw the keyboard, it always draws one widget before. Tried a lot of things, but it really doesn't make any sense. For example, if I try to execute 

    WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels + 2);
    WidgetPaint((tWidget *)g_psPanels + 2);

    It executes as if it was that

    WidgetAdd(WIDGET_ROOT, (tWidget *)g_psPanels + 1);
    WidgetPaint((tWidget *)g_psPanels + 1);

    If I try "g_psPanels + 3", the program does not execute correctly.

    What might be in this case?

    tCanvasWidget g_psPanels[] =
    {
     CanvasStruct(0, 0, &g_sIntroduction, &g_sKentec320x240x16_SSD2119, 0, 24,
                  320, 166, CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0),
                                             CanvasStruct(0, 0, &g_sIntroduction1, &g_sKentec320x240x16_SSD2119, 0, 24,
                                            320, 166, CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0),
                                            CanvasStruct(0, 0, &g_sAdcFreq, &g_sKentec320x240x16_SSD2119, 0, 24,
                                                                       320, 166, CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0),
    };
    
    //canvas para preencher a tela
    Canvas(g_sHeading, &g_sIntroduction, 0, &g_sPushBtn,
           &g_sKentec320x240x16_SSD2119, 0, 0, 320, 23,
           (CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT),
           ClrBlack, ClrLightGreen, ClrWhiteSmoke, g_psFontCm20, "Instrumentation", 0, 0);
    
    Canvas(g_sIntroduction, g_psPanels, 0, &g_sHeading,
           &g_sKentec320x240x16_SSD2119, 0, 23, 320, (240 - 23),
           CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0);
    
    Canvas(g_sAdcFreq, g_psPanels + 1, 0, &g_sHeading2,
           &g_sKentec320x240x16_SSD2119, 0, 23, 320, (240 - 23),
           CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0);
    
    Canvas(g_sHeading2, &g_sAdcFreq, 0, &g_sPushBtn2,
           &g_sKentec320x240x16_SSD2119, 0, 0, 320, 23,
           (CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT),
           ClrBlack, ClrLightGreen, ClrWhiteSmoke, g_psFontCm20, "Select ADC freq", 0, 0);
    
    
    RectangularButton(g_sPushBtn, &g_sHeading, 0, 0,
                      &g_sKentec320x240x16_SSD2119, 60, 45, 200, 170,
                      (PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                              PB_STYLE_FILL), ClrBlack, ClrWhite, ClrLightGreen, ClrBlue,
                              g_psFontCmss22b, "Enable ADC", 0, 0, 0, 0, OnButton1Press);
    
    
    CircularButton(g_sPushBtn2, &g_sHeading2, &g_sPushBtn3, 0,
                   &g_sKentec320x240x16_SSD2119, 120, 80, 30,
                   (PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                           PB_STYLE_FILL), ClrBlack, ClrWhite, ClrLightGreen, ClrLightBlue,
                           g_psFontCmss14b, "5 Hz", 0, 0, 0, 0, OnButton2Press);
    
    //botão para configurar o ADC para 10 Hz
    CircularButton(g_sPushBtn3, &g_sHeading2, &g_sPushBtn4, 0,
                   &g_sKentec320x240x16_SSD2119, 200, 80, 30,
                   (PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                           PB_STYLE_FILL), ClrBlack, ClrWhite, ClrLightGreen, ClrBlue,
                           g_psFontCmss14b, "10 Hz", 0, 0, 0, 0, OnButton3Press);
    
    
    CircularButton(g_sPushBtn4, &g_sHeading2, &g_sPushBtn5, 0,
                   &g_sKentec320x240x16_SSD2119, 120, 160, 30,
                   (PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                           PB_STYLE_FILL), ClrBlack, ClrWhite, ClrLightGreen, ClrPink,
                           g_psFontCmss14b, "15 Hz", 0, 0, 0, 0, OnButton4Press);
    
    
    CircularButton(g_sPushBtn5, &g_sHeading2, 0, 0,
                   &g_sKentec320x240x16_SSD2119, 200, 160, 30,
                   (PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
                           PB_STYLE_FILL), ClrBlack, ClrWhite, ClrLightGreen, ClrRed,
                           g_psFontCmss14b, "20 Hz", 0, 0, 0, 0, OnButton5Press);
    
    //
    // The keyboard widget used by the application.
    //
    Keyboard(g_sKeyboard, &g_sKeyboardBackground, 0, 0,
             &g_sKentec320x240x16_SSD2119, 8, 90, 300, 140,
             KEYBOARD_STYLE_FILL | KEYBOARD_STYLE_AUTO_REPEAT |
             KEYBOARD_STYLE_PRESS_NOTIFY | KEYBOARD_STYLE_RELEASE_NOTIFY |
             KEYBOARD_STYLE_BG,
             ClrBlack, ClrGray, ClrDarkGray, ClrGray, ClrBlack, g_psFontCmss14,
             100, 100, NUM_KEYBOARD_US_ENGLISH, g_psKeyboardUSEnglish, KeyEvent);
    
    //
    // The keyboard text entry area.
    //
    Canvas(g_sKeyboardText, &g_sKeyboardBackground, &g_sKeyboard, 0,
           &g_sKentec320x240x16_SSD2119, BG_MIN_X, BG_MIN_Y,
           BG_MAX_X - BG_MIN_X, 60,
           CANVAS_STYLE_FILL | CANVAS_STYLE_TEXT | CANVAS_STYLE_TEXT_LEFT,
           ClrBlack, ClrWhite, ClrWhite, g_psFontCmss24, &g_cTempStr, 0 ,0 );
    
    //
    // The full background for the keyboard when it is takes over the screen.
    //
    Canvas(g_sKeyboardBackground, WIDGET_ROOT, 0, &g_sKeyboardText,
           &g_sKentec320x240x16_SSD2119, BG_MIN_X, BG_MIN_Y,
           BG_MAX_X - BG_MIN_X, BG_MAX_Y - BG_MIN_Y,
           CANVAS_STYLE_FILL, ClrBlack, ClrWhite, ClrWhite, 0, 0, 0 ,0 );
    
    
    Canvas(g_sHeading1, &g_sIntroduction1, 0, &g_sKeyboard,
           &g_sKentec320x240x16_SSD2119, 0, 0, 320, 23,
           (CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT),
           ClrBlack, ClrLightGreen, ClrWhiteSmoke, g_psFontCm20, "Program", 0, 0);
    
    Canvas(g_sIntroduction1, g_psPanels + 2, 0, &g_sHeading1,
           &g_sKentec320x240x16_SSD2119, 0, 23, 320, (240 - 23),
           CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0);