From 172ed5e2be1c95ff35dc025077143925d5a9a5ec Mon Sep 17 00:00:00 2001 From: gnssuser Date: Wed, 12 Nov 2025 14:01:30 +0100 Subject: [PATCH] LD2: LED helper functions for onboard LED, toggle in every sec (heartbeat) --- Core/Inc/main.h | 5 +++++ Core/Src/main.c | 1 + 2 files changed, 6 insertions(+) diff --git a/Core/Inc/main.h b/Core/Inc/main.h index ced4f71..332146e 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -74,6 +74,11 @@ void Error_Handler(void); /* USER CODE BEGIN Private defines */ +/* LED2 helper accessors (static inline for type-safety and no linker symbol) */ +static inline void LED2_Toggle(void) { HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin); } +static inline void LED2_On(void) { HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_SET); } +static inline void LED2_Off(void) { HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET); } + /* USER CODE END Private defines */ #ifdef __cplusplus diff --git a/Core/Src/main.c b/Core/Src/main.c index 8f27755..854e4f1 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -140,6 +140,7 @@ int main(void) { static uint32_t Tick1secRef = 0; if (TickChk(&Tick1secRef, 1000)) { + LED2_Toggle(); } int c;