summaryrefslogtreecommitdiffstats
path: root/spi_master.h
blob: 5526e2d17fd05a1583b6e463a2d9607e0564d9ca (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_MASTER_ABSTRACTION_H_
#define AVR_SPI_MASTER_ABSTRACTION_H_

#include <stdint.h>


/* Transmit nr_bytes to the slave. */
int8_t spi_master_xmit(const void *buf, uint16_t nr_bytes);
/* Fetch bytes from the slave. Max=size */
int8_t spi_master_fetch(void *buf, uint16_t size);
/* Initialize the SPI master. */
void spi_master_init(void);


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

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

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