We’ve gotten used to the GPIO-available functions of Raspberry Pi computers remaining largely the same over the years, which is why it might have flown a little bit under the radar: the Raspberry Pi 4 ...
The connection to the PI's SPI bus is very simple and can be seen in the diagram below. The only additional component that is recommended is a 1uF capacitor connected between pins 15 and 16 to ground ...
Using the functions listed above it is easy to implement the loopback example given earlier: #include <stdio.h> #include <stdlib.h> #include <time.h> #include "Gpio5.h" int main(int argc, char **argv) ...