Skip to content

Commit 3b5e9b8

Browse files
committed
cube mx config and u_adc.c init
1 parent 5254f58 commit 3b5e9b8

11 files changed

Lines changed: 825 additions & 275 deletions

File tree

.mxproject

Lines changed: 24 additions & 22 deletions
Large diffs are not rendered by default.

Core/Inc/linked_list.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* File Name : linked_list.h
5+
* Description : This file provides code for the configuration
6+
* of the LinkedList.
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2026 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+
/* Define to prevent recursive inclusion -------------------------------------*/
22+
#ifndef LINKED_LIST_H
23+
#define LINKED_LIST_H
24+
25+
#ifdef __cplusplus
26+
extern "C" {
27+
#endif
28+
29+
/* Includes ------------------------------------------------------------------*/
30+
#include "main.h"
31+
32+
/* Exported types ------------------------------------------------------------*/
33+
/* Exported constants --------------------------------------------------------*/
34+
HAL_StatusTypeDef MX_YourQueueName_Config(void);
35+
36+
#ifdef __cplusplus
37+
}
38+
#endif
39+
40+
#endif /* LINKED_LIST_H */
41+

Core/Inc/stm32h5xx_it.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ void MemManage_Handler(void);
5252
void BusFault_Handler(void);
5353
void UsageFault_Handler(void);
5454
void DebugMon_Handler(void);
55+
void GPDMA1_Channel0_IRQHandler(void);
56+
void GPDMA1_Channel1_IRQHandler(void);
5557
void TIM1_UP_IRQHandler(void);
5658
/* USER CODE BEGIN EFP */
5759

Core/Src/linked_list.c

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/* USER CODE BEGIN Header */
2+
/**
3+
******************************************************************************
4+
* File Name : linked_list.c
5+
* Description : This file provides code for the configuration
6+
* of the LinkedList.
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2026 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+
/* Includes ------------------------------------------------------------------*/
21+
#include "linked_list.h"
22+
23+
/* Private includes ----------------------------------------------------------*/
24+
/* USER CODE BEGIN Includes */
25+
26+
/* USER CODE END Includes */
27+
28+
DMA_NodeTypeDef YourNodeName;
29+
DMA_QListTypeDef YourQueueName;
30+
31+
/* Private typedef -----------------------------------------------------------*/
32+
/* USER CODE BEGIN PTD */
33+
34+
/* USER CODE END PTD */
35+
36+
/* Private define ------------------------------------------------------------*/
37+
/* USER CODE BEGIN PD */
38+
39+
/* USER CODE END PD */
40+
41+
/* Private macro -------------------------------------------------------------*/
42+
/* USER CODE BEGIN PM */
43+
44+
/* USER CODE END PM */
45+
46+
/**
47+
* @brief DMA Linked-list YourQueueName configuration
48+
* @param None
49+
* @retval None
50+
*/
51+
HAL_StatusTypeDef MX_YourQueueName_Config(void)
52+
{
53+
HAL_StatusTypeDef ret = HAL_OK;
54+
/* DMA node configuration declaration */
55+
DMA_NodeConfTypeDef pNodeConfig;
56+
57+
/* Set node configuration ################################################*/
58+
pNodeConfig.NodeType = DMA_GPDMA_2D_NODE;
59+
pNodeConfig.Init.Request = GPDMA1_REQUEST_ADC1;
60+
pNodeConfig.Init.BlkHWRequest = DMA_BREQ_SINGLE_BURST;
61+
pNodeConfig.Init.Direction = DMA_PERIPH_TO_MEMORY;
62+
pNodeConfig.Init.SrcInc = DMA_SINC_FIXED;
63+
pNodeConfig.Init.DestInc = DMA_DINC_INCREMENTED;
64+
pNodeConfig.Init.SrcDataWidth = DMA_SRC_DATAWIDTH_BYTE;
65+
pNodeConfig.Init.DestDataWidth = DMA_DEST_DATAWIDTH_HALFWORD;
66+
pNodeConfig.Init.SrcBurstLength = 1;
67+
pNodeConfig.Init.DestBurstLength = 1;
68+
pNodeConfig.Init.TransferAllocatedPort = DMA_SRC_ALLOCATED_PORT0|DMA_DEST_ALLOCATED_PORT0;
69+
pNodeConfig.Init.TransferEventMode = DMA_TCEM_BLOCK_TRANSFER;
70+
pNodeConfig.Init.Mode = DMA_NORMAL;
71+
pNodeConfig.RepeatBlockConfig.RepeatCount = 1;
72+
pNodeConfig.RepeatBlockConfig.SrcAddrOffset = 0;
73+
pNodeConfig.RepeatBlockConfig.DestAddrOffset = 0;
74+
pNodeConfig.RepeatBlockConfig.BlkSrcAddrOffset = 0;
75+
pNodeConfig.RepeatBlockConfig.BlkDestAddrOffset = 0;
76+
pNodeConfig.TriggerConfig.TriggerPolarity = DMA_TRIG_POLARITY_MASKED;
77+
pNodeConfig.DataHandlingConfig.DataExchange = DMA_EXCHANGE_NONE;
78+
pNodeConfig.DataHandlingConfig.DataAlignment = DMA_DATA_RIGHTALIGN_ZEROPADDED;
79+
pNodeConfig.SrcAddress = 0;
80+
pNodeConfig.DstAddress = 0;
81+
pNodeConfig.DataSize = 0;
82+
83+
/* Build YourNodeName Node */
84+
ret |= HAL_DMAEx_List_BuildNode(&pNodeConfig, &YourNodeName);
85+
86+
/* Insert YourNodeName to Queue */
87+
ret |= HAL_DMAEx_List_InsertNode_Tail(&YourQueueName, &YourNodeName);
88+
89+
ret |= HAL_DMAEx_List_SetCircularMode(&YourQueueName);
90+
91+
return ret;
92+
}
93+

0 commit comments

Comments
 (0)