/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct.  */
void DAC_Init(uint32_t DAC_Channel, DAC_InitType *DAC_InitStruct)
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct.  */
void DAC_Init(uint32_t DAC_Channel, DAC_InitType *DAC_InitStruct)
{
    uint32_t tmpreg1 = 0, tmpreg2 = 0;
    assert_param(IS_DAC_TRIGGER(DAC_InitStruct->Trigger));
    assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->WaveGen));
    assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->LfsrUnMaskTriAmp));
    assert_param(IS_DAC_OUTPUT_BUFFER_STATE(DAC_InitStruct->BufferOutput));
    tmpreg1 = DAC->CTRL;
    tmpreg1 &= ~(CTRL_CLEAR_MASK << DAC_Channel);
    tmpreg2 = (DAC_InitStruct->Trigger | DAC_InitStruct->WaveGen | DAC_InitStruct->LfsrUnMaskTriAmp
               | DAC_InitStruct->BufferOutput);
    tmpreg1 |= tmpreg2 << DAC_Channel;
    DAC->CTRL = tmpreg1;
}