| BlueNRG-1 Peripherals drivers APIs

- Main Page
- Modules
- Classes
- Files

Functions
Public Functions
BLUENRG1 Peripheral Driver » SPI Peripheral

## Functions

void | SPI_DeInit (void)
| Deinitializes the SPI peripheral registers to their default reset values. More...
void | SPI_Init (SPI_InitType *SPI_InitStruct)
| Initializes the SPI peripheral according to the specified parameters in the SPI_InitStruct. More...
void | SPI_StructInit (SPI_InitType *SPI_InitStruct)
| Fills each SPI_InitStruct member with its default value. More...
void | SPI_Cmd (FunctionalState NewState)
| Enables or disables the SPI peripheral. More...
void | SPI_ITConfig (uint8_t SPI_IT, FunctionalState NewState)
| Enables or disables the specified SPI interrupts. More...
void | SPI_SlaveModeOutputCmd (FunctionalState NewState)
| Enables or disables the output if in slave mode. More...
void | SPI_SendData (uint32_t Data)
| Transmits a Data through the SPI peripheral. More...
uint32_t | SPI_ReceiveData (void)
| Returns the most recent received data by the SPI peripheral. More...
void | SPI_DataSizeConfig (uint16_t SPI_DataSize)
| Configures the data size for the selected SPI. More...
FlagStatus | SPI_GetFlagStatus (uint16_t SPI_FLAG)
| Checks whether the specified SPI flag is set or not. More...
ITStatus | SPI_GetITStatus (uint8_t SPI_IT)
| Checks whether the specified SPI interrupt has occurred or not. More...
void | SPI_ClearITPendingBit (uint8_t SPI_IT)
| Clears the SPI interrupt pending bits. More...
void | SPI_ClearRXFIFO (void)
| Clear all data present within the RX FIFO of the SPI peripherial. SPI peripherial clocks have to be enabled first before the use. More...
void | SPI_ClearTXFIFO (void)
| Clear all data present within the TX FIFO of the SPI peripherial. SPI peripherial clocks have to be enabled first before the use. More...
void | SPI_SetMasterCommunicationMode (uint32_t Mode)
| Set the SPI communication mode. More...
void | SPI_SetDummyCharacter (uint32_t NullCharacter)
| Set the dummy character used for the SPI master communication. More...
void | SPI_SetNumFramesToReceive (uint16_t Number)
| Set the number of frames to receive from slave. More...
void | SPI_SetNumFramesToTransmit (uint16_t Number)
| Set the number of frames to transmit to slave. More...
void | SPI_SlaveSwSelection (FunctionalState NewState)
| Master can select the slave by driving the CS pin by software. More...
void | SPI_EndianFormatReception (uint8_t Endian)
| Master can select the slave by driving the CS pin by software. More...
void | SPI_EndianFormatTransmission (uint8_t Endian)
| Master can select the slave by driving the CS pin by software. More...
void | SPI_DelayBetweenFrames (uint8_t Delay)
| Configure the delay between the frames. The MSPIWAIT value is used to insert a wait state between frames. The SSPFRM pulse duration is given by the equation: SSPCLKOUT x {MSPIWAIT - (SCR-1) / [2x(SCR+1)]}. When SCR=1, MSPIWAIT indicates the number of SSPCLKO cycle that the SSPFRM pulse duration should have between frames. More...
void | SPI_DelayDataInput (FunctionalState NewState)
| Master insert a delay of two clock cycle if enabled. More...
void | SPI_TxFifoInterruptLevelConfig (uint8_t SPI_TX_FIFO_LEV)
| Sets the SPI interrupt FIFO level. More...
void | SPI_RxFifoInterruptLevelConfig (uint8_t SPI_RX_FIFO_LEV)
| Sets the SPI interrupt FIFO level. More...
void | SPI_DMACmd (uint8_t SPI_DMAReq, FunctionalState NewState)
| Enables or disables the SPI DMA interface. More...

## Detailed Description

## Function Documentation

void SPI_ClearITPendingBit | ( | uint8_t | SPI_IT | ) |

Clears the SPI interrupt pending bits.

Parameters

  SPI_IT | specifies the SPI interrupt pending bit to clear. This parameter can be one of the following values:
  - SPI_IT_TX: Transmit FIFO half empty or less condition interrupt mask.
  - SPI_IT_RX: Receive FIFO half full or less condition interrupt mask.
  - SPI_IT_RT: Receive FIFO not empty and no read prior to timeout period interrupt mask.
  - SPI_IT_ROR: Receive FIFO written to while full condition interrupt mask.
  - SPI_IT_TUR: Transmit underrun interrupt mask.
  - SPI_IT_TE: Transmit FIFO empty interrupt mask.

Return values

  None |

Definition at line 386 of file BlueNRG1_spi.c.

void SPI_ClearRXFIFO | ( | void |  | ) |

Clear all data present within the RX FIFO of the SPI peripherial. SPI peripherial clocks have to be enabled first before the use.

