SPI master implementation

SPI master implementation for AVR. More...

Files

file  spi.h

Functions

uint8_t spi_init ()
uint8_t spi_set_maxspeed ()
uint8_t spi_read_byte ()
uint8_t spi_write_byte (int8_t byte)

Detailed Description

SPI master implementation for AVR.

 #include <spi.h> 

SPI master implementation. Some functions for easy use of spi functionality of AVR.

Author:
Dennis Dingeldein http://www.dingeldein-online.de

Licence

This code can be used according to GNU General Public License.

Author:
Dennis Dingeldein

Function Documentation

uint8_t spi_init (  ) 

Init spi communication registers. Speed is set up initially to f_OSC/64.

Returns:
0 on success.

Definition at line 20 of file spi.c.

Referenced by main(), and sd_init().

uint8_t spi_read_byte (  ) 

Reads a byte from spi. Before the byte is read in, a dummy byte (0xff) is written to spi to create clock cycles to be used (for syncronizing) by slave.

Returns:
the byte read.

Definition at line 69 of file spi.c.

Referenced by sd_get_info(), sd_init(), sd_read(), sd_read_interval(), sd_send_command_r1(), sd_send_command_r2(), and sd_write().

uint8_t spi_set_maxspeed (  ) 

Set spi transfer speed to maximum for this chip.

Returns:
0 on success.

Definition at line 53 of file spi.c.

Referenced by sd_init().

uint8_t spi_write_byte ( int8_t  byte  ) 

Write a byte to spi.

Parameters:
[in] byte the byte to write to spi
Returns:
byte written on success.

Definition at line 88 of file spi.c.

Referenced by _vs1011_init(), play_song(), sd_send_command_r1(), sd_send_command_r2(), sd_write(), vs1011_dim_volume(), vs1011_sw_reset(), vs1011_test_sine_on_off(), vs1011_test_vol(), and vs1011_test_vol_rw().


Generated on Wed Sep 17 19:31:52 2008 for mptry by  doxygen 1.5.5