TTK4155 Lab Node 1
Term project in the NTNU course TTK4155 Embedded and Industrial Computer Systems Design
Loading...
Searching...
No Matches
spi.c File Reference
#include <avr/io.h>
#include <util/delay.h>
#include "spi.h"
#include "utils.h"

Go to the source code of this file.

Functions

int spi_init ()
 Initialize SPI in master mode.
int spi_ready ()
 Check if the SPI subsystem is initialized.
int spi_set_slave_select (enum spi_slave *slave, unsigned char state)
 Set the slave-select line for the given device.
int spi_send_n (enum spi_slave *slave, unsigned char *data, int length)
 Send a sequence of bytes to a slave without reading response.
int spi_send (enum spi_slave *slave, unsigned char data)
 Send a single byte to a slave.
int spi_recieve (enum spi_slave *slave, unsigned char *out)
 Receive one byte from a slave.
int spi_recieve_n (enum spi_slave *slave, unsigned char *out, int length)
 Receive several bytes from a slave.
int spi_duplex (enum spi_slave *slave, unsigned char *data, unsigned char *out, int length)
 Full-duplex SPI transfer.
int spi_push (enum spi_slave *slave, unsigned char data, unsigned char *out)
 Push one byte to a slave and optionally read the response.

Variables

static unsigned char _ready = 0

Variable Documentation

◆ _ready

unsigned char _ready = 0
static

Definition at line 7 of file spi.c.

Referenced by spi_init(), and spi_ready().