TTK4155 Lab Node 1
Term project in the NTNU course TTK4155 Embedded and Industrial Computer Systems Design
Loading...
Searching...
No Matches
spi.h
Go to the documentation of this file.
1
8
9#ifndef INCLUDE_INCLUDE_SPI_H_
10#define INCLUDE_INCLUDE_SPI_H_
11
20
29int spi_init(void);
30
36int spi_ready(void);
37
46int spi_send_n(enum spi_slave *slave, unsigned char *data, int length);
47
55int spi_send(enum spi_slave *slave, unsigned char data);
56
66int spi_recieve(enum spi_slave *slave, unsigned char *out);
67
76int spi_recieve_n(enum spi_slave *slave, unsigned char *out, int length);
77
89int spi_duplex(enum spi_slave *slave, unsigned char *data, unsigned char *out,
90 int length);
91
99int spi_set_slave_select(enum spi_slave *slave, unsigned char state);
100
109int spi_push(enum spi_slave *slave, unsigned char data, unsigned char *out);
110
111#endif // INCLUDE_INCLUDE_SPI_H_
112
int spi_recieve_n(enum spi_slave *slave, unsigned char *out, int length)
Receive several bytes from a slave.
Definition spi.c:96
int spi_send_n(enum spi_slave *slave, unsigned char *data, int length)
Send a sequence of bytes to a slave without reading response.
Definition spi.c:81
int spi_ready(void)
Check if the SPI subsystem is initialized.
Definition spi.c:41
int spi_duplex(enum spi_slave *slave, unsigned char *data, unsigned char *out, int length)
Full-duplex SPI transfer.
Definition spi.c:131
int spi_set_slave_select(enum spi_slave *slave, unsigned char state)
Set the slave-select line for the given device.
Definition spi.c:43
int spi_push(enum spi_slave *slave, unsigned char data, unsigned char *out)
Push one byte to a slave and optionally read the response.
Definition spi.c:154
int spi_send(enum spi_slave *slave, unsigned char data)
Send a single byte to a slave.
Definition spi.c:86
int spi_recieve(enum spi_slave *slave, unsigned char *out)
Receive one byte from a slave.
Definition spi.c:91
spi_slave
Identifiers for available SPI slave devices.
Definition spi.h:15
int spi_init(void)
Initialize SPI in master mode.
Definition spi.c:9
@ SSB2
Definition spi.h:16
@ SSB3
Definition spi.h:17
@ SSE2
Definition spi.h:18