Skip to content

Passing pin name to avr_alloc_irq #39

@gergoerdi

Description

@gergoerdi

I'd like to expose the "pins" of my simulated off-MCU components to the MCU simulation as standalone irqs. In C(++), I can do that like this:

namespace Name {
    const char* dc = "LCD.DC";
}

dc = avr_alloc_irq(&(avr->irq_pool), 0, 1, &Name::dc);

and then connect it to a pin of an MCU port:

avr_connect_irq(avr_io_getirq(avr, AVR_IOCTL_IOPORT_GETIRQ('D'), 5), dc);

I can see that avr_alloc_irq is exposed in pysimavr.swig.simavr, however, I haven't been able to figure out how to pass the pin name to it. If I just try

dc = avr_alloc_irq(avr.irq_pool, 0, 1, "LCD.DC")

then at runtime I get the following type error:

TypeError: in method 'avr_alloc_irq', argument 4 of type 'char const **'

Of course, it's not hard to see why -- "LCD.DC" is a string, not a pointer to a string; but how do I get over this hurdle?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions