59 lines
1.1 KiB
C
59 lines
1.1 KiB
C
#ifndef _TABBY_AVR_H
|
|
#define _TABBY_AVR_H
|
|
|
|
#define SPI_PULSE_USEC 61
|
|
|
|
#define SC_DDR DDRB
|
|
#define SC_DDB DDB5
|
|
#define SC_PORT PORTB
|
|
#define SC_PORT_PIN PORTB5
|
|
|
|
#define SC_INPUT() \
|
|
(SC_DDR |= ~(1 << SC_DDB))
|
|
|
|
#define SC_OUTPUT() \
|
|
(SC_DDR |= (1 << SC_DDB))
|
|
|
|
#define SC_HIGH() \
|
|
(SC_PORT |= (1 << SC_PORT_PIN))
|
|
|
|
#define SC_LOW() \
|
|
(SC_PORT &= ~(1 << SC_PORT_PIN))
|
|
|
|
#define SI_DDR DDRB
|
|
#define SI_DDB DDB3
|
|
#define SI_PIN_REG PINB
|
|
#define SI_PIN PINB3
|
|
#define SI_PORT PORTB
|
|
#define SI_PORT_PIN PORTB3
|
|
|
|
#define SI_INPUT() \
|
|
(SI_DDR &= ~(1 << SI_DDB))
|
|
|
|
#define SI_PULLUP() \
|
|
(SI_PORT |= (1 << SI_PORT_PIN))
|
|
|
|
#define SI_IS_HIGH() \
|
|
(SI_PIN_REG & (1 << SI_PIN))
|
|
|
|
#define SO_DDR DDRB
|
|
#define SO_DDB DDB4
|
|
#define SO_PORT PORTB
|
|
#define SO_PORT_PIN PORTB4
|
|
|
|
#define SO_OUTPUT() \
|
|
(SO_DDR |= (1 << SO_DDB))
|
|
|
|
#define SO_HIGH() \
|
|
(SO_PORT |= (1 << SO_PORT_PIN))
|
|
|
|
#define SO_LOW() \
|
|
(SO_PORT &= ~(1 << SO_PORT_PIN))
|
|
|
|
#define SS_DDR DDRB
|
|
#define SS_DDB DDB2
|
|
|
|
#define SS_INPUT() \
|
|
(SS_DDR &= ~(1 << SS_DDB))
|
|
|
|
#endif /* _TABBY_AVR_H */
|