avr-st7735/include/spi.h

23 lines
303 B
C
Raw Permalink Normal View History

2016-12-05 14:56:09 +01:00
#ifndef _SPI_H_
#define _SPI_H_
#include<avr/io.h>
void spi_init(void);
2016-12-05 14:56:09 +01:00
static inline void spi_write(uint8_t byte) {
SPDR = byte;
while(!(SPSR & (1<<SPIF)));
}
2016-12-07 00:26:43 +01:00
static inline void spi_set_cs(void) {
2016-12-05 14:56:09 +01:00
PORTB |= (1 << PB2);
}
2016-12-07 00:26:43 +01:00
static inline void spi_unset_cs(void) {
2016-12-05 14:56:09 +01:00
PORTB &= ~(1 << PB2);
}
#endif