I'm using rfal 1.3.0 and nfcPoller. These work fine on our hardware, but nfcPoller is taking 16% CPU at idle (re: no tech detection).
I'd like to make nfcPoller interrupt driven. I've tried registering a callback so that exampleRfalPollerRun() gets called on interrupts but that didn't seem to do anything. I've also tried a simple loop that does this:
ret = gpio_init();
if(ret != ERR_NONE)
goto error;
ret = spi_init();
if(ret != ERR_NONE)
goto error;
ret = interrupt_init();
if (ret != ERR_NONE)
goto error;
rfalAnalogConfigInitialize();
rfalInitialize();
rfalWakeUpModeStart(NULL);
for(;;)
{
rfalWorker();
if ( rfalWakeUpModeHasWoke() )
{
printf("Awakened\n");
rfalWakeUpModeStop();
sleep(1);
rfalWakeUpModeStart(NULL);
}
}But I don't get the awakened message. In any event, this isn't really interrupt driven anyway since I'm just spinning in a tighter loop. I'd like to be able to poll() on the interrupt line, as is done in pltf_gpio.c:pthread_func(). If I just call my own callback in that function I don't see the wake-up interrupt, suggesting I'm either not using the API correctly or it's not working properly. I don't know how to tell which at the moment.
Is there a methodology I should be using to switch from polling to interrupt driven processing when using the rfal library? We want to handle processing only when a tag is held over the chip instead of constantly polling for available tags in order to reduce CPU overhead.
FYI, I put in a usleep(750) in the deactivate case of exampleRfalPollerRun() (only when no tag had been detected and processed) which reduced cpu usage to about 3% on idle but that seems like an ugly hack.
