Elisa3
|
00001 /* 00002 * spi.h 00003 * 00004 * Created on: 24-Jan-2009 00005 * Author: Neil MacMillan 00006 * 00007 * Macros and prototypes for using the AT90 as an SPI master. 00008 * 00009 * References: 00010 * Engelke, Stefan. AVR-Lib/SPI. http://www.tinkerer.eu/AVRLib/SPI 00011 * Tanner, Justin. LED Wheel: Code. http://webhome.csc.uvic.ca/~mcheng/samples/led_wheel/wheel_demo.zip 00012 * Atmel. AT90USB1287 Hardware Manual. http://www.atmel.com/dyn/resources/prod_documents/doc7593.pdf 00013 * 00014 * All the hard work for this was done by [Engelke]. 00015 */ 00016 00017 #ifndef SPI_H_ 00018 #define SPI_H_ 00019 00020 #include <stdio.h> 00021 #include <avr/io.h> 00022 #include <stdlib.h> 00023 00024 #include "variables.h" 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00034 void initSPI(); 00035 00043 void SPI_ReadWrite_Block (uint8_t * data, uint8_t * buffer, uint8_t len); 00044 00050 void SPI_Write_Block (uint8_t * data, uint8_t len); 00051 00055 uint8_t SPI_Write_Byte (uint8_t data); 00056 00057 void closeSPI(); 00058 00059 #ifdef __cplusplus 00060 } // extern "C" 00061 #endif 00062 00063 #endif /* SPI_H_ */