Hello,
I was trying to run your code on Raspberry Pi 3. The code stuck at this line:
do writeReg(REG_SYNCVALUE1, 0xAA); while (readReg(REG_SYNCVALUE1) != 0xAA);
I turned on printf and see that It writes 0xaa @ 0x2f, but read 0x00 @ 0x2f.
I also ran a loopback test on Pi to make sure SPI interface works properly. Any idea what was the issue?