int DeviceDriver_ProcessData( void )
{
int needUpdate = 0;
/*
Get the data you want to provide to the GUI application.
In case your are working with an operating system and your device is
controlled from a separate task/thread/process, take all information
from your device driver out of the message queue.
Please note, that this function is called within the context of the main
GUI thread.
If you control your system by direct register access or some BSP functions,
get all necessary data you want to provide to the GUI application.
*/
#ifdef _ApplicationDeviceClass_
/* here we just evaluate the current hardware button state */
// if ( digitalRead( BUTTON_GPIO ) == LOW )
// ButtonCounter++;
// else
// ButtonCounter = 0;
/* check for a valid access to the autoobject of the device class */
if ( DeviceObject == 0 )
return 0;
/*
For each device paramter, that is represented by a property within the
Embedded Wizard device class and that you want to update, you have to call
the appropriate UpdateProperty() method.
The following examples assumes, that you have a device class with the
name 'DeviceClass' within the unit 'Application'.
*/
/* Update the property HardButtonCounter within the class Application::DeviceClass
by calling the method 'UpdateHardButtonCounter' - the generated define is
evaluated to ensures that the method is available within the generated code. */
// #ifdef _ApplicationDeviceClass__UpdateHardButtonCounter_
// ApplicationDeviceClass__UpdateHardButtonCounter( DeviceObject, (XInt32)ButtonCounter );
// needUpdate = 1;
// #endif
/*
Trigger system events if necessary, e.g. if a certain situation happens,
if an error occurs or just if a certain value has changed...
*/
/* When the hardware button is pressed, call the method 'TriggerHardButtonEvent()' of the
device class 'DeviceClass' within the unit 'Application' - the generated define is
evaluated to ensure that the method is available within the generated code. */
// if ( ButtonCounter == 1 )
// {
// #ifdef _ApplicationDeviceClass__TriggerHardButtonEvent_
// ApplicationDeviceClass__TriggerHardButtonEvent( DeviceObject );
// needUpdate = 1;
// #endif
// }
while((ADS1256_Scan() == 0));
for (i = 0; i < ch_num; i++)
{
adc[i] = ADS1256_GetAdc(i);
volt[i] = (adc[i] * 100) / 167;
}
for (i = 0; i < ch_num; i++)
{
buf[0] = ((uint32_t)adc[i] >> 16) & 0xFF;
buf[1] = ((uint32_t)adc[i] >> 8) & 0xFF;
buf[2] = ((uint32_t)adc[i] >> 0) & 0xFF;
printf("%d=%02X%02X%02X, %8ld", (int)i, (int)buf[0],
(int)buf[1], (int)buf[2], (long)adc[i]);
iTemp = volt[i]; /* uV */
if (iTemp < 0)
{
iTemp = -iTemp;
printf(" (-%ld.%03ld %03ld V) \r\n", iTemp /1000000, (iTemp%1000000)/1000, iTemp%1000);
}
else
{
printf(" ( %ld.%03ld %03ld V) \r\n", iTemp /1000000, (iTemp%1000000)/1000, iTemp%1000);
}
}
printf("\33[%dA", (int)ch_num);
bsp_DelayUS(100000);
needUpdate = 1;
#endif
/*
Return a value != 0 if there is at least on property changed or if a
system event was triggered. The return value is used by the main loop, to
decide whether the GUI application has changed or not.
*/
return needUpdate;
}
This is the part of the code that is meant to run infinitely.Corresponding changes have been done in the rest of the file as well.
This code is intended to print ADC values continuously. I am guessing, this is the part which might be the culprit . My intention currently is to have the UI running while ADC values get printed on the terminal at the backend.