spi.h

来自「ST7032i驱动应用实例(I2C接口)」· C头文件 代码 · 共 29 行

H
29
字号
// -------------------------- Header file for spi.c ----------------------------
#ifndef __SPI_BUS__
#define __SPI_BUS__

//#define HW_SPI	// HW/SW SPI select(Define it if use hardware SPI)

// --------------------------- Pins Definition ---------------------------------
#ifndef SPI_CLK
	#define SPI_CLK 	7	// (PB7)CLOCK OUPUT
	#define SPI_MISO 	6	// (PB6)Master Input and Slave Output(LCD_SDOUT)
	#define SPI_MOSI 	5	// (PB5)Master Output and Slave Input(LCD_SDIN)
#endif
// -----------------------------------------------------------------------------

// --------------------------- Function Prototypes -----------------------------
// Initialize the SPI as a master
void spi_init(void);
// Send a bit to the SPI device
void spi_sendbit(uint8 bitx);
// Send a byte to the SPI device
void spi_sendbyte(uint8 dByte);
// Read a byte from the SPI device
uint8 spi_readbyte(void);
// -----------------------------------------------------------------------------

#include "spi.c"
#endif
// -----------------------------------------------------------------------------

⌨️ 快捷键说明

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