-
Notifications
You must be signed in to change notification settings - Fork 0
/
softspi.h
43 lines (31 loc) · 841 Bytes
/
softspi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* @file softspi.h
* @author Myth
* @version 0.2
* @date 2021.10.12
* @brief STM32 SoftSPI Library
*/
#ifndef __SOFTSPI_H
#define __SOFTSPI_H
#include "softspi_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;
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