fixed spi dependency crazyness

master
Paul Goeser 15 years ago
parent d1b82c2432
commit 5f7abba64c

@ -1,7 +1,5 @@
#define SPI_BAUDRATE 1000000
#ifdef SPI_MASTER
#undef SPI_MASTER
#endif //SPI_MASTER
//#define SPI_SS_PORT D
//#define SPI_SS_PIN 7
#define SPI_MASTER
#define SPI_SS_PORT D
#define SPI_SS_PIN 7

@ -1,6 +1,8 @@
#ifndef SPI_PROTO_H
#define SPI_PROTO_H
#include <stdint.h>
#define SPI_WRITE_DATA 0x01
#define SPI_READ_DATA 0x10
#define SPI_NONE 0

@ -9,19 +9,6 @@
#include <spi.h>
uint16_t *spi_proto_globals8[] = {
&foo
};
uint8_t *spi_proto_globals16[] = {
&bar
};
funptr_t spi_proto_funcs[] = {
&baz
};
/* SPI framework.
*
* currently alpha, uses interrupts, single master/single slave operation
@ -116,6 +103,7 @@ void spi_mst_read(uint8_t len, uint8_t *data){
}
#ifndef SPI_MASTER
void __attribute__((always_inline)) spi_sla_handle_packet(){
// TODO: make slave not hangup in case of partial read
@ -144,7 +132,6 @@ void __attribute__((always_inline)) spi_sla_handle_packet(){
}
}
#ifndef SPI_MASTER
ISR(SPI_vect){
SPCR &= ~(_BV(SPIE)); //disable spi interrupts
spi_sla_handle_packet();

@ -1,5 +1,7 @@
#define SPI_BAUDRATE 1000000
#define SPI_MASTER
#define SPI_SS_PORT D
#define SPI_SS_PIN 7
#ifdef SPI_MASTER
#undef SPI_MASTER
#endif //SPI_MASTER
//#define SPI_SS_PORT D
//#define SPI_SS_PIN 7

@ -1,5 +1,19 @@
#include "spi_proto.h"
uint16_t *spi_proto_globals8[] = {
&foo
};
uint8_t *spi_proto_globals16[] = {
&bar
};
funptr_t spi_proto_funcs[] = {
&baz
};
uint8_t spi_proto_needswrite(uint8_t opcode) {
if(opcode == 4 || opcode == 5) return 1;
return 0;

Loading…
Cancel
Save