From 2f20ebeba43b6ea3fb674baef3dabf83cc52ab8f Mon Sep 17 00:00:00 2001 From: Klagarge Date: Wed, 10 Apr 2024 16:59:15 +0200 Subject: [PATCH] finish practical work 2 Time between sending and receiving event : - Waveforms : 19us - TraceAnalyzer : 18us --- main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 71fc6cc..c5770c7 100644 --- a/main.c +++ b/main.c @@ -51,7 +51,8 @@ void EXTI2_IRQHandler(void) void HAL_GPIO_EXTI_Callback(uint16_t GPIO_PIN) { //button interrupt - HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_9); + HAL_GPIO_WritePin(GPIOF, GPIO_PIN_9, 1); + osEventFlagsSet(evt_id, 0x1U); } @@ -62,8 +63,8 @@ __NO_RETURN static void taskCounter(void *argument) { for (;;) { - osEventFlagsWait(evt_id); - osEventFlagsClear(evt_id, ); + osEventFlagsWait(evt_id, 0x1U, osFlagsWaitAny, osWaitForever); + HAL_GPIO_WritePin(GPIOF, GPIO_PIN_9, 0); } }