diff --git a/.cproject b/.cproject index 7cf18ef..b4ad5cc 100644 --- a/.cproject +++ b/.cproject @@ -23,7 +23,7 @@ - + @@ -38,6 +38,7 @@ + diff --git a/.settings/com.st.stm32cube.ide.mcu.sfrview.prefs b/.settings/com.st.stm32cube.ide.mcu.sfrview.prefs new file mode 100644 index 0000000..98a69fc --- /dev/null +++ b/.settings/com.st.stm32cube.ide.mcu.sfrview.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +sfrviewstate={"fFavorites"\:{"fLists"\:{}},"fProperties"\:{"fNodeProperties"\:{}}} diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index da167f4..564e979 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/.settings/stm32cubeide.project.prefs b/.settings/stm32cubeide.project.prefs index 9a73229..04c030f 100644 --- a/.settings/stm32cubeide.project.prefs +++ b/.settings/stm32cubeide.project.prefs @@ -1,5 +1,5 @@ -2F62501ED4689FB349E356AB974DBE57=E28E9ADA8844289BA4C9F2B226092C93 +2F62501ED4689FB349E356AB974DBE57=EE489545371681B17082009E1CC9BBC8 66BE74F758C12D739921AEA421D593D3=1 -8DF89ED150041C4CBC7CB9A9CAA90856=E28E9ADA8844289BA4C9F2B226092C93 +8DF89ED150041C4CBC7CB9A9CAA90856=EE489545371681B17082009E1CC9BBC8 DC22A860405A8BF2F2C095E5B6529F12=A68C7E7603A475B97C64AD650453EC7C eclipse.preferences.version=1 diff --git a/Core/Inc/tx_user.h b/Core/Inc/tx_user.h index 58af04b..c2ba49e 100644 --- a/Core/Inc/tx_user.h +++ b/Core/Inc/tx_user.h @@ -130,9 +130,7 @@ Define this to save space in the thread control block. */ -/* #define TX_NO_FILEX_POINTER -*/ /* Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls should be processed within the a system timer thread or directly in the timer ISR. @@ -167,9 +165,7 @@ define is negated, thereby forcing the stack fill which is necessary for the stack checking logic. */ -/* #define TX_ENABLE_STACK_CHECKING -*/ /* Determine if random number is used for stack filling. By default, ThreadX uses a fixed pattern for stack filling. When the following is defined, ThreadX uses a random number diff --git a/Core/Src/LED.c b/Core/Src/LED.c index 5622919..cfd3c7a 100644 --- a/Core/Src/LED.c +++ b/Core/Src/LED.c @@ -9,13 +9,17 @@ #include "stm32g0xx_ll_gpio.h" #include "tx_api.h" +extern TX_QUEUE q_LED; + void LED(ULONG thread_input) { (void)thread_input; + uintptr_t *msg; while(true) { - tx_thread_sleep(500U); +// tx_thread_sleep(500U); + tx_queue_receive(&q_LED, &msg, 500UL); LL_GPIO_TogglePin(GPIOA, LL_GPIO_PIN_10); } diff --git a/Core/Src/main.c b/Core/Src/main.c index d1bb4db..b8cbc5f 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -21,6 +21,7 @@ /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ +#include #include "tx_api.h" /* USER CODE END Includes */ @@ -147,14 +148,35 @@ __NO_RETURN int main(void) __BKPT(0); } +void thread(ULONG thread_input); extern void LED(ULONG thread_input); TX_THREAD tx_LED; -ULONG stack_LED[64]; +ULONG stack_LED[256]; +TX_THREAD tx_thread; +ULONG stack_thread[256]; + +TX_QUEUE q_LED; +uintptr_t aq_LED[10]; void tx_application_define(void *first_unused_memory) { (void)first_unused_memory; tx_thread_create(&tx_LED, "LED", LED, 0UL, stack_LED, sizeof(stack_LED), 1U, 1U, TX_NO_TIME_SLICE, TX_AUTO_START); + tx_thread_create(&tx_thread, "Thread", thread, 0UL, stack_thread, sizeof(stack_thread), 1U, 1U, TX_NO_TIME_SLICE, TX_AUTO_START); + + /* Die Nachrichtengröße wird in 32-Bit-Words angegeben -> für Pointer + * auf eine Datenstruktur ist die größe von eins daher ausriechend. */ + tx_queue_create(&q_LED, "LED", 1U, aq_LED, sizeof(aq_LED)); +} + +void thread(ULONG thread_input) +{ + while(true) + { + tx_thread_sleep(1000U); + + tx_queue_send(&q_LED, &thread_input, TX_NO_WAIT); + } } /* USER CODE END 4 */