30 lines
869 B
C
30 lines
869 B
C
|
|
#ifndef _BSPSPI_H_
|
||
|
|
#define _BSPSPI_H_
|
||
|
|
|
||
|
|
#include <stdbool.h>
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
#define BSP_SPI0 0
|
||
|
|
#define BSP_SPI1 1
|
||
|
|
#define BSP_SPI2 2
|
||
|
|
#define BSP_SPI3 3
|
||
|
|
|
||
|
|
// SPI3配置
|
||
|
|
#define SPI3_SYS_PERIPH_GPIO SYSCTL_PERIPH_GPIOF
|
||
|
|
#define SPI3_GPIO_BASE GPIO_PORTF_BASE
|
||
|
|
#define SPI3_GPIO_CLK GPIO_PIN_3
|
||
|
|
#define SPI3_GPIO_FSS GPIO_PIN_2
|
||
|
|
#define SPI3_GPIO_RX GPIO_PIN_0
|
||
|
|
#define SPI3_GPIO_TX GPIO_PIN_1
|
||
|
|
#define SPI3_GPIO_CLK_CFG GPIO_PF3_SSI3CLK
|
||
|
|
#define SPI3_GPIO_FSS_CFG GPIO_PF2_SSI3FSS
|
||
|
|
#define SPI3_GPIO_RX_CFG GPIO_PF0_SSI3XDAT1
|
||
|
|
#define SPI3_GPIO_TX_CFG GPIO_PF1_SSI3XDAT0
|
||
|
|
|
||
|
|
int8_t Bsp_SpiInit(uint8_t spi_id);
|
||
|
|
uint8_t Bsp_RWByte(uint8_t spi_id, uint8_t txdata);
|
||
|
|
void Bsp_SpiSetSpeed(uint8_t spi_id, uint32_t ui32BitRate);
|
||
|
|
void Bsp_SpiCS(uint8_t spi_id, uint8_t value);
|
||
|
|
|
||
|
|
#endif
|