I'm trying to capture new updates on BatMon module (voltage and temperature).
In order to do so, I want to call AONBatMonTemperatureGetDegC() and AONBatMonBatteryVoltageGet() only after an update.
I wrote the following piece of code:
void hwiFxn(UArg arg)
{
System_printf("%d %d %d.\n", arg, AONBatMonTemperatureGetDegC(), AONBatMonBatteryVoltageGet());
}
Int main()
{
/* Call board init functions */
Board_initGeneral();
/* Call BatMon enable function */
AONBatMonEnable();
/* Map Update Temp and Volt events */
AONEventMcuSet(AON_EVENT_MCU_EVENT0, AON_EVENT_BATMON_TEMP);
AONEventMcuSet(AON_EVENT_MCU_EVENT0, AON_EVENT_BATMON_VOLT);
/* Hwi function to be called on temp and volt events */
Hwi_create(INT_AON_PROG0, (Hwi_FuncPtr) hwiFxn, NULL, NULL);
BIOS_start();
return(0);
}
Unfortunately, I got some problems:
- I don't know how to test if the hwi function is called because of real updates of BatMon temp and voltage measures.
- When I remove AONEventMcuSet calls, my hwiFxn is still called by something which makes me think that I misused the api.
- The hwiFxn function is called repeatedly and another swi functions (button call back) in my code are not called...
- I print the argument (arg) in hwiFxn and for the first two calls it values (as integer) are 0 and 1, then it is 855 (always). Where can I find the meaning of those numbers?
Thanks.