avr: clockticks missing in long_options
[avr-sim.git] / test / spi.h
blobdb7460c267eac3c39d91faa78dbc1fb8297df4fd
1 #ifndef SPI_H_
2 #define SPI_H_
4 #include <inttypes.h>
5 #include <avr/io.h>
7 #define SPIPORT PORTB
8 #define SPIPIN PINB
9 #define SPIDDR DDRB
11 #if defined(__AVR_ATmega8__)
12 #define SPISCK PB5
13 #define SPIMISO PB4
14 #define SPIMOSI PB3
15 #define SPISS PB2
16 #elif defined(__AVR_ATmega32__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega162__)
17 #define SPISCK PB7
18 #define SPIMISO PB6
19 #define SPIMOSI PB5
20 #define SPISS PB4
21 #else
22 #error "SPI pins undefined for this target"
23 #endif
25 #define SPI_SS_HIGH() (SPIPORT |= (1<<SPISS))
26 #define SPI_SS_LOW() (SPIPORT &= ~(1<<SPISS))
28 void spi_init(void);
29 uint8_t spi_readwrite(uint8_t data);
30 void spi_write(uint8_t data);
31 uint8_t spi_read(void);
33 #endif