[SKiDL Feature Request] Multiple slices to access pin numbers
Would be useful to fetch pins in buses that contain multiple numbers slices. For example:
new_bus = Bus('GPIO[26:29]_ADC[0:3]')
Can you provide an example where this would be used?
The pin names for the microcontroller that I'm currently using have the following names:
GPIO26_ADC1 GPIO27_ADC2 GPIO28_ADC3 GPIO29_ADC4
I see the problem. There are several solutions using the existing codebase. Here's the simplest one: use the split_pin_names function (introduced in version 1.0.0). If your microcontroller is in a part named mcu, then you can split all the pin names using underscore as the delimiter like so:
mcu.split_pin_names('_')
After that, each pin named GPIOXX_ADCYY will have additional aliases GPIOXX and ADCYY. Then you can access them using mcu['ADC[1:4]'] or mcu['GPIO[26:29]'].
This may cause some problems if you have other pins with underscore-separated names like DO_NOT_USE which would create pin aliases of DO, NOT and USE that may collide across multiple pins. If that's a problem, we'll think of a work-around.
Thanks! I will give this a try.