For my thesis I'm using an ATmega16 to communicate with MCP2515 over SPI. When we are checking the example code to set up SPI as a slave mode in the Atmega16 datasheet we get next example code.
void SPI_SlaveInit(void)
{
/* Set MISO output, all others input */
DDR_SPI = (1<<DD_MISO);
/* Enable SPI */
SPCR = (1<<SPE);
}
char SPI_SlaveReceive(void)
{
/* Wait for reception complete */
while(!(SPSR & (1<<SPIF)))
;
/* Return data register */
return SPDR;
}
We don't understand why they are using char SPI_SlaveReceive(void) instead of just void SPI_SlaveReceive(void). Can somebody explain us why they use the char instead of void? What is the difference? I can't find a good explanation on the internet.