summaryrefslogtreecommitdiffstats
path: root/spi_slave.h
blob: 0717167275dfe136c1ce2c613d4242b1ae38943e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef AVR_SPI_SLAVE_ABSTRACTION_H_
#define AVR_SPI_SLAVE_ABSTRACTION_H_

#include <stdint.h>


/* Queue a buffer for transmission to the master. */
int8_t spi_slave_xmit(const void *buf, uint16_t nr_bytes);
/* Queue a buffer for receiving data from the master. */
int8_t spi_slave_fetch(void *buf, uint16_t size);
/* Initialize the SPI slave. */
void spi_slave_init(void);


/*** Callback functions. Define these in the highlevel code. ***/

/* The last transfer (TX or RX) is complete.
 * Note that size may be larger than the buffer for RX! This notifies
 * a data truncation. */
extern void spi_slave_xfer_complete(uint16_t size);

#endif /* AVR_SPI_SLAVE_ABSTRACTION_H_ */
bues.ch cgit interface