You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 line
540B

  1. #ifndef _SPI_H
  2. #define _SPI_H
  3. #include "stm32f10x.h"
  4. //-----------------------------------------------------------------
  5. // SPI PORT define
  6. typedef enum SPI_TYPE{SPI_PORT1,SPI_PORT2}SPIType; // SPI_PORT1---->SPI1; SPI_PORT2---->SPI2
  7. //---------------------------------------------------------------
  8. void SPI1_Init(void); //SPI1初始化
  9. void SPI2_Init(void); //SPI2初始化
  10. u8 SPI_ReadWriteByte(SPIType spiNum,u8 dat); //SPI2读写一个字节
  11. void SPI_SetSpeed(SPIType spiNum,u8 SPI_BaudRatePrescaler);//设置SPI2的速度
  12. #endif