Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

....
while(1)
{
// Draw GOL objects
if(GFX_GOL_ObjectListDraw() == GFX_STATUS_SUCCESS)
{
// Get message from touch screen
TouchGetMsg(&msg);
// Process message
GFX_GOL_ObjectMessage(&msg);
}
}
}
//*********************************************************************
// The draw callback is called within GFX_GOL_ObjectListDraw()
//*********************************************************************
bool APP_ObjectDrawCallback(void)
{
// assume pScrollBar is pointer to the scrollbar
bool signalAssert;
// assume signal is sampled at a pin RC1
if (PORTCbits.RC1 == 1)
signalAssert = true;
else
signalAssert - false;
if (signalAssert == true)
{
// increment the value
GFX_GOL_ScrollBarPositionIncrement(pScrollBar);
}
else
{
// increment the value
GFX_GOL_ScrollBarPositionDecrement(pScrollBar);
}
// redraw only the thumb
GFX_GOL_ObjectStateSet(pScrollBar, GFX_GOL_SCROLLBAR_DRAW_THUMB_STATE);
return (true);
}
Since the callback is called in GFX_GOL_ObjectListDraw() and GFX_GOL_ObjectListDraw() is called in the main loop, the
callback can potentially be executed unnecessarily if the sampled signal frequency of change is slow. To counter that, the
callback can be modified to be sampling the signal after some pre-defined time delay.
//*********************************************************************
// The draw callback is called within GFX_GOL_ObjectListDraw()
//*********************************************************************
bool APP_ObjectDrawCallback(void)
{
// assume pScrollBar is pointer to the scrollbar
// assume tick is a system counter, DEFINED_DELAY is
// a predefined delay tuned to the signal frequency
bool signalAssert;
static uint32_t prevtick = 0;
if (tick - prevtick > DEFINED_DELAY)
{
prevtick = tick;
1.4 Using The Library MLA - Graphics Library Help Library Overview
47

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh