Using the Raspberry Pi Pico SDK, I see that the repeating_timer
callback functions have option input for user data. However, the gpio_set_irq_callback
function has no user data parameter.
Is there a way to access the member variables from gpio callback?
Should I go about implementing a user data parameter by changing my local sdk? How would I go about this?
void callback(uint gpio, uint32_t event_mask){
if(gpio_get(pina)){
//I want to call lcdmenu.up()
}
else{
//lcdmenu.down()
}
}
class lcdmenu
{
protected:
command **items;
int menutop = 0;
int numitems;
int menuselect = 0;
public:
lcdmenu(command **list, int length);
void render();
void down();
void up();
void enter();
};
lcdmenu::lcdmenu(command **list, int length)
{
gpio_set_irq_enabled_with_callback(pinb, GPIO_IRQ_EDGE_FALL, true, &callback);
numitems = length;
items = list;
render();
}