I have been trying to decipher the NRF specification documents to simply understand how PPI, interrupts, Tasks, Events, and EGUs are supposed to work together. I am still confused.
Searching the DevZone, I came up with this post which refers to this nordic example.
In this code, we have a handler function which is supposed to do stuff when EVENTS_TRIGGER[x] register has a "true" value.
void SWI1_EGU1_IRQHandler(void)
{
if (NRF_EGU1->EVENTS_TRIGGERED[0] != 0)
{
NRF_EGU1->EVENTS_TRIGGERED[0] = 0;
NRF_GPIOTE->TASKS_CLR[PWM1_GPIOTE_CH] = 1; // Turn on LED2.
}
if (NRF_EGU1->EVENTS_TRIGGERED[1] != 0)
{
NRF_EGU1->EVENTS_TRIGGERED[1] = 0;
NRF_GPIOTE->TASKS_SET[PWM1_GPIOTE_CH] = 1; // Turn off LED2.
}
}
Could anyone tell how this EVENT_TRIGGERED[x] part of "NRF_EGU1" gets a value? What writes that value?
As already mentioned by other people, the NGU documentation is confusing and minimalistic; it does not clearly explain the read/write flow (e.g. what writes where and such information).