123456789101112131415161718192021222324252627282930313233 |
- /*
- * Bit-Banged SPI routines
- */
-
- #ifndef _SPI_H
- #define _SPI_H
-
- #include <stdint.h>
- #include <avr/io.h>
-
- #define SCK_on PORTB |= PB4
- #define SCK_off PORTB &= ~(PB4)
-
- #define MO_on PORTB |= PB3
- #define MO_off PORTB &= ~(PB3)
-
- #define CS_on PORTB |= PB1
- #define CS_off PORTB &= ~(PB1)
-
- #define MI_1 (PINB & PB2) == PB2
- #define MI_0 (PINB & PB2) != PB2
-
- #define GDO_1 (PINB & PB0) == PB0
- #define GDO_0 (PINB & PB0) != PB0
-
- #define NOP() __asm__ __volatile__("nop")
-
- void spiInit(void);
- void spiWrite(uint8_t command);
- uint8_t spiRead(void);
-
- #endif
|