Changeset 61 for ctrl/firmware/Main/CubeMX/Core/Src
- Timestamp:
- Jan 13, 2025, 11:56:09 AM (3 days ago)
- Location:
- ctrl/firmware/Main/CubeMX/Core/Src
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ctrl/firmware/Main/CubeMX/Core/Src/app_threadx.c
r58 r61 29 29 30 30 #include "keys_thread.h" 31 #include "gsm_thread.h" 31 32 32 33 /* USER CODE END Includes */ … … 40 41 /* USER CODE BEGIN PD */ 41 42 42 #define MAIN_THREAD_STACK_SIZE_BYTES (1024U) 43 #define KEYS_THREAD_STACK_SIZE_BYTES (1024U) 44 #define GSM_THREAD_STACK_SIZE_BYTES (1024U) 43 45 44 46 /* USER CODE END PD */ … … 53 55 54 56 TX_THREAD scan_keys_thread_ptr; 57 TX_THREAD gsm_thread_ptr; 55 58 56 59 /* USER CODE END PV */ … … 72 75 73 76 TX_BYTE_POOL *byte_pool = (TX_BYTE_POOL*)memory_ptr; 74 VOID *pointer; 77 VOID *keys_thread_pointer; 78 VOID *gsm_thread_pointer; 75 79 76 80 /* USER CODE END App_ThreadX_MEM_POOL */ … … 79 83 80 84 // Allocate the stack for main thread 81 ret = tx_byte_allocate(byte_pool, &pointer, MAIN_THREAD_STACK_SIZE_BYTES, 82 TX_NO_WAIT); 85 ret = tx_byte_allocate(byte_pool, &keys_thread_pointer, KEYS_THREAD_STACK_SIZE_BYTES, TX_NO_WAIT); 83 86 if (ret != TX_SUCCESS) { printf("Cannot allocate bytes of memory!\n"); return ret; } 84 87 85 ret = tx_thread_create(&scan_keys_thread_ptr, "Scan Keys Thread", scanKeysThread, 0x0001, 86 pointer, MAIN_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, 87 TX_NO_TIME_SLICE, TX_AUTO_START); 88 if (ret != TX_SUCCESS) { printf("Cannot create Scan Keys Thread!\n"); return ret; } 88 char* scan_keys_thread_name = "Scan Keys Thread"; 89 ret = tx_thread_create(&scan_keys_thread_ptr, scan_keys_thread_name, scanKeysThread, 0x0001, keys_thread_pointer, KEYS_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START); 90 if (ret != TX_SUCCESS) { printf("Cannot create %s!\n", scan_keys_thread_name); return ret; } 91 92 93 94 ret = tx_byte_allocate(byte_pool, &gsm_thread_pointer, GSM_THREAD_STACK_SIZE_BYTES, TX_NO_WAIT); 95 if (ret != TX_SUCCESS) { printf("Cannot allocate bytes of memory!\n"); return ret; } 96 97 char* gsm_thread_name = "GSM Thread"; 98 ret = tx_thread_create(&gsm_thread_ptr, gsm_thread_name, gsmThread, 0x0001, gsm_thread_pointer, GSM_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START); 99 if (ret != TX_SUCCESS) { printf("Cannot create %s!\n", gsm_thread_name); return ret; } 100 101 89 102 90 103 /* USER CODE END App_ThreadX_Init */ -
ctrl/firmware/Main/CubeMX/Core/Src/gpio.c
r59 r61 65 65 /*Configure GPIO pin Output Level */ 66 66 HAL_GPIO_WritePin(GPIOG, POWER_5V_EN_Pin|POWER_10V_EN_Pin|ERROR_LED_Pin|CHARGE_LED_Pin 67 |RX2_LED_Pin|RX1_LED_Pin|TX2_LED_Pin , GPIO_PIN_RESET);67 |RX2_LED_Pin|RX1_LED_Pin|TX2_LED_Pin|BUZZER_Pin, GPIO_PIN_RESET); 68 68 69 69 /*Configure GPIO pin Output Level */ 70 HAL_GPIO_WritePin( OUTPUT_ON_LED_GPIO_Port,OUTPUT_ON_LED_Pin, GPIO_PIN_RESET);70 HAL_GPIO_WritePin(GPIOD, GSM_PWR_Pin|OUTPUT_ON_LED_Pin, GPIO_PIN_RESET); 71 71 72 72 /*Configure GPIO pins : PE2 PE3 PE4 PE5 … … 141 141 142 142 /*Configure GPIO pins : POWER_5V_EN_Pin POWER_10V_EN_Pin ERROR_LED_Pin CHARGE_LED_Pin 143 RX2_LED_Pin RX1_LED_Pin TX2_LED_Pin */143 RX2_LED_Pin RX1_LED_Pin TX2_LED_Pin BUZZER_Pin */ 144 144 GPIO_InitStruct.Pin = POWER_5V_EN_Pin|POWER_10V_EN_Pin|ERROR_LED_Pin|CHARGE_LED_Pin 145 |RX2_LED_Pin|RX1_LED_Pin|TX2_LED_Pin ;145 |RX2_LED_Pin|RX1_LED_Pin|TX2_LED_Pin|BUZZER_Pin; 146 146 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; 147 147 GPIO_InitStruct.Pull = GPIO_NOPULL; … … 149 149 HAL_GPIO_Init(GPIOG, &GPIO_InitStruct); 150 150 151 /*Configure GPIO pins : PD8 PD9 PD10 PD11 152 PD12 PD13 PD14 PD15 153 PD0 PD1 PD3 PD4 154 PD5 PD6 */ 155 GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11 156 |GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15 157 |GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_3|GPIO_PIN_4 158 |GPIO_PIN_5|GPIO_PIN_6; 151 /*Configure GPIO pins : GSM_PWR_Pin OUTPUT_ON_LED_Pin */ 152 GPIO_InitStruct.Pin = GSM_PWR_Pin|OUTPUT_ON_LED_Pin; 153 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; 154 GPIO_InitStruct.Pull = GPIO_NOPULL; 155 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; 156 HAL_GPIO_Init(GPIOD, &GPIO_InitStruct); 157 158 /*Configure GPIO pins : PD11 PD12 PD13 PD14 159 PD15 PD0 PD1 PD3 160 PD4 PD5 PD6 */ 161 GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14 162 |GPIO_PIN_15|GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_3 163 |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6; 159 164 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 160 165 GPIO_InitStruct.Pull = GPIO_NOPULL; … … 162 167 163 168 /*Configure GPIO pins : PG2 PG3 PG4 PG5 164 PG6 PG7 PG8 PG14 165 PG15 */ 169 PG6 PG7 PG8 PG14 */ 166 170 GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5 167 |GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_14 168 |GPIO_PIN_15; 171 |GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_14; 169 172 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 170 173 GPIO_InitStruct.Pull = GPIO_NOPULL; … … 177 180 HAL_GPIO_Init(SD_DETECT_GPIO_Port, &GPIO_InitStruct); 178 181 179 /*Configure GPIO pin : OUTPUT_ON_LED_Pin */180 GPIO_InitStruct.Pin = OUTPUT_ON_LED_Pin;181 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;182 GPIO_InitStruct.Pull = GPIO_NOPULL;183 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;184 HAL_GPIO_Init(OUTPUT_ON_LED_GPIO_Port, &GPIO_InitStruct);185 186 182 } 187 183 -
ctrl/firmware/Main/CubeMX/Core/Src/main.c
r59 r61 25 25 #include "sdmmc.h" 26 26 #include "spi.h" 27 #include "usart.h" 27 28 #include "gpio.h" 28 29 … … 109 110 110 111 /* USER CODE BEGIN SysInit */ 111 112 #define MX_SDMMC1_SD_Init DoNothing 112 113 /* USER CODE END SysInit */ 113 #define MX_SDMMC1_SD_Init DoNothing 114 114 115 /* Initialize all configured peripherals */ 115 116 MX_GPIO_Init(); … … 118 119 MX_SPI4_Init(); 119 120 MX_SDMMC1_SD_Init(); 121 MX_USART3_UART_Init(); 120 122 /* USER CODE BEGIN 2 */ 121 123 #undef MX_SDMMC1_SD_Init
Note: See TracChangeset
for help on using the changeset viewer.