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

# spi.h

    00001 /*! \file spi.h \brief SPI Interface Driver for LPC2100. */
    00002 //*****************************************************************************
    00003 //
    00004 // File Name    : 'spi.h'
    00005 // Title        : SPI Interface Driver for LPC2100
    00006 // Author       : Pascal Stang - Copyright (C) 2004
    00007 // Created      : 2004.05.05
    00008 // Revised      : 2004.07.12
    00009 // Version      : 0.1
    00010 // Target MCU   : ARM processors
    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 // This code is distributed under the GNU Public License
    00018 //      which can be found at http://www.gnu.org/licenses/gpl.txt
    00019 //
    00020 //*****************************************************************************
    00021
    00022 #ifndef SPI_H
    00023 #define SPI_H
    00024
    00025 // bit defines
    00026 #define SPCR_CPHA           3
    00027 #define SPCR_CPOL           4
    00028 #define SPCR_MSTR           5
    00029 #define SPCR_LSBF           6
    00030 #define SPCR_SPIE           7
    00031
    00032 #define SPSR_ABRT           3
    00033 #define SPSR_MODF           4
    00034 #define SPSR_ROVR           5
    00035 #define SPSR_WCOL           6
    00036 #define SPSR_SPIF           7
    00037
    00038 // functions
    00039
    00040 // SPI interface initializer
    00041 void spiInit(void);
    00042
    00043 void spiSetClockDiv(u08 clockdiv);
    00044
    00045 // spiSendByte(u08 data) waits until the SPI interface is ready
    00046 // and then sends a single byte over the SPI port.  This command
    00047 // does not receive anything.
    00048 void spiSendByte(u08 data);
    00049
    00050 // spiTransferByte(u08 data) waits until the SPI interface is ready
    00051 // and then sends a single byte over the SPI port.  The function also
    00052 // returns the byte that was received during transmission.
    00053 u08 spiTransferByte(u08 data);
    00054
    00055 #endif