SoftSPI_HAL_Lib/softspi.h

44 lines
841 B
C
Raw Permalink Normal View History

2021-10-12 12:11:33 +08:00
/**
* @file softspi.h
* @author Myth
2021-10-12 18:07:30 +08:00
* @version 0.2
2021-10-12 12:11:33 +08:00
* @date 2021.10.12
* @brief STM32 SoftSPI Library
*/
#ifndef __SOFTSPI_H
#define __SOFTSPI_H
#include "softspi_conf.h"
/**
* @brief SoftSPI Structure definition
*/
2021-10-12 12:11:33 +08:00
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;
uint32_t Delay_Time;
2021-10-12 18:07:30 +08:00
} SoftSPI_TypeDef;
2021-10-12 12:11:33 +08:00
2021-10-12 18:07:30 +08:00
HAL_StatusTypeDef SoftSPI_Init(SoftSPI_TypeDef *SoftSPIx);
2021-10-12 12:11:33 +08:00
void SoftSPI_SetSS(SoftSPI_TypeDef *SoftSPIx);
void SoftSPI_ClrSS(SoftSPI_TypeDef *SoftSPIx);
2021-10-12 18:07:30 +08:00
uint8_t SoftSPI_WriteRead(SoftSPI_TypeDef *SoftSPIx, uint8_t byte);
2021-10-12 12:11:33 +08:00
2021-10-12 18:07:30 +08:00
void SoftSPI_WriteReadBuff(SoftSPI_TypeDef *SoftSPIx, uint8_t *pWrite, uint8_t *pRead, uint32_t len);
2021-10-12 12:11:33 +08:00
#endif