MCP2515 Library confusion

Thread Starter

Surender Singh 2

Joined Mar 7, 2017
3
I am unable to understand what does the below line does
data = spi_putc(0xff);
I am using arduino with mcp2515

uint8_t spi_putc( uint8_t data )
{
// put byte in send-buffer
SPDR = data;

// wait until byte was send
while( !( SPSR & (1<<SPIF) ) )
;

return SPDR;
}
uint8_t mcp2515_read_register(uint8_t adress)
{
uint8_t data;

RESET(MCP2515_CS);

spi_putc(SPI_READ);
spi_putc(adress);

data = spi_putc(0xff); //What is the use of this one???

SET(MCP2515_CS);

return data;
}
 
Top