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.

Adding a 2nd page in the Kentec LCD display for TM4C123GXL

Hello, currently i am trying to programme a code in code composer v6 to allow multiple pages to be displayed on the Kentec LCD display. However, i am not sure how to do so. Please advise. 

Currently the code i am using has a "+" at the bottom right screen, which is supposed to direct me to the next page. However, after implementing the code, the touch screen no longer works as there is a fault in the coding, which causes it to run in an infinite fault while loop. 

RectangularButton(g_sPushNext, 0, 0, 0,
&g_sKentec320x240x16_SSD2119, 270, 190, 50, 50,
PB_STYLE_IMG | PB_STYLE_TEXT, ClrBlack, ClrBlack, 0,
ClrSilver, &g_sFontCm20, "+", g_pucBlue50x50, g_pucBlue50x50Press, 0, 0, 0);

This is the code that is wrong.

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/interrupt.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "grlib/grlib.h"
#include "grlib/widget.h"
#include "grlib/canvas.h"
#include "grlib/pushbutton.h"
#include "Kentec320x240x16_ssd2119_8bit.h"
#include "touch.h"
#include "images.h"

extern tCanvasWidget g_sBackground;
extern tCanvasWidget g_sBackground2;
extern tPushButtonWidget g_sPushBtn;
extern tPushButtonWidget g_sPushBtn2;
extern tPushButtonWidget g_sPushBtn3;
extern tPushButtonWidget apples;

void OnButtonPress(tWidget *pWidget);
void OnButtonPress2(tWidget *pWidget);
void OnButtonPress3(tWidget *pWidget);
void PushNext(tWidget *pWidget);

//**************************************************************************************8
RectangularButton(g_sPushNext, 0, 0, 0,
&g_sKentec320x240x16_SSD2119, 270, 190, 50, 50,
PB_STYLE_IMG | PB_STYLE_TEXT, ClrBlack, ClrBlack, 0,
ClrSilver, &g_sFontCm20, "+", g_pucBlue50x50, g_pucBlue50x50Press, 0, 0, 0);
//Something wrong with the code!!!!

Canvas(g_sHeading, &g_sBackground, &g_sPushNext, &g_sPushBtn,
&g_sKentec320x240x16_SSD2119, 0, 0, 320, 23,
(CANVAS_STYLE_FILL | CANVAS_STYLE_OUTLINE | CANVAS_STYLE_TEXT),
ClrBlack, ClrWhite, ClrRed, g_psFontCm20, "LED Control", 0, 0);
//***********************************************************************************************

//***********************************************************************************************
Canvas(g_sBackground, WIDGET_ROOT, 0, &g_sHeading,
&g_sKentec320x240x16_SSD2119, 0, 23, 320, (240 - 23),
CANVAS_STYLE_FILL, ClrBlack, 0, 0, 0, 0, 0, 0);


RectangularButton(g_sPushBtn, &g_sHeading, &g_sPushBtn2, 0,
&g_sKentec320x240x16_SSD2119, 60, 60, 200, 40,
(PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
PB_STYLE_FILL), ClrRed, ClrWhite, ClrWhite, ClrPurple,
g_psFontCmss22b, "Toggle red LED", 0, 0, 0, 0, OnButtonPress);


//Add-ons*********************************************************************************************************

RectangularButton(g_sPushBtn2,
&g_sHeading, //psParent
&g_sPushBtn3, //psNext
0, //psChild
&g_sKentec320x240x16_SSD2119,//psDisplay
60,//i32x
120,//i32y
200,//i32width
40,//i32height
(PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
PB_STYLE_FILL), //ui32style
ClrRed,
ClrYellow,
ClrWhite,
ClrBlack,//uifillcolor
g_psFontCmss22b,//
"Toggle green LED",//13
0, //14
0,//15
0,//16
0,//17
OnButtonPress2);//18

RectangularButton(g_sPushBtn3,
&g_sHeading, //psParent
0, //psNext
0, //psChild
&g_sKentec320x240x16_SSD2119,//psDisplay
60,//i32x
180,//i32y
200,//i32width
40,//i32height
(PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
PB_STYLE_FILL), //ui32style
ClrRed,
ClrYellow,
ClrWhite,
ClrBlack,//uifillcolor
g_psFontCmss22b,//
"Toggle blue LED",//13
0, //14
0,//15
0,//16
0,//17
OnButtonPress3);//18

//Add-ons**********************************************************************************************************

bool g_RedLedOn = false;
bool g_GreenLedOn = false;
bool g_BlueLedOn = false;

//void PushNext(tWidget *pWidget)
//{
// Canvas(g_sBackground2, WIDGET_ROOT, 0, &g_sHeading,
// &g_sKentec320x240x16_SSD2119, 0, 0, 320, 240,
// CANVAS_STYLE_FILL, ClrPurple, 0, 0, 0, 0, 0, 0);

// RectangularButton(apples, &g_sBackground2, 0, 0,
// &g_sKentec320x240x16_SSD2119, 60, 60, 200, 40,
// (PB_STYLE_OUTLINE | PB_STYLE_TEXT_OPAQUE | PB_STYLE_TEXT |
// PB_STYLE_FILL), ClrRed, ClrWhite, ClrWhite, ClrPurple,
// g_psFontCmss22b, "Test", 0, 0, 0, 0, 0);
//}

void OnButtonPress(tWidget *pWidget)
{
g_RedLedOn = !g_RedLedOn;
if(g_RedLedOn)
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, 0x02);
}
else
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, 0x00);
}
}
//*********************************************************
void OnButtonPress2(tWidget *pWidget)
{
g_GreenLedOn = !g_GreenLedOn;
if(g_GreenLedOn)
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0x08);
}
else
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0x00);
}
}

void OnButtonPress3(tWidget *pWidget)
{
g_BlueLedOn = !g_BlueLedOn;
if(g_BlueLedOn)
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0x04);
}
else
{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0x00);
}
}
//*********************************************************

int main(void)
{
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x00);
Kentec320x240x16_SSD2119Init();
TouchScreenInit();
TouchScreenCallbackSet(WidgetPointerMessage);


WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sBackground);
WidgetPaint(WIDGET_ROOT);


while(1)
{

WidgetMessageQueueProcess();
}
}