3,27 → 3,20 |
|
#define SPI1_BUFFER_SIZE 300 |
|
// Flag for selecting write-only on SPI1 |
#define SPI1_WRITE_ONLY |
#define SPI_WRITE_ONLY |
|
typedef struct { |
char outBuffer[SPI1_BUFFER_SIZE]; |
int outBufferInd; |
int outBufferLen; |
#ifndef SPI1_WRITE_ONLY |
char inBuffer[SPI1_BUFFER_SIZE]; |
int inBufferInd; |
int inBufferLen; |
#endif |
void (*callback_function)(void); |
char buffer_out[SPI1_BUFFER_SIZE]; |
int buffer_out_ind; |
int buffer_out_len; |
|
void (*tx_callback)(void); |
void (*rx_callback)(char); |
} SPI1_DATA; |
|
void SPI1_Init(SPI1_DATA *data); |
void SPI1_Init(SPI1_DATA *data, void (*rx_callback)(char)); |
// Note: SPI1_Write() writes MSB -> LSB! |
int SPI1_Write(unsigned char *array, unsigned int count, void (*callback)(void)); |
#ifndef SPI1_WRITE_ONLY |
int SPI1_Read_Buffer(unsigned char *array, unsigned int count); |
#endif |
int SPI1_Write(unsigned char *array, unsigned int count, void (*tx_callback)(void)); |
|
#endif /* SPI1_H */ |
|