spi.h

来自「采用mega16设计的avr单片机编程工具」· C头文件 代码 · 共 30 行

H
30
字号
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file	spi.h
/// @author	Simon Qian(webmaster@SimonQian.com)
/// @date	Last Update on 2008-04-07
/// @brief	headerfile for spi.c
/// @par	license
/// 		AVRminiProg is distributed under the terms and conditions of GPLv2, see License.txt
////////////////////////////////////////////////////////////////////////////////////////////////////

// Only Support Master Mode

#define SPI_DATA_LEN			8
#define SPI_MSB					(1 << (SPI_DATA_LEN - 1))

void SPI_Init(void);


#define SPI_Disable()			SPCR = 0
#define SPI_IsReady()			(SPSR & (1 << SPIF))
#define SPI_SetData(d)			SPDR = d
#define SPI_GetData()			SPDR
#define SPI_WaitReady()			while (!SPI_IsReady())

uint8 SPI_RW_Emu(uint8 data);
uint8 SPI_RW_HW(uint8 data);
void SPI_SetClk(uint8 ps);
uint8 SPI_RW(uint8 data);

extern uint8 SPI_Emu;

⌨️ 快捷键说明

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