I ported I80Bus from lcd_bus to MicroPython and uploaded it along with the helper gpio_registers.py here. It works, but is VERY slow. It will serve as a good reference for anyone writing non-ESP32 bus drivers in C. It uses lookup tables whose size is determined by the bus_width, so a bus_width of 8 needs lookup tables sized 2^8, or 256 entries. Each entry is 32 bits. The reason they are 32 bits is that is the most number of pins that may be set (or reset) at a time using machine.mem32. There has to be a lookup table for each set of 32 pins, so if all the data pins are in the range 0 to 31 or 32 to 63, then only one lookup table is needed. The WT32SC01-plus has 7 of the data pins between 0 and 31, but one data pin is 46, so it requires 2 lookup tables. It would be more memory efficient to implement the lookup tables as byte arrays, but this is a proof of concept and reference for porting to C, so I didn’t take the time to do that.
A bus width of 16 would require 65,536 entries in each lookup table. Ignoring the overhead for a list of ints instead of a byte array, that’s still 256k per lookup table, so this lookup table method isn’t practical for larger bus widths. I put a line in the code that checks to make sure bus_width = 8 for that reason. Hopefully platform-specific versions won’t need lookup tables at all.
Another limitation is it depends on using pin numbers as opposed to pin names. That means it should work on ESP32 (which is what I tested it on), RP2, SAMD and NRF, but it won’t work on STM32, MIMXRT or Renesas-RA without a major rewrite of the GPIO_SET_CLR_REGISTERS class in gpio_registers.py.
I’m going to go back to testing RGBBus in lcd_bus next but have no intention of trying to port it to MicroPython because it relies heavily on perfect timing.