/* Update CSR register with the measured LSI frequency.  */
void BEEP_LSICalibrationConfig(uint32_t LSIFreqHz)
/* Update CSR register with the measured LSI frequency.  */
void BEEP_LSICalibrationConfig(uint32_t LSIFreqHz)
{
  uint16_t lsifreqkhz;
  uint16_t A;
  assert_param(IS_LSI_FREQUENCY(LSIFreqHz));
  lsifreqkhz = (uint16_t)(LSIFreqHz / 1000);
  BEEP->CSR2 &= (uint8_t)(~BEEP_CSR2_BEEPDIV);
  A = (uint16_t)(lsifreqkhz >> 3U);
  if ((8U * A) >= ((lsifreqkhz - (8U * A)) * (1U + (2U * A))))
  {
    BEEP->CSR2 |= (uint8_t)(A - 2U);
  }
  else
  {
    BEEP->CSR2 |= (uint8_t)(A - 1U);
  }
}