Code: Select all
palEnablePadEvent(GPIOA, 9, PAL_EVENT_MODE_BOTH_EDGES);
palEnablePadEvent(GPIOA, 10, PAL_EVENT_MODE_BOTH_EDGES);
palSetPadCallback(GPIOA, 9, callback, 1);
palSetPadCallback(GPIOA, 10, callback, 2);
My questions: how to use arguments to a callback function in a way that I can tell in the callback which pad caused the event? (I was hoping that I could pass a literal integer, but C does not seem to allow that even with casts). Am I misunderstanding the concept of arguments to a callback function? Is it wrong to use the same callback for two different events?