Parameters

  None |

Return values

  None |

Definition at line 401 of file BlueNRG1_spi.c.

void SPI_ClearTXFIFO | ( | void |  | ) |

Clear all data present within the TX FIFO of the SPI peripherial. SPI peripherial clocks have to be enabled first before the use.

Parameters

  None |

Return values

  None |

Definition at line 415 of file BlueNRG1_spi.c.

void SPI_Cmd | ( | FunctionalState | NewState | ) |

Enables or disables the SPI peripheral.

Parameters

  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 206 of file BlueNRG1_spi.c.

void SPI_DataSizeConfig | ( | uint16_t | SPI_DataSize | ) |

Configures the data size for the selected SPI.

Parameters

  SPI_DataSize | specifies the SPI data size. This parameter can be one of the following values:
  - SPI_DataSize_32b: Set data frame format to 32bit ...
  - SPI_DataSize_5b: Set data frame format to 5bit
  - SPI_DataSize_4b: Set data frame format to 4bit

Return values

  None |

Definition at line 305 of file BlueNRG1_spi.c.

void SPI_DeInit | ( | void |  | ) |

Deinitializes the SPI peripheral registers to their default reset values.

Parameters

  None |

Return values

  None |

Definition at line 132 of file BlueNRG1_spi.c.

void SPI_DelayBetweenFrames | ( | uint8_t | Delay | ) |

Configure the delay between the frames. The MSPIWAIT value is used to insert a wait state between frames. The SSPFRM pulse duration is given by the equation: SSPCLKOUT x {MSPIWAIT - (SCR-1) / [2x(SCR+1)]}. When SCR=1, MSPIWAIT indicates the number of SSPCLKO cycle that the SSPFRM pulse duration should have between frames.

Parameters

  Delay | this value must be less than or equal to 15. 0 means no delay (default).

Return values

  None |

Definition at line 544 of file BlueNRG1_spi.c.

void SPI_DelayDataInput | ( | FunctionalState | NewState | ) |

Master insert a delay of two clock cycle if enabled.

Parameters

  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 559 of file BlueNRG1_spi.c.

