You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.9 KiB
C
71 lines
1.9 KiB
C
/* USER CODE BEGIN Header */
|
|
/**
|
|
******************************************************************************
|
|
* @file dac.c
|
|
* @brief This file provides code for the configuration
|
|
* of the DAC instances.
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2025 STMicroelectronics.
|
|
* All rights reserved.
|
|
*
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
* in the root directory of this software component.
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
/* USER CODE END Header */
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "dac.h"
|
|
|
|
/* USER CODE BEGIN 0 */
|
|
|
|
/* USER CODE END 0 */
|
|
|
|
/* DAC1 init function */
|
|
void MX_DAC1_Init(void)
|
|
{
|
|
|
|
/* USER CODE BEGIN DAC1_Init 0 */
|
|
|
|
/* USER CODE END DAC1_Init 0 */
|
|
|
|
LL_DAC_InitTypeDef DAC_InitStruct = {0};
|
|
|
|
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
|
|
|
/* Peripheral clock enable */
|
|
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_DAC1);
|
|
|
|
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_GPIOA);
|
|
/**DAC1 GPIO Configuration
|
|
PA4 ------> DAC1_OUT1
|
|
*/
|
|
GPIO_InitStruct.Pin = DISP_BRIGHT_Pin;
|
|
GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;
|
|
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
|
LL_GPIO_Init(DISP_BRIGHT_GPIO_Port, &GPIO_InitStruct);
|
|
|
|
/* USER CODE BEGIN DAC1_Init 1 */
|
|
|
|
/* USER CODE END DAC1_Init 1 */
|
|
|
|
/** DAC channel OUT1 config
|
|
*/
|
|
DAC_InitStruct.TriggerSource = LL_DAC_TRIG_SOFTWARE;
|
|
DAC_InitStruct.WaveAutoGeneration = LL_DAC_WAVE_AUTO_GENERATION_NONE;
|
|
DAC_InitStruct.OutputBuffer = LL_DAC_OUTPUT_BUFFER_ENABLE;
|
|
LL_DAC_Init(DAC1, LL_DAC_CHANNEL_1, &DAC_InitStruct);
|
|
LL_DAC_DisableTrigger(DAC1, LL_DAC_CHANNEL_1);
|
|
/* USER CODE BEGIN DAC1_Init 2 */
|
|
|
|
/* USER CODE END DAC1_Init 2 */
|
|
|
|
}
|
|
|
|
/* USER CODE BEGIN 1 */
|
|
|
|
/* USER CODE END 1 */
|