ZigEmbeddedGroup / microzig

Unified abstraction layer and HAL for several microcontrollers
zlib License
1.26k stars 102 forks source link

rp2xxx: Make `get_irq_regs` public #283

Open Grazfather opened 2 weeks ago

Grazfather commented 2 weeks ago

sm_enable_interrupt uses this function, but if I have a PIO program that wants to wait for the interrupt, I need to re-write the function as below:

fn get_irq_regs(irq: Irq) *volatile Irq.Regs {
    const PIO0 = microzig.chip.peripherals.PIO0;
    const irq_regs = @as(*volatile [2]Irq.Regs, @ptrCast(&PIO0.IRQ0_INTE));
    return &irq_regs[@intFromEnum(irq)];
}

And this is hardcoded for PIO0. I can't even call get_regs because that method is also not public.