/* Enables or disables the I2C automatic end mode (stop condition is automatically sent when nbytes data are transferred).  */
void I2C_AutoEndCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
/* Enables or disables the I2C automatic end mode (stop condition is automatically sent when nbytes data are transferred).  */
void I2C_AutoEndCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
{
  assert_param(IS_I2C_ALL_PERIPH(I2Cx));
  assert_param(IS_FUNCTIONAL_STATE(NewState));
  if (NewState != DISABLE)
  {
    I2Cx->CR2 |= I2C_CR2_AUTOEND;
  }
  else
  {
    I2Cx->CR2 &= (uint32_t)~((uint32_t)I2C_CR2_AUTOEND);
  }
}