Project 3  Seven-Segment Display
Neff Site
Macros | Functions
spi.h File Reference

Header file for the SPI interface. More...

#include <avr/io.h>

Go to the source code of this file.

Macros

#define SPI_PORT   PORTF
 
#define SPI_MODULE   SPIF
 
#define SPI_SS_bp   PIN4_bp
 
#define SPI_MOSI_bp   PIN5_bp
 
#define SPI_MISO_bp   PIN6_bp
 
#define SPI_SCK_bp   PIN7_bp
 
#define SPI_SS_bm   PIN4_bm
 
#define SPI_MOSI_bm   PIN5_bm
 
#define SPI_MISO_bm   PIN6_bm
 
#define SPI_SCK_bm   PIN7_bm
 
#define SPI_CLOCK_SPEED_gc   SPI_PRESCALER_DIV4_gc
 

Functions

void spi_init (void)
 Initialize interface. More...
 
void spi_select_slave (void)
 Activate the slave. More...
 
void spi_deselect_slave (void)
 Dectivate the slave. More...
 
uint8_t spi_transfer (uint8_t byte)
 Transfer one data byte. More...
 

Detailed Description

Header file for the SPI interface.

This library provides high level access to the Serial Peripheral Interface bus interface.

Author
Wolfgang Neff
Version
1.0
Date
2016-05-14
History
Created: 2016-05-14

Macro Definition Documentation

◆ SPI_CLOCK_SPEED_gc

#define SPI_CLOCK_SPEED_gc   SPI_PRESCALER_DIV4_gc

◆ SPI_MISO_bm

#define SPI_MISO_bm   PIN6_bm

◆ SPI_MISO_bp

#define SPI_MISO_bp   PIN6_bp

◆ SPI_MODULE

#define SPI_MODULE   SPIF

◆ SPI_MOSI_bm

#define SPI_MOSI_bm   PIN5_bm

◆ SPI_MOSI_bp

#define SPI_MOSI_bp   PIN5_bp

◆ SPI_PORT

#define SPI_PORT   PORTF

◆ SPI_SCK_bm

#define SPI_SCK_bm   PIN7_bm

◆ SPI_SCK_bp

#define SPI_SCK_bp   PIN7_bp

◆ SPI_SS_bm

#define SPI_SS_bm   PIN4_bm

◆ SPI_SS_bp

#define SPI_SS_bp   PIN4_bp

Function Documentation

◆ spi_deselect_slave()

void spi_deselect_slave ( void  )

Dectivate the slave.

Drives the chip select line high in order to deactivate the slave.

◆ spi_init()

void spi_init ( void  )

Initialize interface.

Setup the interface pins and initialize the spi controller.

◆ spi_select_slave()

void spi_select_slave ( void  )

Activate the slave.

Drops the chip select line in order to activate the slave.

◆ spi_transfer()

uint8_t spi_transfer ( uint8_t  byte)

Transfer one data byte.

Transmits one data byte to the slave and receives one from the slave.

Parameters
byteThe data byte sent to the slave.
Returns
The data byte received from the slave.
Contact