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