Changeset 84 for ctrl/firmware/Main/CubeMX/Core
- Timestamp:
- Feb 7, 2025, 2:56:14 PM (3 months ago)
- Location:
- ctrl/firmware/Main/CubeMX/Core
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
ctrl/firmware/Main/CubeMX/Core/Inc/main.h
r81 r84 98 98 #define SD_DETECT_Pin GPIO_PIN_8 99 99 #define SD_DETECT_GPIO_Port GPIOA 100 #define ONEWIRE_TEMP_BUS_Pin GPIO_PIN_15 101 #define ONEWIRE_TEMP_BUS_GPIO_Port GPIOA 100 102 #define ETH_SPI_PWR_Pin GPIO_PIN_3 101 103 #define ETH_SPI_PWR_GPIO_Port GPIOD -
ctrl/firmware/Main/CubeMX/Core/Inc/tim.h
r66 r84 35 35 extern TIM_HandleTypeDef htim3; 36 36 37 extern TIM_HandleTypeDef htim6; 38 37 39 extern TIM_HandleTypeDef htim8; 38 40 … … 42 44 43 45 void MX_TIM3_Init(void); 46 void MX_TIM6_Init(void); 44 47 void MX_TIM8_Init(void); 45 48 -
ctrl/firmware/Main/CubeMX/Core/Src/freertos.c
r83 r84 23 23 #include "main.h" 24 24 #include "cmsis_os.h" 25 #include "queue.h"26 25 27 26 /* Private includes ----------------------------------------------------------*/ … … 29 28 30 29 #include <stdio.h> 30 31 #include "queue.h" 31 32 32 33 #include "keys_task.h" … … 34 35 #include "mb_slave_task.h" 35 36 #include "beeper_task.h" 37 #include "onewire_task.h" 36 38 37 39 /* USER CODE END Includes */ … … 50 52 #define MB_SLAVE_TASK_STACK_DEPTH_WORDS (1024U) 51 53 #define BEEPER_TASK_STACK_DEPTH_WORDS (128U) 54 #define ONEWIRE_TASK_STACK_DEPTH_WORDS (128U) 52 55 53 56 /* USER CODE END PD */ … … 65 68 static StackType_t mbSlaveTaskStackBuffer[MB_SLAVE_TASK_STACK_DEPTH_WORDS] __attribute__((section(".DTCM_RAM"))); 66 69 static StackType_t beeperTaskStackBuffer[BEEPER_TASK_STACK_DEPTH_WORDS] __attribute__((section(".DTCM_RAM"))); 70 static StackType_t onewireTaskStackBuffer[ONEWIRE_TASK_STACK_DEPTH_WORDS] __attribute__((section(".DTCM_RAM"))); 71 67 72 static uint8_t beeperQueueStorageArea[BEEPER_QUEUE_SIZE * BEEPER_QUEUE_ITEM_SIZE] __attribute__((section(".DTCM_RAM"))); 68 69 static StaticTask_t keysTaskBuffer; 70 static StaticTask_t ethTaskBuffer; 71 static StaticTask_t mbSlaveTaskBuffer; 72 static StaticTask_t beeperTaskBuffer; 73 static StaticQueue_t beeperQueueBuffer; 73 static uint8_t onewireQueueStorageArea[ONEWIRE_QUEUE_SIZE * ONEWIRE_QUEUE_ITEM_SIZE] __attribute__((section(".DTCM_RAM"))); 74 75 static StaticTask_t keysTaskBuffer __attribute__((section(".DTCM_RAM"))); 76 static StaticTask_t ethTaskBuffer __attribute__((section(".DTCM_RAM"))); 77 static StaticTask_t mbSlaveTaskBuffer __attribute__((section(".DTCM_RAM"))); 78 static StaticTask_t beeperTaskBuffer __attribute__((section(".DTCM_RAM"))); 79 static StaticTask_t onewireTaskBuffer __attribute__((section(".DTCM_RAM"))); 80 81 static StaticQueue_t beeperQueueBuffer __attribute__((section(".DTCM_RAM"))); 82 static StaticQueue_t onewireQueueBuffer __attribute__((section(".DTCM_RAM"))); 74 83 75 84 static const char* const keysTaskName = "ScanKeysTask"; … … 77 86 static const char* const mbSlaveTaskName = "MBSlaveTask"; 78 87 static const char* const beeperTaskName = "BeeperTask"; 79 88 static const char* const onewireTaskName = "1WireTask"; 80 89 81 90 … … 154 163 if (beeperQueue == NULL) printf("Cannot create Beeper Queue!\n"); 155 164 165 onewireQueue = xQueueCreateStatic(ONEWIRE_QUEUE_SIZE, ONEWIRE_QUEUE_ITEM_SIZE, onewireQueueStorageArea, &onewireQueueBuffer); 166 if (onewireQueue == NULL) printf("Cannot create 1-Wire Queue!\n"); 167 156 168 /* USER CODE END RTOS_QUEUES */ 157 169 … … 174 186 r = xTaskCreateStatic(beeperTaskStart, beeperTaskName, BEEPER_TASK_STACK_DEPTH_WORDS, NULL, 25, beeperTaskStackBuffer, &beeperTaskBuffer); 175 187 if (r == NULL) printf("Cannot create %s!\n", beeperTaskName); 188 189 r = xTaskCreateStatic(onewireTaskStart, onewireTaskName, ONEWIRE_TASK_STACK_DEPTH_WORDS, NULL, 25, onewireTaskStackBuffer, &onewireTaskBuffer); 190 if (r == NULL) printf("Cannot create %s!\n", onewireTaskName); 176 191 177 192 /* USER CODE END RTOS_THREADS */ -
ctrl/firmware/Main/CubeMX/Core/Src/gpio.c
r81 r84 71 71 72 72 /*Configure GPIO pin Output Level */ 73 HAL_GPIO_WritePin(ONEWIRE_TEMP_BUS_GPIO_Port, ONEWIRE_TEMP_BUS_Pin, GPIO_PIN_RESET); 74 75 /*Configure GPIO pin Output Level */ 73 76 HAL_GPIO_WritePin(ETH_SPI_PWR_GPIO_Port, ETH_SPI_PWR_Pin, GPIO_PIN_SET); 74 77 … … 116 119 /*Configure GPIO pins : PA0 PA1 PA2 PA3 117 120 PA4 PA5 PA6 PA7 118 PA9 PA10 PA11 PA12 119 PA15 */ 121 PA9 PA10 PA11 PA12 */ 120 122 GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3 121 123 |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7 122 |GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12 123 |GPIO_PIN_15; 124 |GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12; 124 125 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 125 126 GPIO_InitStruct.Pull = GPIO_NOPULL; … … 185 186 HAL_GPIO_Init(SD_DETECT_GPIO_Port, &GPIO_InitStruct); 186 187 188 /*Configure GPIO pin : ONEWIRE_TEMP_BUS_Pin */ 189 GPIO_InitStruct.Pin = ONEWIRE_TEMP_BUS_Pin; 190 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; 191 GPIO_InitStruct.Pull = GPIO_NOPULL; 192 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; 193 HAL_GPIO_Init(ONEWIRE_TEMP_BUS_GPIO_Port, &GPIO_InitStruct); 194 187 195 /*Configure GPIO pins : ETH_SPI_NSS_Pin ETH_SPI_RST_Pin */ 188 196 GPIO_InitStruct.Pin = ETH_SPI_NSS_Pin|ETH_SPI_RST_Pin; -
ctrl/firmware/Main/CubeMX/Core/Src/main.c
r83 r84 136 136 MX_USART2_UART_Init(); 137 137 MX_USART10_UART_Init(); 138 MX_TIM6_Init(); 138 139 /* USER CODE BEGIN 2 */ 139 140 -
ctrl/firmware/Main/CubeMX/Core/Src/tim.c
r72 r84 26 26 27 27 TIM_HandleTypeDef htim3; 28 TIM_HandleTypeDef htim6; 28 29 TIM_HandleTypeDef htim8; 29 30 … … 82 83 /* USER CODE END TIM3_Init 2 */ 83 84 HAL_TIM_MspPostInit(&htim3); 85 86 } 87 /* TIM6 init function */ 88 void MX_TIM6_Init(void) 89 { 90 91 /* USER CODE BEGIN TIM6_Init 0 */ 92 93 /* USER CODE END TIM6_Init 0 */ 94 95 TIM_MasterConfigTypeDef sMasterConfig = {0}; 96 97 /* USER CODE BEGIN TIM6_Init 1 */ 98 99 /* USER CODE END TIM6_Init 1 */ 100 htim6.Instance = TIM6; 101 htim6.Init.Prescaler = 99; 102 htim6.Init.CounterMode = TIM_COUNTERMODE_UP; 103 htim6.Init.Period = 65535; 104 htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; 105 if (HAL_TIM_Base_Init(&htim6) != HAL_OK) 106 { 107 Error_Handler(); 108 } 109 if (HAL_TIM_OnePulse_Init(&htim6, TIM_OPMODE_SINGLE) != HAL_OK) 110 { 111 Error_Handler(); 112 } 113 sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; 114 sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; 115 if (HAL_TIMEx_MasterConfigSynchronization(&htim6, &sMasterConfig) != HAL_OK) 116 { 117 Error_Handler(); 118 } 119 /* USER CODE BEGIN TIM6_Init 2 */ 120 121 /* USER CODE END TIM6_Init 2 */ 84 122 85 123 } … … 167 205 168 206 /* USER CODE END TIM3_MspInit 1 */ 207 } 208 else if(tim_baseHandle->Instance==TIM6) 209 { 210 /* USER CODE BEGIN TIM6_MspInit 0 */ 211 212 /* USER CODE END TIM6_MspInit 0 */ 213 /* TIM6 clock enable */ 214 __HAL_RCC_TIM6_CLK_ENABLE(); 215 /* USER CODE BEGIN TIM6_MspInit 1 */ 216 217 /* USER CODE END TIM6_MspInit 1 */ 169 218 } 170 219 else if(tim_baseHandle->Instance==TIM8) … … 243 292 /* USER CODE END TIM3_MspDeInit 1 */ 244 293 } 294 else if(tim_baseHandle->Instance==TIM6) 295 { 296 /* USER CODE BEGIN TIM6_MspDeInit 0 */ 297 298 /* USER CODE END TIM6_MspDeInit 0 */ 299 /* Peripheral clock disable */ 300 __HAL_RCC_TIM6_CLK_DISABLE(); 301 /* USER CODE BEGIN TIM6_MspDeInit 1 */ 302 303 /* USER CODE END TIM6_MspDeInit 1 */ 304 } 245 305 else if(tim_baseHandle->Instance==TIM8) 246 306 {
Note: See TracChangeset
for help on using the changeset viewer.