diff --git a/firmware/config/boards/microrusefi/board.mk b/firmware/config/boards/microrusefi/board.mk index 61c0437d01..85a1f40a83 100644 --- a/firmware/config/boards/microrusefi/board.mk +++ b/firmware/config/boards/microrusefi/board.mk @@ -12,10 +12,8 @@ else BOARDINC += $(BOARDS_DIR)/microrusefi # For knock_config.h endif -ifeq ($(LED_CRITICAL_ERROR_BRAIN_PIN),) - LED_CRITICAL_ERROR_BRAIN_PIN = -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::E3 -endif - +# see also openblt/board.mk STATUS_LED +LED_CRITICAL_ERROR_BRAIN_PIN = -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::E3 # *TEMPORARY* breaking TTL thus breaking Bluetooth for microRusEFI in order to enable SPI3 for SD card # *TODO* need to give people the horrible choice between Bluetooth via TTL or SD card via SPI :( horrible choice diff --git a/firmware/config/boards/microrusefi/openblt/board.mk b/firmware/config/boards/microrusefi/openblt/board.mk index 8ff5811e79..c2a886ea7d 100644 --- a/firmware/config/boards/microrusefi/openblt/board.mk +++ b/firmware/config/boards/microrusefi/openblt/board.mk @@ -14,3 +14,5 @@ BRDFLAGS = -DSTM32F429xx #| Specify library files | #|--------------------------------------------------------------------------------------| LIBS = + +BRDFLAGS += -DSTATUS_LED_PORT=GPIOE -DSTATUS_LED_PIN=GPIO_PIN_3 \ No newline at end of file diff --git a/firmware/config/boards/microrusefi/openblt/led.c b/firmware/config/boards/microrusefi/openblt/led.c deleted file mode 100644 index 44274c26b1..0000000000 --- a/firmware/config/boards/microrusefi/openblt/led.c +++ /dev/null @@ -1,100 +0,0 @@ -/************************************************************************************//** -* \file Demo/ARMCM4_STM32F4_Nucleo_F429ZI_GCC/Bootled.c -* \brief LED driver source file. -* \ingroup Boot_ARMCM4_STM32F4_Nucleo_F429ZI_GCC -* \internal -*---------------------------------------------------------------------------------------- -* C O P Y R I G H T -*---------------------------------------------------------------------------------------- -* Copyright (c) 2021 by Feaser http://www.feaser.com All rights reserved -* -*---------------------------------------------------------------------------------------- -* L I C E N S E -*---------------------------------------------------------------------------------------- -* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or -* modify it under the terms of the GNU General Public License as published by the Free -* Software Foundation, either version 3 of the License, or (at your option) any later -* version. -* -* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; -* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -* PURPOSE. See the GNU General Public License for more details. -* -* You have received a copy of the GNU General Public License along with OpenBLT. It -* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. -* -* \endinternal -****************************************************************************************/ - -/**************************************************************************************** -* Include files -****************************************************************************************/ -#include "boot.h" /* bootloader generic header */ -#include "led.h" /* module header */ -#include "stm32f4xx.h" /* STM32 registers and drivers */ - - -/**************************************************************************************** -* Local data declarations -****************************************************************************************/ -/** \brief Holds the desired LED blink interval time. */ -static blt_int16u ledBlinkIntervalMs; - - -/************************************************************************************//** -** \brief Initializes the LED blink driver. -** \param interval_ms Specifies the desired LED blink interval time in milliseconds. -** \return none. -** -****************************************************************************************/ -void LedBlinkInit(blt_int16u interval_ms) -{ - /* store the interval time between LED toggles */ - ledBlinkIntervalMs = interval_ms; -} /*** end of LedBlinkInit ***/ - - -/************************************************************************************//** -** \brief Task function for blinking the LED as a fixed timer interval. -** \return none. -** -****************************************************************************************/ -void LedBlinkTask(void) -{ - static blt_bool ledOn = BLT_FALSE; - static blt_int32u nextBlinkEvent = 0; - - /* check for blink event */ - if (TimerGet() >= nextBlinkEvent) - { - /* toggle the LED state */ - if (ledOn == BLT_FALSE) - { - ledOn = BLT_TRUE; - HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, GPIO_PIN_SET); - } - else - { - ledOn = BLT_FALSE; - HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, GPIO_PIN_RESET); - } - /* schedule the next blink event */ - nextBlinkEvent = TimerGet() + ledBlinkIntervalMs; - } -} /*** end of LedBlinkTask ***/ - - -/************************************************************************************//** -** \brief Cleans up the LED blink driver. This is intended to be used upon program -** exit. -** \return none. -** -****************************************************************************************/ -void LedBlinkExit(void) -{ - /* turn the LED off */ - HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, GPIO_PIN_RESET); -} /*** end of LedBlinkExit ***/ - - -/*********************************** end of led.c **************************************/ diff --git a/firmware/config/boards/proteus/board.mk b/firmware/config/boards/proteus/board.mk index b04872bd2a..286e14bfde 100644 --- a/firmware/config/boards/proteus/board.mk +++ b/firmware/config/boards/proteus/board.mk @@ -9,6 +9,7 @@ ifeq ($(PROJECT_CPU),ARCH_STM32F4) endif DDEFS += -DEFI_USE_OSC=TRUE +# see also openblt/board.mk STATUS_LED DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=Gpio::E3 DDEFS += -DFIRMWARE_ID=\"proteus\" DDEFS += $(VAR_DEF_ENGINE_TYPE) diff --git a/firmware/config/boards/proteus/openblt/board.mk b/firmware/config/boards/proteus/openblt/board.mk index 5b728a03f5..4927b61814 100644 --- a/firmware/config/boards/proteus/openblt/board.mk +++ b/firmware/config/boards/proteus/openblt/board.mk @@ -22,3 +22,5 @@ endif #| Specify library files | #|--------------------------------------------------------------------------------------| LIBS = + +BRDFLAGS += -DSTATUS_LED_PORT=GPIOE -DSTATUS_LED_PIN=GPIO_PIN_3 \ No newline at end of file diff --git a/firmware/config/boards/proteus/openblt/led.h b/firmware/config/boards/proteus/openblt/led.h deleted file mode 100644 index 73f07cd273..0000000000 --- a/firmware/config/boards/proteus/openblt/led.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************************//** -* \file Demo/ARMCM4_STM32F4_Nucleo_F429ZI_GCC/Boot/led.h -* \brief LED driver header file. -* \ingroup Boot_ARMCM4_STM32F4_Nucleo_F429ZI_GCC -* \internal -*---------------------------------------------------------------------------------------- -* C O P Y R I G H T -*---------------------------------------------------------------------------------------- -* Copyright (c) 2021 by Feaser http://www.feaser.com All rights reserved -* -*---------------------------------------------------------------------------------------- -* L I C E N S E -*---------------------------------------------------------------------------------------- -* This file is part of OpenBLT. OpenBLT is free software: you can redistribute it and/or -* modify it under the terms of the GNU General Public License as published by the Free -* Software Foundation, either version 3 of the License, or (at your option) any later -* version. -* -* OpenBLT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; -* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -* PURPOSE. See the GNU General Public License for more details. -* -* You have received a copy of the GNU General Public License along with OpenBLT. It -* should be located in ".\Doc\license.html". If not, contact Feaser to obtain a copy. -* -* \endinternal -****************************************************************************************/ -#ifndef LED_H -#define LED_H - -/**************************************************************************************** -* Function prototypes -****************************************************************************************/ -void LedBlinkInit(blt_int16u interval_ms); -void LedBlinkTask(void); -void LedBlinkExit(void); - - -#endif /* LED_H */ -/*********************************** end of led.h **************************************/ diff --git a/firmware/config/boards/proteus/openblt/led.c b/firmware/hw_layer/openblt/led.c similarity index 96% rename from firmware/config/boards/proteus/openblt/led.c rename to firmware/hw_layer/openblt/led.c index da6bf9941f..7e921890b9 100644 --- a/firmware/config/boards/proteus/openblt/led.c +++ b/firmware/hw_layer/openblt/led.c @@ -79,12 +79,12 @@ void LedBlinkTask(void) if (ledOn == BLT_FALSE) { ledOn = BLT_TRUE; - HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, GPIO_PIN_SET); + HAL_GPIO_WritePin(STATUS_LED_PORT, STATUS_LED_PIN, GPIO_PIN_SET); } else { ledOn = BLT_FALSE; - HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3, GPIO_PIN_RESET); + HAL_GPIO_WritePin(STATUS_LED_PORT, STATUS_LED_PIN, GPIO_PIN_RESET); } /* schedule the next blink event */ nextBlinkEvent = TimerGet() + ledBlinkIntervalMs; diff --git a/firmware/config/boards/microrusefi/openblt/led.h b/firmware/hw_layer/openblt/led.h similarity index 100% rename from firmware/config/boards/microrusefi/openblt/led.h rename to firmware/hw_layer/openblt/led.h diff --git a/firmware/hw_layer/openblt/openblt.mk b/firmware/hw_layer/openblt/openblt.mk index 9c098efc9d..e6af33e884 100644 --- a/firmware/hw_layer/openblt/openblt.mk +++ b/firmware/hw_layer/openblt/openblt.mk @@ -81,6 +81,8 @@ PROJ_FILES += $(wildcard $(OPENBLT_TRGT_DIR)/Source/*.c) PROJ_FILES += $(wildcard $(OPENBLT_TRGT_DIR)/Source/*.h) PROJ_FILES += $(PROJECT_DIR)/hw_layer/openblt/hooks.c +PROJ_FILES += $(PROJECT_DIR)/hw_layer/openblt/led.c +PROJ_FILES += $(PROJECT_DIR)/hw_layer/openblt/led.h # CPU-dependent sources ifeq ($(PROJECT_CPU),ARCH_STM32F4)