and my knowledge of C++ is not good enough to make sense of it. (It seems to compile ok).
Q1. What sort of things are "SPDR and SDSR"?
I thought all C++ variables had to be created like "int abc = 12"
I am also aware of stuff like "#define ABC 37"
Q2. Do these things (SPDR, SPSR) have global or local scope?
Q3. Is this perhaps a short dummy routine to mimic the existence of an SPI call?
The stuff I downloaded doesn't use the SPI library, it uses the Wire library. But it does need to
make SPI calls.
Q4. A bit of history --- did the Wire library exist before the SPI library?
Place some data in the SPI data register (which initiates an SPI transfer).
Wait for bit 7 of the SPI status register to go high, which indicates the SPI transfer is complete.
Return the received data.
Basically it performs the same job as SPI.transfer().
They are global "Special Function Registers" defined in the system level header files for the specific chip you are using.
Wire (I2C) and SPI are two different technologies created by different companies. I have no idea which came first, but they work in different ways and are suitable for different jobs.