Giovanni wrote:The current SPI driver model does not support a slave mode, that kind of enhancement is necessarily a non-standard extension. I think a separate slave SPI driver model should be created but this is a task for ChibiOS 3.0.
Actually the changes required to support slave mode on the AVR are really trivial. I didn't need to change the API so far, just added an extra configuration value in the SPIConfig struct. In the low level driver there is a switch-case statement containing 3 lines (setting data direction and a bit in a register). The only gotcha I've found is that the user should not call spiSelect() / spiUnselect() in slave mode.
By the way, have you got any plans to support multiple slaves on SPI? Something like an array of port and pin values, so you could have multiple slaves on the SPI bus without doing spiStart with a different config each time you want to talk to a different one?
Cheers,
Vik