void SPI_DMACmd | ( | uint8_t | SPI_DMAReq,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the SPI DMA interface.

Parameters

  SPI_DMAReq | specifies the DMA request. This parameter can be any combination of the following values:
  - SPI_DMAReq_Tx: SPI DMA transmit request
  - SPI_DMAReq_Rx: SPI DMA receive request.
  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 620 of file BlueNRG1_spi.c.

void SPI_EndianFormatReception | ( | uint8_t | Endian | ) |

Master can select the slave by driving the CS pin by software.

Parameters

  Endian | the endian format Endian Format Definition

Return values

  None |

Definition at line 511 of file BlueNRG1_spi.c.

void SPI_EndianFormatTransmission | ( | uint8_t | Endian | ) |

Master can select the slave by driving the CS pin by software.

Parameters

  Endian | the endian format Endian Format Definition

Return values

  None |

Definition at line 524 of file BlueNRG1_spi.c.

FlagStatus SPI_GetFlagStatus | ( | uint16_t | SPI_FLAG | ) |

Checks whether the specified SPI flag is set or not.

Parameters

  SPI_FLAG | specifies the SPI flag to check. This parameter can be any combination of the following values:
  - SPI_IT_TX: Transmit FIFO half empty or less condition interrupt mask.
  - SPI_IT_RX: Receive FIFO half full or less condition interrupt mask.
  - SPI_IT_RT: Receive FIFO not empty and no read prior to timeout period interrupt mask.
  - SPI_IT_ROR: Receive FIFO written to while full condition interrupt mask.
  - SPI_IT_TUR: Transmit underrun interrupt mask.
  - SPI_IT_TE: Transmit FIFO empty interrupt mask.

Return values

  FlagStatus | functional state FlagStatus This parameter can be: SET or RESET.

Definition at line 327 of file BlueNRG1_spi.c.

ITStatus SPI_GetITStatus | ( | uint8_t | SPI_IT | ) |

Checks whether the specified SPI interrupt has occurred or not.

Parameters

  SPI_IT | specifies the SPI interrupt source to check. This parameter can be one of the following values:
  - SPI_IT_TX: Transmit FIFO half empty or less condition interrupt mask.
  - SPI_IT_RX: Receive FIFO half full or less condition interrupt mask.
  - SPI_IT_RT: Receive FIFO not empty and no read prior to timeout period interrupt mask.
  - SPI_IT_ROR: Receive FIFO written to while full condition interrupt mask.
  - SPI_IT_TUR: Transmit underrun interrupt mask.
  - SPI_IT_TE: Transmit FIFO empty interrupt mask.

Return values

  ITStatus | functional state ITStatus This parameter can be: SET or RESET.

Definition at line 357 of file BlueNRG1_spi.c.

void SPI_Init | ( | SPI_InitType * | SPI_InitStruct | ) |

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

Parameters

  SPI_InitStruct | pointer to a SPI_InitType structure that contains the configuration information for the specified SPI peripheral.

Return values

  None |

Definition at line 152 of file BlueNRG1_spi.c.

void SPI_ITConfig | ( | uint8_t | SPI_IT,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the specified SPI interrupts.

Parameters

  SPI_IT | specifies the SPI interrupt source to be enabled or disabled. This parameter can be any combination of the following values:
  - SPI_IT_TX: Transmit FIFO half empty or less condition interrupt mask.
  - SPI_IT_RX: Receive FIFO half full or less condition interrupt mask.
  - SPI_IT_RT: Receive FIFO not empty and no read prior to timeout period interrupt mask.
  - SPI_IT_ROR: Receive FIFO written to while full condition interrupt mask.
  - SPI_IT_TUR: Transmit underrun interrupt mask.
  - SPI_IT_TE: Transmit FIFO empty interrupt mask.
  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 235 of file BlueNRG1_spi.c.

uint32_t SPI_ReceiveData | ( | void |  | ) |

Returns the most recent received data by the SPI peripheral.

Parameters

  None |

Return values

  The | value of the received data.

Definition at line 289 of file BlueNRG1_spi.c.

void SPI_RxFifoInterruptLevelConfig | ( | uint8_t | SPI_RX_FIFO_LEV | ) |

Sets the SPI interrupt FIFO level.

Parameters

  SPI_RX_FIFO_LEV | specifies the receive interrupt FIFO level. This parameter can be one of the following values:
  - FIFO_RX_LEV_1: interrupt when RX FIFO contains 1 element or more
  - FIFO_RX_LEV_4: interrupt when RX FIFO contains 4 elements or more
  - FIFO_RX_LEV_8: interrupt when RX FIFO contains 8 elements or more

Return values

  None |

Definition at line 602 of file BlueNRG1_spi.c.

void SPI_SendData | ( | uint32_t | Data | ) |

Transmits a Data through the SPI peripheral.

Parameters

  Data | Data to be transmitted.

Return values

  None |

Definition at line 278 of file BlueNRG1_spi.c.

void SPI_SetDummyCharacter | ( | uint32_t | NullCharacter | ) |

Set the dummy character used for the SPI master communication.

Parameters

  NullCharacter | Dummy character to be used.

Return values

  None |

Definition at line 456 of file BlueNRG1_spi.c.

void SPI_SetMasterCommunicationMode | ( | uint32_t | Mode | ) |

Set the SPI communication mode.

Parameters

  Mode | specifies the SPI communication mode. This parameter can be one of the following values:
  - SPI_FULL_DUPLEX_MODE: SPI full duplex communication mode.
  - SPI_TRANSMIT_MODE: SPI transmit communication mode.
  - SPI_RECEIVE_MODE: SPI receive communication mode.
  - SPI_COMBINED_MODE: SPI combined communication mode.

Return values

  None |

Definition at line 442 of file BlueNRG1_spi.c.

void SPI_SetNumFramesToReceive | ( | uint16_t | Number | ) |

Set the number of frames to receive from slave.

Parameters

  Number | Number of frames to receive.

Return values

  None |

Definition at line 467 of file BlueNRG1_spi.c.

void SPI_SetNumFramesToTransmit | ( | uint16_t | Number | ) |

Set the number of frames to transmit to slave.

Parameters

  Number | Number of frames to transmit.

Return values

  None |

Definition at line 478 of file BlueNRG1_spi.c.

void SPI_SlaveModeOutputCmd | ( | FunctionalState | NewState | ) |

Enables or disables the output if in slave mode.

Parameters

  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 258 of file BlueNRG1_spi.c.

void SPI_SlaveSwSelection | ( | FunctionalState | NewState | ) |

Master can select the slave by driving the CS pin by software.

Parameters

  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 491 of file BlueNRG1_spi.c.

void SPI_StructInit | ( | SPI_InitType * | SPI_InitStruct | ) |

Fills each SPI_InitStruct member with its default value.

Parameters

  SPI_InitStruct | pointer to a SPI_InitType structure which will be initialized.

Return values

  None |

Definition at line 182 of file BlueNRG1_spi.c.

void SPI_TxFifoInterruptLevelConfig | ( | uint8_t | SPI_TX_FIFO_LEV | ) |

Sets the SPI interrupt FIFO level.

Parameters

  SPI_TX_FIFO_LEV | specifies the transmit interrupt FIFO level. This parameter can be one of the following values:
  - FIFO_TX_LEV_1: interrupt when TX FIFO contains 1 element or more
  - FIFO_TX_LEV_4: interrupt when TX FIFO contains 4 elements or more
  - FIFO_TX_LEV_8: interrupt when TX FIFO contains 8 elements or more

Return values

  None |

Definition at line 584 of file BlueNRG1_spi.c.