| BlueNRG-1 Peripherals drivers APIs

- Main Page
- Modules
- Classes
- Files

Functions
Public Functions
BLUENRG1 Peripheral Driver » I2C Peripheral

## Functions

void | I2C_DeInit (I2C_Type *I2Cx)
| Deinitializes the I2C peripheral registers to their default reset values. More...
void | I2C_Init (I2C_Type *I2Cx, I2C_InitType *I2C_InitStruct)
| Initializes the I2Cx peripheral according to the specified parameters in the I2C_InitStruct. More...
void | I2C_StructInit (I2C_InitType *I2C_InitStruct)
| Fills the I2C_InitStruct with default values. More...
void | I2C_Cmd (I2C_Type *I2Cx, FunctionalState NewState)
| Enables or disables the specified I2C peripheral. More...
void | I2C_BeginTransaction (I2C_Type *I2Cx, I2C_TransactionType *tr)
| Start an I2C transaction sending the frame specified. More...
void | I2C_GeneralCallCmd (I2C_Type *I2Cx, FunctionalState NewState)
| Enables or disables the general call feature. More...
void | I2C_ITConfig (I2C_Type *I2Cx, uint32_t I2C_IT, FunctionalState NewState)
| Enables or disables the specified I2C interrupts. More...
void | I2C_FillTxFIFO (I2C_Type *I2Cx, uint8_t Data)
| Fills the Tx FIFO with the specified data byte. More...
uint8_t | I2C_ReceiveData (I2C_Type *I2Cx)
| Returns the most recent received data by the I2Cx peripheral. More...
void | I2C_FlushTx (I2C_Type *I2Cx)
| Returns the most recent received data by the I2Cx peripheral. More...
I2C_OpStatus | I2C_WaitFlushTx (I2C_Type *I2Cx)
| Return the status of the TX FIFO flush operation. More...
void | I2C_FlushRx (I2C_Type *I2Cx)
| Returns the most recent received data by the I2Cx peripheral. More...
I2C_OpStatus | I2C_WaitFlushRx (I2C_Type *I2Cx)
| Return the status of the RX FIFO flush operation. More...
void | I2C_SetTxThreshold (I2C_Type *I2Cx, uint16_t TxThres)
| Sets the transmit FIFO threshold by the I2Cx peripheral. More...
void | I2C_SetRxThreshold (I2C_Type *I2Cx, uint16_t RxThres)
| Sets the receive FIFO threshold by the I2Cx peripheral. More...
void | I2C_GenerateStopCondition (I2C_Type *I2Cx)
| Generate a stop condition. More...
void | I2C_SetHoldTime (I2C_Type *I2Cx, uint16_t I2C_HoldTime)
| Set the hold time value for data transfer. More...
void | I2C_SetHoldTimeStartCondition (I2C_Type *I2Cx, uint16_t I2C_HoldTime)
| Set the hold time value for start condition. More...
ITStatus | I2C_GetITStatus (I2C_Type *I2Cx, uint32_t I2C_IT)
| Checks whether the specified I2C interrupt has occurred or not. More...
ITStatus | I2C_GetITPendingBit (I2C_Type *I2Cx, uint32_t I2C_IT)
| Checks whether the specified I2C interrupt has occurred or not. More...
void | I2C_ClearITPendingBit (I2C_Type *I2Cx, uint32_t I2C_IT)
| Clears the I2Cx interrupt pending bits. More...
I2C_OpStatus | I2C_GetStatus (I2C_Type *I2Cx)
| Get the present state of the operation executed by I2C block. More...
void | I2C_DMACmd (I2C_Type *I2Cx, uint16_t I2C_DMAReq, FunctionalState NewState)
| Enables or disables the I2C DMA interface. More...
void | I2C_DMATxBurstMode (I2C_Type *I2Cx, FunctionalState NewState)
| Enables or disables the I2C TX DMA burst mode. More...
void | I2C_DMATxBurstSize (I2C_Type *I2Cx, uint8_t I2C_BurstSize)
| Set the number of burst of data. If this number is smaller than the transaction length, only one single request are generated. More...

