I’m reading the particle reference docs of the firmware for SPI. The problem is that I don’t really understand “transfer” function because it says that “SPI.transfer(val)” is both for sending and receiving. If I’m using Photon as master and I don’t care about the slave feedback, I can just write “SPI.transfer(0x01);”. But if I’m using Photon as a slave, how do I use “transfer” to receive data?
If in the slave loop I have “SPI.transfer(val);”, is “val” going to be the receiving data???
The doc says “the parameter val is the byte to send out over the SPI bus”, so where do I get the byte I received???