MP_STATE_PORT macro
Posted: Wed Feb 17, 2021 12:52 pm
I was examining the machine_pin.c file. and have seen tons of references in the code the MP_STATE_PORT(x) macro which seems to be associated with "irq objects". i.e.:
I would like to know what its purpose is. I've tried to imitate its use it, bit it gives me compilation errors.
Other question related to machine_pin_irq_obj is that apparently this is an array, declared with
zeroed with
but I can't see its size, which I suppose is NUM_BANK0_GPIOS
I have a working version of machine_rtc.c without interrupts. It could be used with busy loops or asyncio using polling with RTC.alarm_left(). If you find it useful as is, I could issue a pull request.
Code: Select all
machine_pin_irq_obj_t *irq = MP_STATE_PORT(machine_pin_irq_obj[self->id]);
Other question related to machine_pin_irq_obj is that apparently this is an array, declared with
Code: Select all
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_pin_irq_obj, 1, machine_pin_irq);
Code: Select all
memset(MP_STATE_PORT(machine_pin_irq_obj), 0, sizeof(MP_STATE_PORT(machine_pin_irq_obj)));
I have a working version of machine_rtc.c without interrupts. It could be used with busy loops or asyncio using polling with RTC.alarm_left(). If you find it useful as is, I could issue a pull request.