## Detailed Description

## Function Documentation

void I2C_BeginTransaction | ( | I2C_Type * | I2Cx,
|  | I2C_TransactionType * | tr
| ) |  |

Start an I2C transaction sending the frame specified.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  tr | pointer to an I2C_TransactionType structure used for this transaction.

Return values

  None. |

Definition at line 237 of file BlueNRG1_i2c.c.

void I2C_ClearITPendingBit | ( | I2C_Type * | I2Cx,
|  | uint32_t | I2C_IT
| ) |  |

Clears the I2Cx interrupt pending bits.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  I2C_IT | specifies the interrupt pending bit to clear. This parameter can be any combination of the following values:
  - I2C_IT_TXFE: Tx FIFO empty
  - I2C_IT_TXFNE: TX FIFO nearly empty
  - I2C_IT_TXFF: Tx FIFO full
  - I2C_IT_TXFOVR: Tx FIFO overflow
  - I2C_IT_RXFE: Rx FIFO empty
  - I2C_IT_RXFNF: Rx FIFO nearly full
  - I2C_IT_RXFF: Rx FIFO full
  - I2C_IT_LBR: Length number of bytes received
  - I2C_IT_RFSR: Read from slave request
  - I2C_IT_RFSE: Read from slave empty
  - I2C_IT_WTSR: Write to slave request
  - I2C_IT_MTD: Master transaction done
  - I2C_IT_STD: Slave transaction done
  - I2C_IT_SAL: Slave arbitration lost
  - I2C_IT_MAL: Master arbitration lost
  - I2C_IT_BERR: Bus error
  - I2C_IT_MTDWS: Master transaction done without stop
  - I2C_IT_TIMEOUT: Timeout or Tlow error

Return values

  None |

Definition at line 611 of file BlueNRG1_i2c.c.

