I'm trying to use Arduino to control IC with SPI. This is my first time using Arduino, so I just tried SPI library.
Thanks to many other examples, now I'm able to send and receive 32 bits data which is necessary to control IC named RHS2116.
However, there are some questions because of the method I'm using.
Right now, I'm using modified method came from Tom Carpenter's code at "SPI read write for 32bits data - Microcontrollers - Arduino Forum".
The IC is on delivery now, so I'm using additional Arduino as slave. I attached codes.
It seems that SPI.transfer() reads slave's data first and then sends message according to the result of Serial.print() function.
I think I can make the replies in proper order by shifting using SPI.transfer(msg.bit8[0]) at the front and SPI.transfer(0).
The questions is
the shifting will also work well for RHS2116?
or, in other words, do additional 8 bits after 32 bits affect the operation of IC?
Sorry for my bad English
SPI_step2_master.ino (1.04 KB)
SPI_step2_slave.ino (483 Bytes)
RHS2116.h (917 Bytes)