Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# spi.h

Go to the documentation of this file.

    00001 /*! \file spi.h \brief SPI interface driver. */
    00002 //*****************************************************************************
    00003 //
    00004 // File Name    : 'spi.h'
    00005 // Title        : SPI interface driver
    00006 // Author       : Pascal Stang - Copyright (C) 2000-2002
    00007 // Created      : 11/22/2000
    00008 // Revised      : 06/06/2002
    00009 // Version      : 0.6
    00010 // Target MCU   : Atmel AVR series
    00011 // Editor Tabs  : 4
    00012 //
    00013 // NOTE: This code is currently below version 1.0, and therefore is considered
    00014 // to be lacking in some functionality or documentation, or may not be fully
    00015 // tested.  Nonetheless, you can expect most functions to work.
    00016 //
    00017 /// \ingroup driver_avr
    00018 /// \defgroup spi SPI (Serial Peripheral Interface) Function Library (spi.c)
    00019 /// \code #include "spi.h" \endcode
    00020 /// \par Overview
    00021 ///     Provides basic byte and word transmitting and receiving via the AVR
    00022 /// SPI interface.  Due to the nature of SPI, every SPI communication operation
    00023 /// is both a transmit and simultaneous receive.
    00024 ///
    00025 /// \note Currently, only MASTER mode is supported.
    00026 //
    00027 // This code is distributed under the GNU Public License
    00028 //      which can be found at http://www.gnu.org/licenses/gpl.txt
    00029 //
    00030 //*****************************************************************************
    00031
    00032 #ifndef SPI_H
    00033 #define SPI_H
    00034
    00035 #include "global.h"
    00036
    00037 // function prototypes
    00038
    00039 // SPI interface initializer
    00040 void spiInit(void);
    00041
    00042 // spiSendByte(u08 data) waits until the SPI interface is ready
    00043 // and then sends a single byte over the SPI port.  This command
    00044 // does not receive anything.
    00045 void spiSendByte(u08 data);
    00046
    00047 // spiTransferByte(u08 data) waits until the SPI interface is ready
    00048 // and then sends a single byte over the SPI port.  The function also
    00049 // returns the byte that was received during transmission.
    00050 u08 spiTransferByte(u08 data);
    00051
    00052 // spiTransferWord(u08 data) works just like spiTransferByte but
    00053 // operates on a whole word (16-bits of data).
    00054 u16 spiTransferWord(u16 data);
    00055
    00056 #endif