Subversion Repositories Code-Repo

Rev

Blame | Last modification | View Log | RSS feed

#ifndef SPI4_H
#define SPI4_H

#define SPI4_BUFFER_OUT_SIZE    10
#define SPI4_BUFFER_IN_SIZE     10

typedef struct {
    char buffer_out[SPI4_BUFFER_OUT_SIZE];
    int buffer_out_ind;
    int buffer_out_len;
    char write_blank;

    char buffer_in[SPI4_BUFFER_IN_SIZE];
    int buffer_in_ind;
    int buffer_in_len;

    void (*tx_callback)(void);
    void (*rx_callback)(char, char *);
} SPI4_DATA;

void SPI4_Init(SPI4_DATA *data);
int SPI4_Read(int length, void (*rx_callback)(char, char *));
int SPI4_Write(char *array, int length, void (*tx_callback)(void));

#endif  /* SPI4_H */