//
// Created by kirillius on 25.09.2021.
//

#ifndef AVR_IOHELP_SPI_H
#define AVR_IOHELP_SPI_H
#include <avr/io.h>

#define SPI(MOSI, MISO, SCK) do{DDRB = ((DDRB&~(1<<MISO))|(1<<MOSI)|(1<<SCK)); (SPCR |= (1<<SPE)|(1<<MSTR)); SPSR |= (1<<SPI2X);}while(0)


namespace SPI{
    uint8_t transfer(uint8_t byte);
    void send(uint8_t byte);
    uint8_t receive();
    uint8_t data();
}

#endif //AVR_IOHELP_SPI_H
