#include "spi.h" #include void spi_init_master() { SPCR = _BV(SPE) | _BV(MSTR) | _BV(SPR0); SPI_PORT |= _BV(SCK_PIN); SPI_DDR |= _BV(MOSI_PIN) | _BV(SCK_PIN) | _BV(SS_PIN); } uint8_t spi_transfer(uint8_t b) { SPDR = b; while (!(SPSR & _BV(SPIF))); return SPDR; }