MG32L003 Standard Peripherals Firmware Library

函数
SPI_Private_Functions
MG32L003_StdPeriph_Driver » SPI

## 函数
void | SPI_DeInit (SPI_TypeDef *SPIx)
| Deinitializes the SPIx peripheral registers to their default reset values. 更多...
void | SPI_Init (SPI_TypeDef *SPIx, SPI_InitTypeDef *SPI_InitStruct)
| Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct. 更多...
void | SPI_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState)
| Enables or disables the specified SPI peripheral. 更多...
void | SPI_NSSConfig (SPI_TypeDef *SPIx, FunctionalState NewState)
| Enables or disables the specified slave select line. 更多...
uint8_t | SPI_ReadData (SPI_TypeDef *SPIx)
| Read one data from DATA register. 更多...
void | SPI_WriteData (SPI_TypeDef *SPIx, uint8_t Data)
| Write one data to DATA register. 更多...
FlagStatus | SPI_GetFlagStatus (SPI_TypeDef *SPIx, uint8_t SPI_FLAG)
| Checks whether the specified SPIx flag is set or not. 更多...

## 详细描述

## 函数说明

## ◆ SPI_Cmd()

void SPI_Cmd | ( | SPI_TypeDef * | SPIx,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the specified SPI peripheral.

参数

  SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: SPI.
  NewState | new state of the SPIx peripheral. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ SPI_DeInit()

void SPI_DeInit | ( | SPI_TypeDef * | SPIx | ) |

Deinitializes the SPIx peripheral registers to their default reset values.

参数

  SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: SPI.

返回值

  None |

## ◆ SPI_GetFlagStatus()

FlagStatus SPI_GetFlagStatus | ( | SPI_TypeDef * | SPIx,
|  | uint8_t | SPI_FLAG
| ) |  |

Checks whether the specified SPIx flag is set or not.

参数

  SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: SPI.
  SPI_FLAG | specifies the SPI flag to check. This parameter can be one of the following values: SPI_FLAG_SPIF: End of transmission flag. SPI_FLAG_WCOL: Write conflict flag. SPI_FLAG_SSERR: Slave mode SSN error flag. SPI_FLAG_MDF: Host mode error flag.

返回值

  The | new state of SPI_FLAG (SET or RESET).

## ◆ SPI_Init()

void SPI_Init | ( | SPI_TypeDef * | SPIx,
|  | SPI_InitTypeDef * | SPI_InitStruct
| ) |  |

Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct.

参数

  SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: SPI.
  SPI_InitStruct | pointer to a SPI_InitTypeDef structure that contains the configuration information for the specified SPI peripheral.

返回值

  None |

## ◆ SPI_NSSConfig()

void SPI_NSSConfig | ( | SPI_TypeDef * | SPIx,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the specified slave select line.

参数

  SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: SPI.
  NewState | new state of the slave select line. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ SPI_ReadData()

uint8_t SPI_ReadData | ( | SPI_TypeDef * | SPIx | ) |

Read one data from DATA register.

参数

  SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: SPI.

返回值

  The | read data.

## ◆ SPI_WriteData()

void SPI_WriteData | ( | SPI_TypeDef * | SPIx,
|  | uint8_t | Data
| ) |  |

Write one data to DATA register.

参数

  SPIx | Pointer to selected SPI peripheral. This parameter can be one of the following values: SPI.
  Data | The data to write.

返回值

  None |