SPI transfer is based on a simultaneous send and recieve: the received data is returned in receivedVal. In case of buffer transfer the received data is stored in the buffer in-place (the old data is replaced with the data received) receivedVal = SPI.transfer(val)
SPI.transfer(buffer, size)
val: the byte ti send out over the bus
buffer: the array of data to be transferred
the received data