diff options
Diffstat (limited to 'spi.h')
-rw-r--r-- | spi.h | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -0,0 +1,27 @@ +#ifndef _SPI_H_ +#define _SPI_H_ + +#include <stdint.h> +#include <avr/io.h> + +#define PORT_SPI PORTB +#define DDR_SPI DDRB +#define DD_MISO DDB4 +#define DD_MOSI DDB3 +#define DD_SS DDB2 +#define DD_SCK DDB5 + +inline void spi_cs_low() +{ + PORT_SPI &= ~(_BV(DD_SS)); +} + +inline void spi_cs_high() +{ + PORT_SPI |= _BV(DD_SS); +} + +extern void spi_init(); +extern uint8_t spi_two_byte(uint8_t cmd, uint8_t data); + +#endif /* _SPI_H_ */ |