The UCD3138128 and 'A64 have dedicated SPI pins. Here is how to use them as GPIOs
There are 4 registers used for GPIO. Each has 4 bits in it, one for each pin. Here are their effects, pin by pin:
| Bit Value | 0 | 1 |
| SPIFUNC | Pin is SPI pin | Pin is GPIO pin |
| SPDIR | Pin is output | Pin is input |
| SPIGPOUT | Pin will output 0 if output | Pin will output 1 if output |
| SPIGPIN | Value on pin is 0 | Value on pin is 1 |
Notes:
1. SPIDIR, and SPIGPOUT only have effect if the SPIFUNC bit is a 1.
2. SPIGPIN shows the value on the pin regardless of the other bits. It works with the pins in SPI and output mode as well as input mode.
The bit names aren't exactly the same as the pin names, but it's easy to figure out:
| Bit | Pin |
| MISO | SPI_MISO |
| MOSI | SPI_MOSI |
| SCS | SPI_CS |
| SCK | SPI_CLK |