1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- /**
- * @file softspi.h
- * @author Myth
- * @version 0.2
- * @date 2021.10.12
- * @brief STM32 SoftSPI Library
- */
- #ifndef DEV_SOFT_SPI_H
- #define DEV_SOFT_SPI_H
- #include "dev_spi_conf.h"
- /**
- * @brief SoftSPI Structure definition
- */
- typedef struct
- {
- GPIO_TypeDef *SCLK_GPIO;
- uint32_t SCLK_Pin;
- GPIO_TypeDef *MOSI_GPIO;
- uint32_t MOSI_Pin;
- GPIO_TypeDef *MISO_GPIO;
- uint32_t MISO_Pin;
- GPIO_TypeDef *SS_GPIO;
- uint32_t SS_Pin;
-
- GPIO_TypeDef *WP_GPIO;
- uint32_t WP_Pin;
- uint32_t Delay_Time;
- } SoftSPI_TypeDef;
- HAL_StatusTypeDef SoftSPI_Init(SoftSPI_TypeDef *SoftSPIx);
- void SoftSPI_SetSS(SoftSPI_TypeDef *SoftSPIx);
- void SoftSPI_ClrSS(SoftSPI_TypeDef *SoftSPIx);
- uint8_t SoftSPI_WriteRead(SoftSPI_TypeDef *SoftSPIx, uint8_t byte);
- void SoftSPI_WriteReadBuff(SoftSPI_TypeDef *SoftSPIx, uint8_t *pWrite, uint8_t *pRead, uint32_t len);
- #endif
|