• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

spi.h

Go to the documentation of this file.
00001 /* General support for SPI devices, but using bit banging and
00002 using pin definitions rather than the built in spi functions in the microcontroller.
00003 
00004 No specific initialisation is needed except port directions.
00005 
00006 
00007 requires definitions of ATMEL ports:
00008 
00009         SPI_PORT                Port for the SPI signals eg PORTB
00010         SPI_DDR                 DDR for the SPI signals eg DDRB
00011         SPI_PIN                 Input Port for the SPI signals eg PINB
00012 
00013         SPI_SCK                 Clock from master to slave
00014         SPI_MOSI                Data from Master to slave
00015         SPI_MISO                Data from slave to master
00016 
00017 SPI mode 0 where data to slave is latched on leading edge of SCK, and data
00018 from slave to master is latched by master on fallling edge of SCK
00019 
00020 Uses delay functions which require definition of F_CPU in config.h
00021 
00022 */
00023 
00024 
00025 
00026 /* 17/2/2012  svn 507  */
00027 
00028 #ifndef SPI_H
00029 #define SPI_H
00030 
00031 
00032 #include <avr/io.h>
00033 #include <config.h>
00034 
00035 
00036 
00037 inline void spi_clock_up_down(void);
00038 
00039 
00040 
00047 uint8_t read_spi_byte(void);
00048 
00049 
00050 
00057 uint16_t read_spi_2byte(void);
00058 
00059 
00060 
00067 void write_spi_byte(uint8_t data);
00068 
00069 
00070 
00077 void write_spi_2byte(uint16_t data);
00078 
00079 
00080 #endif

Generated on Wed Aug 22 2012 11:44:35 by  doxygen 1.7.1