source: trunk/firmware/CubeMX/Src/dma.c@ 7

Last change on this file since 7 was 1, checked in by f.jahn, 3 years ago
File size: 2.5 KB
RevLine 
[1]1/* USER CODE BEGIN Header */
2/**
3 ******************************************************************************
4 * @file dma.c
5 * @brief This file provides code for the configuration
6 * of all the requested memory to memory DMA transfers.
7 ******************************************************************************
8 * @attention
9 *
10 * Copyright (c) 2022 STMicroelectronics.
11 * All rights reserved.
12 *
13 * This software is licensed under terms that can be found in the LICENSE file
14 * in the root directory of this software component.
15 * If no LICENSE file comes with this software, it is provided AS-IS.
16 *
17 ******************************************************************************
18 */
19/* USER CODE END Header */
20
21/* Includes ------------------------------------------------------------------*/
22#include "dma.h"
23
24/* USER CODE BEGIN 0 */
25
26/* USER CODE END 0 */
27
28/*----------------------------------------------------------------------------*/
29/* Configure DMA */
30/*----------------------------------------------------------------------------*/
31
32/* USER CODE BEGIN 1 */
33
34/* USER CODE END 1 */
35DMA_HandleTypeDef hdma_memtomem_dma1_channel2;
36
37/**
38 * Enable DMA controller clock
39 * Configure DMA for memory to memory transfers
40 * hdma_memtomem_dma1_channel2
41 */
42void MX_DMA_Init(void)
43{
44
45 /* DMA controller clock enable */
46 __HAL_RCC_DMA1_CLK_ENABLE();
47
48 /* Configure DMA request hdma_memtomem_dma1_channel2 on DMA1_Channel2 */
49 hdma_memtomem_dma1_channel2.Instance = DMA1_Channel2;
50 hdma_memtomem_dma1_channel2.Init.Request = DMA_REQUEST_MEM2MEM;
51 hdma_memtomem_dma1_channel2.Init.Direction = DMA_MEMORY_TO_MEMORY;
52 hdma_memtomem_dma1_channel2.Init.PeriphInc = DMA_PINC_ENABLE;
53 hdma_memtomem_dma1_channel2.Init.MemInc = DMA_MINC_ENABLE;
54 hdma_memtomem_dma1_channel2.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
55 hdma_memtomem_dma1_channel2.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
56 hdma_memtomem_dma1_channel2.Init.Mode = DMA_NORMAL;
57 hdma_memtomem_dma1_channel2.Init.Priority = DMA_PRIORITY_VERY_HIGH;
58 if (HAL_DMA_Init(&hdma_memtomem_dma1_channel2) != HAL_OK)
59 {
60 Error_Handler();
61 }
62
63 /* DMA interrupt init */
64 /* DMA1_Channel1_IRQn interrupt configuration */
65 HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 1, 0);
66 HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
67
68}
69
70/* USER CODE BEGIN 2 */
71
72/* USER CODE END 2 */
73
Note: See TracBrowser for help on using the repository browser.