Elisa3
spi.h File Reference
#include <stdio.h>
#include <avr/io.h>
#include <stdlib.h>
#include "variables.h"

Go to the source code of this file.

Functions

void initSPI ()
void SPI_ReadWrite_Block (uint8_t *data, uint8_t *buffer, uint8_t len)
void SPI_Write_Block (uint8_t *data, uint8_t len)
uint8_t SPI_Write_Byte (uint8_t data)
void closeSPI ()

Function Documentation

void closeSPI ( )
void initSPI ( )

Initialize the SPI port as a master. This function must be called once before using the SPI interface.

void SPI_ReadWrite_Block ( uint8_t *  data,
uint8_t *  buffer,
uint8_t  len 
)

Write a block of data to the slave, and read the data returned from the slave into a buffer. The data and buffer memory blocks must be the same length.

Parameters:
dataA pointer to the contiguous memory block to write to the slave.
bufferA pointer to the contiguous memory block to which the SPI data are to be written.
lenThe length of the memory blocks, in bytes.
void SPI_Write_Block ( uint8_t *  data,
uint8_t  len 
)

Write a block to the slave.

Parameters:
dataA pointer to the contiguous memory block to write to the slave.
lenThe length of the block to write, in bytes.
uint8_t SPI_Write_Byte ( uint8_t  data)

Write a byte to the slave, and get the return byte from the slave.

 All Files Functions Variables Defines