Subversion Repositories Code-Repo

Rev

Rev 199 | Blame | Last modification | View Log | RSS feed

#ifndef SPI1_H
#define SPI1_H

#define SPI1_BUFFER_SIZE 300

// Flag for selecting write-only on SPI1
#define SPI1_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);
} SPI1_DATA;

void SPI1_Init(SPI1_DATA *data);
// 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

#endif  /* SPI1_H */