⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spiapi.h

📁 CANopenNode source code with tutorials - free CANopen stack
💻 H
字号:
/****************************************************************************
* (C) 1999-2005 by BECK IPC GmbH
*
*  BECK IPC GmbH
*  Germany
*
*  http://www.beck-ipc.com
*
* ---------------------------------------------------------------------------
* Module         : SPIAPI.H
* Function       : prototypes, constants for SPI API functions
* ---------------------------------------------------------------------------

$Header: /cvsrepo/CANopenNode/_src/CANopen/BECK_SC1x+SJA1000/Clib/SPIAPI.H,v 1.1 2006/03/08 11:29:44 jani Exp $

*****************************************************************************/

#ifndef SPIAPI_H
#define SPIAPI_H

/***************************************************************************/
// Prototyps
/***************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif

void          _cdecl spi_init             (unsigned mode, char clock, char dataIn, char dataOut);
void          _cdecl spi_write            (const void far *bufferPtr, unsigned short nbytes);
void          _cdecl spi_read             (void far *bufferPtr, unsigned short nbytes);
void          _cdecl spi_read_write       (void far *rbufferPtr, const void far *wbufferPtr, unsigned short nbytes);

void          _cdecl spi_init_hw          (unsigned mode, unsigned div);
unsigned int  _cdecl spi_write_hw         (const void far *bufferPtr, unsigned short nbytes);
unsigned int  _cdecl spi_read_hw          (void far *bufferPtr, unsigned short nbytes);
unsigned int  _cdecl spi_read_write_hw    (void far *rbufferPtr, const void far *wbufferPtr, unsigned short nbytes);

void          _cdecl spi_slave_write      (unsigned char data);
unsigned char _cdecl spi_slave_read       (void);
unsigned char _cdecl spi_slave_read_write (unsigned char data);
unsigned int  _cdecl spi_waiton_sem       (void);
unsigned int  _cdecl spi_release_sem      (void);

#define SPI_MODE0          0x0000
#define SPI_MODE1          0x0001
#define SPI_MODE2          0x0002
#define SPI_MODE3          0x0003
#define SPI_OPEN_DRAIN     0x0004
#define SPI_AUTODRIVE      0x0008
#define SPI_INVERT_CS      0x0010
#define SPI_SHIFT1         0x0020
#define SPI_SHIFT2         0x0040
#define SPI_SHIFT3         0x0060
#define SPI_SHIFT4         0x0080
#define SPI_SHIFT5         0x00A0
#define SPI_SHIFT6         0x00C0
#define SPI_SHIFT7         0x00E0
#define SPI_SHIFT8         0x0000
#define SPI_ALTERNATE_IO   0x0100

#ifdef __cplusplus
}
#endif

#endif  // SPIAPI_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -