I got myself a Raspberry Pi High-Precision AD/DA Expansion Board to be used in a Windows IoT Core C# application.
All documentation provided by WaveShare was referring to Raspberry Pi running Linux and the source code examples was written in C, so I had to write my own library. The first challenge was to try to understand how the Linux code actually communicated with the board, and it turned out to be quite a bit of detective work.
The Linux examples needed a BCM2835 library to work, so I started with its source code to get an understanding of it. It took some time to wrap my head around it, but in the end, it turned out not to be especially complicated.
Here are my findings.
The basics of the board
The two converter chips both communicate with the Raspberry Pi over the SPI bus which uses three pins of the Pi: data in, data out and a clock signal.
Since the two chips share the same communication lines, somehow they need to know when the Pi wants to speak to the one or the other.
This is achieved by using two GPIO pins, one for each chip, controlled by the Raspberry Pi (who serves as the master of the communication). When the Pi is pulling the signal LOW on one of these pin means that the corresponding chip is selected. After communication, the signal is set back to HIGH. This is a common technique called chip select.