*** empty log message ***

This commit is contained in:
Antoine Drouin
2006-04-20 16:13:34 +00:00
parent 88b0899210
commit 29ee8f2a63
2 changed files with 79 additions and 0 deletions
+3
View File
@@ -124,6 +124,9 @@ fbw.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c
fbw.CFLAGS += -DDOWNLINK -DUART0
fbw.srcs += fbw_downlink.c $(SRC_ARCH)/uart_hw.c
fbw.CFLAGS += -DINTER_MCU -DMCU_SPI_LINK
fbw.srcs += inter_mcu.c $(SRC_ARCH)/spi_hw.c
ap.CFLAGS += -DDOWNLINK -DUSE_UART0
ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c
+76
View File
@@ -0,0 +1,76 @@
#ifndef SPI_HW_H
#define SPI_HW_H
#ifdef FBW
#define SPI_PORT PORTB
#define SPI_PIN PINB
#define SPI_SS_PIN 2
#define SpiIsSelected() (bit_is_clear(SPI_PIN, SPI_SS_PIN))
#endif /* FBW */
#ifdef AP
#define SPI_SS0_PIN 0
#define SPI_SS0_PORT PORTB
#define SPI_SS0_DDR DDRB
#define SPI_IT0_PIN 1
#define SPI_IT0_PORT PORTD
#define SPI_IT0_DDR DDRD
#define SPI_SS1_PIN 7
#define SPI_SS1_PORT PORTE
#define SPI_SS1_DDR DDRE
#define SPI_IT1_PIN 6
#define SPI_IT1_PORT PORTE
#define SPI_IT1_DDR DDRE
#define SPI_SCK_PIN 1
#define SPI_MOSI_PIN 2
#define SPI_MISO_PIN 3
#define SPI_PORT PORTB
#define SPI_DDR DDRB
#define SPI_START(_SPCR_VAL) { \
uint8_t foo; \
SPCR = _SPCR_VAL; \
if (bit_is_set(SPSR, SPIF)) \
foo = SPDR; \
SPCR |= _BV(SPIE); \
}
#define SPI_SELECT_SLAVE0() { \
spi_cur_slave = SPI_SLAVE0; \
cbi( SPI_SS0_PORT, SPI_SS0_PIN );\
}
#define SPI_UNSELECT_SLAVE0() { \
spi_cur_slave = SPI_NONE; \
sbi( SPI_SS0_PORT, SPI_SS0_PIN );\
}
#define SPI_SELECT_SLAVE1() { \
spi_cur_slave = SPI_SLAVE1; \
cbi( SPI_SS1_PORT, SPI_SS1_PIN );\
}
#define SPI_UNSELECT_SLAVE1() { \
spi_cur_slave = SPI_NONE; \
sbi( SPI_SS1_PORT, SPI_SS1_PIN );\
}
#define SPI_SEND(data) { \
SPDR = data; \
}
#define SPI_STOP() { \
cbi(SPCR,SPIE); \
cbi(SPCR, SPE); \
}
#endif /* AP */
#endif /* SPI_HW_H */