/***************************************************************************** * Copyright (C) 2008 * ProbeStar Telematics, LLC * All Rights Reserved. Proprietary and Confidential. *============================================================================ * PIC SPI Interface *---------------------------------------------------------------------------- *****************************************************************************/ /* prevent multiple inclusions */ #ifndef _SPI_H_ #define _SPI_H_ /***************************************************************************** * includes *****************************************************************************/ #include "system.h" #include "queue.h" #include "types.h" /***************************************************************************** * defines *****************************************************************************/ #ifdef _PIC18 #define SSPCON SSPCON1 #define STAT_RW RW #define STAT_DA DA #endif /***************************************************************************** * macros *****************************************************************************/ #define SpiReadByte() SpiXferByte(0) #define SpiWriteByte(B) SpiXferByte(B) /***************************************************************************** * structs & typedefs *****************************************************************************/ /***************************************************************************** * global constants *****************************************************************************/ /***************************************************************************** * global variables *****************************************************************************/ /***************************************************************************** * C function prototypes *****************************************************************************/ /* export C functions to C++ */ #ifdef __cplusplus extern "C" { #endif extern void SpiInit( void ); extern void SpiWaitTime( BYTE byUsec ); extern BYTE SpiXferByte( BYTE byOut ); extern void SpiReadData( BYTE *pbyData, BYTE nBytes ); extern void SpiWriteData( const BYTE *pbyData, BYTE nBytes ); #ifdef __cpluscplus } #endif #endif