void I2C_Cmd | ( | I2C_Type * | I2Cx,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the specified I2C peripheral.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 213 of file BlueNRG1_i2c.c.

void I2C_DeInit | ( | I2C_Type * | I2Cx | ) |

Deinitializes the I2C peripheral registers to their default reset values.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type

Return values

  None |

Definition at line 96 of file BlueNRG1_i2c.c.

void I2C_DMACmd | ( | I2C_Type * | I2Cx,
|  | uint16_t | I2C_DMAReq,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the I2C DMA interface.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  I2C_DMAReq | specifies the DMA request. This parameter can be any combination of the following values:
  - I2C_DMAReq_Tx: I2C DMA transmit request
  - I2C_DMAReq_Rx: I2C DMA receive request.
  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 648 of file BlueNRG1_i2c.c.

void I2C_DMATxBurstMode | ( | I2C_Type * | I2Cx,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the I2C TX DMA burst mode.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 674 of file BlueNRG1_i2c.c.

void I2C_DMATxBurstSize | ( | I2C_Type * | I2Cx,
|  | uint8_t | I2C_BurstSize
| ) |  |

Set the number of burst of data. If this number is smaller than the transaction length, only one single request are generated.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  I2C_BurstSize | specifies the number of burst request.

Return values

  None |

Definition at line 699 of file BlueNRG1_i2c.c.

void I2C_FillTxFIFO | ( | I2C_Type * | I2Cx,
|  | uint8_t | Data
| ) |  |

Fills the Tx FIFO with the specified data byte.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  Data | Byte to be transmitted.

Return values

  None |

Definition at line 328 of file BlueNRG1_i2c.c.

void I2C_FlushRx | ( | I2C_Type * | I2Cx | ) |

Returns the most recent received data by the I2Cx peripheral.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type

Return values

  None |

Definition at line 389 of file BlueNRG1_i2c.c.

void I2C_FlushTx | ( | I2C_Type * | I2Cx | ) |

Returns the most recent received data by the I2Cx peripheral.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type

Return values

  None |

Definition at line 355 of file BlueNRG1_i2c.c.

void I2C_GeneralCallCmd | ( | I2C_Type * | I2Cx,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the general call feature.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 263 of file BlueNRG1_i2c.c.

void I2C_GenerateStopCondition | ( | I2C_Type * | I2Cx | ) |

Generate a stop condition.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type

Return values

  None |

Definition at line 454 of file BlueNRG1_i2c.c.

ITStatus I2C_GetITPendingBit | ( | I2C_Type * | I2Cx,
|  | uint32_t | I2C_IT
| ) |  |

Checks whether the specified I2C interrupt has occurred or not.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  I2C_IT | specifies the interrupt source to check. This parameter can be one of the following values:
  - I2C_IT_TXFE: Tx FIFO empty
  - I2C_IT_TXFNE: TX FIFO nearly empty
  - I2C_IT_TXFF: Tx FIFO full
  - I2C_IT_TXFOVR: Tx FIFO overflow
  - I2C_IT_RXFE: Rx FIFO empty
  - I2C_IT_RXFNF: Rx FIFO nearly full
  - I2C_IT_RXFF: Rx FIFO full
  - I2C_IT_LBR: Length number of bytes received
  - I2C_IT_RFSR: Read from slave request
  - I2C_IT_RFSE: Read from slave empty
  - I2C_IT_WTSR: Write to slave request
  - I2C_IT_MTD: Master transaction done
  - I2C_IT_STD: Slave transaction done
  - I2C_IT_SAL: Slave arbitration lost
  - I2C_IT_MAL: Master arbitration lost
  - I2C_IT_BERR: Bus error
  - I2C_IT_MTDWS: Master transaction done without stop
  - I2C_IT_TIMEOUT: Timeout or Tlow error

Return values

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

Definition at line 568 of file BlueNRG1_i2c.c.

ITStatus I2C_GetITStatus | ( | I2C_Type * | I2Cx,
|  | uint32_t | I2C_IT
| ) |  |

Checks whether the specified I2C interrupt has occurred or not.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  I2C_IT | specifies the interrupt source to check. This parameter can be one of the following values:
  - I2C_IT_TXFE: Tx FIFO empty
  - I2C_IT_TXFNE: TX FIFO nearly empty
  - I2C_IT_TXFF: Tx FIFO full
  - I2C_IT_TXFOVR: Tx FIFO overflow
  - I2C_IT_RXFE: Rx FIFO empty
  - I2C_IT_RXFNF: Rx FIFO nearly full
  - I2C_IT_RXFF: Rx FIFO full
  - I2C_IT_LBR: Length number of bytes received
  - I2C_IT_RFSR: Read from slave request
  - I2C_IT_RFSE: Read from slave empty
  - I2C_IT_WTSR: Write to slave request
  - I2C_IT_MTD: Master transaction done
  - I2C_IT_STD: Slave transaction done
  - I2C_IT_SAL: Slave arbitration lost
  - I2C_IT_MAL: Master arbitration lost
  - I2C_IT_BERR: Bus error
  - I2C_IT_MTDWS: Master transaction done without stop
  - I2C_IT_TIMEOUT: Timeout or Tlow error

Return values

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

Definition at line 525 of file BlueNRG1_i2c.c.

I2C_OpStatus I2C_GetStatus | ( | I2C_Type * | I2Cx | ) |

Get the present state of the operation executed by I2C block.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type

Return values

  I2C_OpStatus | the I2C operation status I2C_OpStatus

Definition at line 626 of file BlueNRG1_i2c.c.

void I2C_Init | ( | I2C_Type * | I2Cx,
|  | I2C_InitType * | I2C_InitStruct
| ) |  |

Initializes the I2Cx peripheral according to the specified parameters in the I2C_InitStruct.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  I2C_InitStruct | pointer to a I2C_InitType structure that contains the configuration information for the specified I2C peripheral.

Return values

  None |

Definition at line 117 of file BlueNRG1_i2c.c.

void I2C_ITConfig | ( | I2C_Type * | I2Cx,
|  | uint32_t | I2C_IT,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the specified I2C interrupts.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  I2C_IT | specifies the I2C interrupts sources to be enabled or disabled. This parameter can be any combination of the following values:
  - I2C_IT_TXFE: Tx FIFO empty
  - I2C_IT_TXFNE: TX FIFO nearly empty
  - I2C_IT_TXFF: Tx FIFO full
  - I2C_IT_TXFOVR: Tx FIFO overflow
  - I2C_IT_RXFE: Rx FIFO empty
  - I2C_IT_RXFNF: Rx FIFO nearly full
  - I2C_IT_RXFF: Rx FIFO full
  - I2C_IT_LBR: Length number of bytes received
  - I2C_IT_RFSR: Read from slave request
  - I2C_IT_RFSE: Read from slave empty
  - I2C_IT_WTSR: Write to slave request
  - I2C_IT_MTD: Master transaction done
  - I2C_IT_STD: Slave transaction done
  - I2C_IT_SAL: Slave arbitration lost
  - I2C_IT_MAL: Master arbitration lost
  - I2C_IT_BERR: Bus error
  - I2C_IT_MTDWS: Master transaction done without stop
  - I2C_IT_TIMEOUT: Timeout or Tlow error
  NewState | functional state FunctionalState This parameter can be: ENABLE or DISABLE.

Return values

  None |

Definition at line 305 of file BlueNRG1_i2c.c.

uint8_t I2C_ReceiveData | ( | I2C_Type * | I2Cx | ) |

Returns the most recent received data by the I2Cx peripheral.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type

Return values

  uint8_t | The value of the received data.

Definition at line 341 of file BlueNRG1_i2c.c.

void I2C_SetHoldTime | ( | I2C_Type * | I2Cx,
|  | uint16_t | I2C_HoldTime
| ) |  |

Set the hold time value for data transfer.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  I2C_HoldTime | specifies the hold time value.

Return values

  None |

Definition at line 469 of file BlueNRG1_i2c.c.

void I2C_SetHoldTimeStartCondition | ( | I2C_Type * | I2Cx,
|  | uint16_t | I2C_HoldTime
| ) |  |

Set the hold time value for start condition.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  I2C_HoldTime | specifies the hold time value.

Return values

  None |

Definition at line 484 of file BlueNRG1_i2c.c.

void I2C_SetRxThreshold | ( | I2C_Type * | I2Cx,
|  | uint16_t | RxThres
| ) |  |

Sets the receive FIFO threshold by the I2Cx peripheral.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  RxThres | The value of the threshold 2-byte.

Definition at line 438 of file BlueNRG1_i2c.c.

void I2C_SetTxThreshold | ( | I2C_Type * | I2Cx,
|  | uint16_t | TxThres
| ) |  |

Sets the transmit FIFO threshold by the I2Cx peripheral.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type
  TxThres | The value of the threshold 2-byte.

Return values

  None |

Definition at line 423 of file BlueNRG1_i2c.c.

void I2C_StructInit | ( | I2C_InitType * | I2C_InitStruct | ) |

Fills the I2C_InitStruct with default values.

Parameters

  I2C_InitStruct | pointer to an I2C_InitType structure which will be initialized.

Return values

  None |

Definition at line 187 of file BlueNRG1_i2c.c.

I2C_OpStatus I2C_WaitFlushRx | ( | I2C_Type * | I2Cx | ) |

Return the status of the RX FIFO flush operation.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type

Return values

  I2C_OpStatus | operation status I2C_OpStatus

Definition at line 403 of file BlueNRG1_i2c.c.

I2C_OpStatus I2C_WaitFlushTx | ( | I2C_Type * | I2Cx | ) |

Return the status of the TX FIFO flush operation.

Parameters

  I2Cx | where x can be 1 or 2 to select the I2C peripheral I2C_Type

Return values

  I2C_OpStatus | operation status I2C_OpStatus

Definition at line 369 of file BlueNRG1_i2c.c.