SPI (Serial Peripheral Interface)

AVR_Toolbox.gif
Visit us at: http://www.smileymicros.com

This code was designed to allow the user to create multiple SPI links using either bit-banged software or regular AVR hardware SPI.

The user first selects a SPI number from a list that can be expanded as needed: define SPI0 define SPI1 define SPIx // place holder

After selecting and SPI number, then the user selects either software or hardware for that number: define SPI0_SOFT define SPI0_HARD

The user accesses the following functions:
void spi0_init_master(void);
uint8_t spi0_master_rw8(uint8_t to_slave);
uint16_t spi0_master_rw16(uint16_t to_slave);

Which are alia's for the software or hardware version.

This code was tested for SPI0 in both software and hardware modes on the ATmega169, ATmega328, and ATmega644 (TODO)

Todo:

1. Test it for the ATmega644.

2. Retest with the Arduino board.

3. Improve the comments before letting this puppy loose!

Author:
Joe Pardue
Date:
October 29, 2010