Core/Src/main.c
static void MX_DAC1_Init(void)
{

  /* USER CODE BEGIN DAC1_Init 0 */

  /* USER CODE END DAC1_Init 0 */

  DAC_ChannelConfTypeDef sConfig = {0};

  /* USER CODE BEGIN DAC1_Init 1 */

  /* USER CODE END DAC1_Init 1 */
  /** DAC Initialization
  */
  hdac1.Instance = DAC1;
  if (HAL_DAC_Init(&hdac1) != HAL_OK)
  {
    Error_Handler();
  }
  /** DAC channel OUT1 config
  */
  sConfig.DAC_SampleAndHold = DAC_SAMPLEANDHOLD_DISABLE;
  sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
  sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
  sConfig.DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_DISABLE;
  sConfig.DAC_UserTrimming = DAC_TRIMMING_FACTORY;
  if (HAL_DAC_ConfigChannel(&hdac1, &sConfig, DAC_CHANNEL_1) != HAL_OK)
  {
    Error_Handler();
  }
  /** DAC channel OUT2 config
  */
  sConfig.DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_DISABLE;
  if (HAL_DAC_ConfigChannel(&hdac1, &sConfig, DAC_CHANNEL_2) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN DAC1_Init 2 */
    HAL_DAC_Start(&hdac1, DAC_CHANNEL_1);
    HAL_DAC_Start(&hdac1, DAC_CHANNEL_2);
  /* USER CODE END DAC1_Init 2 */

}
/**
  * @brief DAC1 Initialization Function
  * @param None
  * @retval None
  */
@brief DAC1 Initialization Function
@param None
@retval None
@brief DAC1 Initialization Function @param None @retval None
static void MX_DAC1_Init(void)
{
  DAC_ChannelConfTypeDef sConfig = {0};
  hdac1.Instance = DAC1;
  if (HAL_DAC_Init(&hdac1) != HAL_OK)
  {
    Error_Handler();
  }
  sConfig.DAC_SampleAndHold = DAC_SAMPLEANDHOLD_DISABLE;
  sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
  sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
  sConfig.DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_DISABLE;
  sConfig.DAC_UserTrimming = DAC_TRIMMING_FACTORY;
  if (HAL_DAC_ConfigChannel(&hdac1, &sConfig, DAC_CHANNEL_1) != HAL_OK)
  {
    Error_Handler();
  }
  sConfig.DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_DISABLE;
  if (HAL_DAC_ConfigChannel(&hdac1, &sConfig, DAC_CHANNEL_2) != HAL_OK)
  {
    Error_Handler();
  }
    HAL_DAC_Start(&hdac1, DAC_CHANNEL_1);
    HAL_DAC_Start(&hdac1, DAC_CHANNEL_2);
}
static void MX_DAC1_Init ( void ) { DAC_ChannelConfTypeDef sConfig = { 0 } ; hdac1 . Instance = DAC1 ; if ( HAL_DAC_Init ( & hdac1 ) != HAL_OK ) { Error_Handler ( ) ; } sConfig . DAC_SampleAndHold = DAC_SAMPLEANDHOLD_DISABLE ; sConfig . DAC_Trigger = DAC_TRIGGER_NONE ; sConfig . DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE ; sConfig . DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_DISABLE ; sConfig . DAC_UserTrimming = DAC_TRIMMING_FACTORY ; if ( HAL_DAC_ConfigChannel ( & hdac1 , & sConfig , DAC_CHANNEL_1 ) != HAL_OK ) { Error_Handler ( ) ; } sConfig . DAC_ConnectOnChipPeripheral = DAC_CHIPCONNECT_DISABLE ; if ( HAL_DAC_ConfigChannel ( & hdac1 , & sConfig , DAC_CHANNEL_2 ) != HAL_OK ) { Error_Handler ( ) ; } HAL_DAC_Start ( & hdac1 , DAC_CHANNEL_1 ) ; HAL_DAC_Start ( & hdac1 , DAC_CHANNEL_2 ) ; }
@brief DAC1 Initialization Function
 @param None
 @retval None
@brief DAC1 Initialization Function @param None @retval None
/* USER CODE BEGIN DAC1_Init 0 */ /* USER CODE END DAC1_Init 0 */ /* USER CODE BEGIN DAC1_Init 1 */ /* USER CODE END DAC1_Init 1 */ /** DAC Initialization
  */ /** DAC channel OUT1 config
  */ /** DAC channel OUT2 config
  */ /* USER CODE BEGIN DAC1_Init 2 */ /* USER CODE END DAC1_Init 2 */