MCU Config: possible to have 'optional pin' in config message to mcu

Hi,
I’m putting together a driver for LCD panels, and trying to make it flexible for different IO handling. A few of my challenges are:

  1. Some LCD controllers will have a reset pin. Some may not.
    I’d like to use the same DECL_COMMAND for both.
    Is that possible?
    Looking at the SPI implementation that has both a ‘with cs’ and a ‘without cs’ DECL_COMMAND, I’m suspecting not. But maybe that’s just for legacy compatibility reasons.

  2. In the same vein, I’d like to pass a variable number of Data/Address pins in a different DECL_COMMAND. So the bus width might be 8, or it might be 16 etc… certain platforms like PI Pico with PIO (for mcus with FlexIO) might be able to have pins scattered around making up an 8 or 16 bit bus.
    I’d really like to just get an ‘array’ of such pins from the DECL_COMMAND…
    Any idea if that’s doable?

Not currently. There have been discussions in the past of adding a special NOPIN pin to declare a dummy pin, but it has not been implemented.

Creating multiple command permutations (eg, spi “with cs” and “without cs”) is what is typically done today.

No. The current protocol has a fixed number of parameters for each registered command.

To pass an array, the current mechanism is to pass the array size in the initial “create_mythingy” command and then to call a “mythingy_set_pin index=%c pin=%u” for each element of the array to be assigned. See src/buttons.c for an example.

-Kevin

1 Like