spi/spi.h

34 lines
500 B
C
Raw Normal View History

2016-05-26 21:40:24 +02:00
#ifndef SPI_H
#define SPI_H
#include <avr/io.h>
enum class SPIClock
{
CLOCKDIV_4 = 0,
CLOCKDIV_16 = 1,
CLOCKDIV_64 = 2,
CLOCKDIV_128 = 3,
CLOCKDIV2X_2 = 4,
CLOCKDIV2X_8 = 5,
CLOCKDIV2X_32 = 6,
CLOCKDIV2X_64 = 7
};
enum class SPIMode
{
MODE0 = 0,
MODE1 = 1,
MODE2 = 2,
MODE3 = 3
};
void spiInit();
void spiEnd();
void spiSetClockDiv( SPIClock enmClockDiv );
void spiSetDataMode( SPIMode enmMode );
void spiSetBitOrder( bool bLSBFirst );
uint8_t spiTransfer( uint8_t ui8Data );
#endif