Changeset 57 for ctrl/firmware/Main/CubeMX/Core/Src
- Timestamp:
- Dec 12, 2024, 10:25:26 AM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ctrl/firmware/Main/CubeMX/Core/Src/app_threadx.c
r55 r57 28 28 #include <stdio.h> 29 29 30 #include " MainThread.h"30 #include "keys_thread.h" 31 31 32 32 /* USER CODE END Includes */ … … 40 40 /* USER CODE BEGIN PD */ 41 41 42 #define MEMORY_BLOCK_SIZE_BYTES (8192U)43 42 #define MAIN_THREAD_STACK_SIZE_BYTES (1024U) 44 43 … … 53 52 /* USER CODE BEGIN PV */ 54 53 55 _Alignas(ULONG) uint8_t memoryBlock[MEMORY_BLOCK_SIZE_BYTES]; 56 TX_THREAD thread_ptr; 57 TX_BYTE_POOL byte_pool_0; 54 TX_THREAD scan_keys_thread_ptr; 58 55 59 56 /* USER CODE END PV */ … … 74 71 /* USER CODE BEGIN App_ThreadX_MEM_POOL */ 75 72 76 (void)memory_ptr; 77 78 /* Create a byte memory pool from which to allocate the thread stacks. */ 79 ret = tx_byte_pool_create(&byte_pool_0, "byte pool 0", memoryBlock, MEMORY_BLOCK_SIZE_BYTES); 80 if (ret != TX_SUCCESS) { printf("Cannot create BYTE POOL 0!\n"); return ret; } 81 82 uint8_t* ptr = TX_NULL; 73 TX_BYTE_POOL *byte_pool = (TX_BYTE_POOL*)memory_ptr; 74 VOID *pointer; 83 75 84 76 /* USER CODE END App_ThreadX_MEM_POOL */ … … 87 79 88 80 // Allocate the stack for main thread 89 ret = tx_byte_allocate(&byte_pool_0, (VOID**) &ptr, MAIN_THREAD_STACK_SIZE_BYTES, TX_NO_WAIT); 81 ret = tx_byte_allocate(byte_pool, &pointer, MAIN_THREAD_STACK_SIZE_BYTES, 82 TX_NO_WAIT); 90 83 if (ret != TX_SUCCESS) { printf("Cannot allocate bytes of memory!\n"); return ret; } 91 84 92 ret = tx_thread_create(&thread_ptr, "MainThread", MainThread, 0x0001, ptr, MAIN_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START); 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); 93 88 if (ret != TX_SUCCESS) { printf("Cannot create MainThread!\n"); return ret; } 94 89
Note: See TracChangeset
for help on using the changeset viewer.