Hello there
I'm trying to hook up my gumstix to the my arduino using spi. The gumstix parts done but I'm a bit stuck on the arduino side. after having a look at the tutorial example for spi it shows an example for being the master but there's no example code for slave set up.
I can figure out how the example works and how to change most of it e.g. changing directions of the pins and the reg set up. But the only bit of real code shifts the bits out. I think SPDR = data just puts data in a reg and the hard does the rest is this true?
char spi_transfer(volatile char data){
SPDR = data; // Start the transmission
while (!(SPSR & (1<<SPIF))) {}; // Wait the end of the transmission
return SPDR; // return the received byte
}
So how do I shift bits in, is there any built in commands or does the program have to wait for the slave to go high then do a loop looking for clk and data changes. Is there a biult in reg like SPDR?
thanks bren