From bd10771e7d03a2f803244f747f1a5805690ea13f Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sat, 21 Oct 2023 14:51:02 -0300 Subject: [PATCH 01/14] =?UTF-8?q?=F0=9F=94=A7=20Update=20CMakeLists=20to?= =?UTF-8?q?=20cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22a19c5..5a1be98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(CMAKE_C_STANDARD 11) set(CMAKE_BUILD_TYPE Debug) # Cube file name without .ioc extension -project(stm32_project_template C ASM) +project(stm32_project_template C CXX ASM) # Set the board version to an empty string if your board doesn't have a version set(BOARD_VERSION "") @@ -125,12 +125,12 @@ set(TEST_INCLUDE_DIRECTORIES ## Input files ############################################################################### -file(GLOB_RECURSE C_SOURCES CONFIGURE_DEPENDS "src/*.c") -file(GLOB_RECURSE C_HEADERS CONFIGURE_DEPENDS "inc/*.h") +file(GLOB_RECURSE C_SOURCES CONFIGURE_DEPENDS "src/*.cpp") +file(GLOB_RECURSE C_HEADERS CONFIGURE_DEPENDS "inc/*.hpp") -file(GLOB_RECURSE TESTS_SOURCES CONFIGURE_DEPENDS "tests/src/*.c") -file(GLOB_RECURSE TESTS_HEADERS CONFIGURE_DEPENDS "tests/inc/*.h") -file(GLOB_RECURSE TESTS_BIN CONFIGURE_DEPENDS "tests/bin/*.c") +file(GLOB_RECURSE TESTS_SOURCES CONFIGURE_DEPENDS "tests/src/*.cpp") +file(GLOB_RECURSE TESTS_HEADERS CONFIGURE_DEPENDS "tests/inc/*.hpp") +file(GLOB_RECURSE TESTS_BIN CONFIGURE_DEPENDS "tests/bin/*.cpp") file(GLOB_RECURSE CUBE_SOURCES CONFIGURE_DEPENDS "cube/Src/*.c") @@ -184,12 +184,12 @@ targets_generate_helpme_target() ## Generate test executables ############################################################################### -# Since each test has its own main function, we don't need the main.c from the project -list(REMOVE_ITEM C_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c) +# Since each test has its own main function, we don't need the main.cpp from the project +list(REMOVE_ITEM C_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp) foreach(TEST_FILE ${TESTS_BIN}) - # If TEST_FILE contains /dir1/dir2/file.c, TEST_NAME will be 'file' + # If TEST_FILE contains /dir1/dir2/file.cpp, TEST_NAME will be 'file' get_filename_component(TEST_NAME ${TEST_FILE} NAME_WLE) add_executable(${TEST_NAME} EXCLUDE_FROM_ALL From 0050396406c871a6b27a24ec42b8f752cde60382 Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sat, 21 Oct 2023 14:51:20 -0300 Subject: [PATCH 02/14] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20cube?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cube/stm32_project_template.ioc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cube/stm32_project_template.ioc b/cube/stm32_project_template.ioc index b4efc92..3e57cc9 100644 --- a/cube/stm32_project_template.ioc +++ b/cube/stm32_project_template.ioc @@ -32,8 +32,8 @@ Mcu.PinsNb=14 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F303RETx -MxCube.Version=6.9.0 -MxDb.Version=DB.6.0.90 +MxCube.Version=6.9.1 +MxDb.Version=DB.6.0.91 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:false\:true\:false\:false NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:false\:true\:false\:false NVIC.ForceEnableDMAVector=true From f93583d31ae2a78fc410b734e4988ce4e7818007 Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sat, 21 Oct 2023 14:55:39 -0300 Subject: [PATCH 03/14] =?UTF-8?q?=E2=9C=A8=20Migrate=20mcu=20utility=20to?= =?UTF-8?q?=20cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/mcu.h | 39 -------------------------------- inc/mcu.hpp | 48 ++++++++++++++++++++++++++++++++++++++++ src/{main.c => main.cpp} | 16 ++++++++------ src/{mcu.c => mcu.cpp} | 11 +++++---- 4 files changed, 64 insertions(+), 50 deletions(-) delete mode 100644 inc/mcu.h create mode 100644 inc/mcu.hpp rename src/{main.c => main.cpp} (57%) rename src/{mcu.c => mcu.cpp} (75%) diff --git a/inc/mcu.h b/inc/mcu.h deleted file mode 100644 index 3d09bf9..0000000 --- a/inc/mcu.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file mcu.h - * - * @brief MCU related - */ - -#ifndef __MCU_H__ -#define __MCU_H__ - -#include - -/***************************************** - * Public Function Prototypes - *****************************************/ - -/** - * @brief Initializes MCU and some peripherals. - */ -void mcu_init(void); - -/** - * @brief Initializes System Clock. - * @note Defined by cube. - */ -void SystemClock_Config(void); - -/** - * @brief Put the MCU to sleep. - * - * @param ms Sleep time in milliseconds - */ -void mcu_sleep(uint32_t ms); - -/** - * @brief Toggles LED. - */ -void led_toggle(void); - -#endif // __MCU_H__ diff --git a/inc/mcu.hpp b/inc/mcu.hpp new file mode 100644 index 0000000..3cbf375 --- /dev/null +++ b/inc/mcu.hpp @@ -0,0 +1,48 @@ +/** + * @file mcu.h + * + * @brief MCU related + */ + +#ifndef __MCU_H__ +#define __MCU_H__ + +#include + +/***************************************** + * Public Function Prototypes + *****************************************/ + +extern "C" +{ + /** + * @brief Initializes System Clock. + * @note Defined by cube. + */ + void SystemClock_Config(void); +} + +namespace hal +{ + class mcu + { + public: + /** + * @brief Initializes MCU and some peripherals. + */ + static void init(void); + + /** + * @brief Put the MCU to sleep. + * + * @param ms Sleep time in milliseconds + */ + static void sleep(uint32_t ms); + + /** + * @brief Toggles LED. + */ + static void led_toggle(void); + }; +}; +#endif // __MCU_H__ diff --git a/src/main.c b/src/main.cpp similarity index 57% rename from src/main.c rename to src/main.cpp index 90f8109..c4dedd4 100644 --- a/src/main.c +++ b/src/main.cpp @@ -4,23 +4,25 @@ * @brief Main function */ -#include "mcu.h" +#include "mcu.hpp" /***************************************** * Private Constant Definitions *****************************************/ -#define LED_TOGGLE_DELAY_MS 1500 +static constexpr uint16_t led_toggle_delay_ms = 1500; /***************************************** * Main Function *****************************************/ -int main(void) { - mcu_init(); +int main(void) +{ + hal::mcu::init(); - for (;;) { - led_toggle(); - mcu_sleep(LED_TOGGLE_DELAY_MS); + for (;;) + { + hal::mcu::led_toggle(); + hal::mcu::sleep(led_toggle_delay_ms); } } diff --git a/src/mcu.c b/src/mcu.cpp similarity index 75% rename from src/mcu.c rename to src/mcu.cpp index 12b6877..eae3b03 100644 --- a/src/mcu.c +++ b/src/mcu.cpp @@ -6,7 +6,7 @@ #include -#include "mcu.h" +#include "mcu.hpp" #include "gpio.h" #include "main.h" @@ -15,7 +15,8 @@ * Public Function Body Definitions *****************************************/ -void mcu_init(void) { +void hal::mcu::init(void) +{ HAL_Init(); SystemClock_Config(); @@ -23,10 +24,12 @@ void mcu_init(void) { MX_GPIO_Init(); } -void mcu_sleep(uint32_t ms) { +void hal::mcu::sleep(uint32_t ms) +{ HAL_Delay(ms); } -void led_toggle(void) { +void hal::mcu::led_toggle(void) +{ HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5); } From aa33fbb2833af6b7153493192b12eeea773335c8 Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sat, 21 Oct 2023 14:56:35 -0300 Subject: [PATCH 04/14] =?UTF-8?q?=F0=9F=93=9D=20Update=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e1fa8d..a8ee989 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Para isso é necessário mudar o nome do projeto, o qual deve ter o mesmo do arq ```c # Cube file name without .ioc extension -project(stm32_project_template C ASM) +project(stm32_project_template C CXX ASM) ``` > Os argumentos `C` e `ASM` estão relacionados ao tipo de linguagem que o projeto utiliza (C e Assembly). From b0b82483d5aa2d85157477dd068cd326ada375e3 Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sat, 21 Oct 2023 15:19:18 -0300 Subject: [PATCH 05/14] =?UTF-8?q?=F0=9F=93=9D=20Update=20file=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/mcu.hpp | 2 +- src/main.cpp | 2 +- src/mcu.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/mcu.hpp b/inc/mcu.hpp index 3cbf375..cb5ea2d 100644 --- a/inc/mcu.hpp +++ b/inc/mcu.hpp @@ -1,5 +1,5 @@ /** - * @file mcu.h + * @file mcu.hpp * * @brief MCU related */ diff --git a/src/main.cpp b/src/main.cpp index c4dedd4..2ebd573 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ /** - * @file main.c + * @file main.cpp * * @brief Main function */ diff --git a/src/mcu.cpp b/src/mcu.cpp index eae3b03..3cc472d 100644 --- a/src/mcu.cpp +++ b/src/mcu.cpp @@ -1,5 +1,5 @@ /** - * @file mcu.c + * @file mcu.cpp * * @brief MCU related */ From 281e42cfe56ea67febbda5e2cc4cef5e14570110 Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sat, 21 Oct 2023 15:19:51 -0300 Subject: [PATCH 06/14] =?UTF-8?q?=E2=9C=A8=20Update=20tests=20to=20CPP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/bin/{test_main.c => test_main.cpp} | 10 ++++++---- tests/inc/{test_core.h => test_core.hpp} | 2 +- tests/src/{test_core.c => test_core.cpp} | 11 ++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) rename tests/bin/{test_main.c => test_main.cpp} (53%) rename tests/inc/{test_core.h => test_core.hpp} (94%) rename tests/src/{test_core.c => test_core.cpp} (66%) diff --git a/tests/bin/test_main.c b/tests/bin/test_main.cpp similarity index 53% rename from tests/bin/test_main.c rename to tests/bin/test_main.cpp index 4cc9e4b..c581fb3 100644 --- a/tests/bin/test_main.c +++ b/tests/bin/test_main.cpp @@ -1,15 +1,17 @@ /** - * @file test_main.c + * @file test_main.cpp * * @brief Main function for tests. */ #include -#include "tests_core.h" +#include "test_core.hpp" -int main(void) { +int main(void) +{ test_core_init(); - for (;;) { + for (;;) + { } } diff --git a/tests/inc/test_core.h b/tests/inc/test_core.hpp similarity index 94% rename from tests/inc/test_core.h rename to tests/inc/test_core.hpp index 058dc8b..e81243f 100644 --- a/tests/inc/test_core.h +++ b/tests/inc/test_core.hpp @@ -1,5 +1,5 @@ /** - * @file test_core.h + * @file test_core.hpp * * @brief Core functions to the test * diff --git a/tests/src/test_core.c b/tests/src/test_core.cpp similarity index 66% rename from tests/src/test_core.c rename to tests/src/test_core.cpp index 3387397..6072f59 100644 --- a/tests/src/test_core.c +++ b/tests/src/test_core.cpp @@ -1,5 +1,5 @@ /** - * @file test_core.c + * @file test_core.cpp * * @brief Core functions to the test * @@ -9,13 +9,14 @@ * */ -#include "test_core.h" -#include "mcu.h" +#include "test_core.hpp" +#include "mcu.hpp" /***************************************** * Public Functions Bodies Definitions *****************************************/ -void test_core_init(void) { - mcu_init(); +void test_core_init(void) +{ + hal::mcu::init(); } From 2b08065c0a815636e9355e74fda90bd178f0bd7a Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sun, 22 Oct 2023 16:22:57 -0300 Subject: [PATCH 07/14] =?UTF-8?q?=E2=9C=A8=20Readd=20C=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bruno1406 --- CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a1be98..fefdcc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,12 +125,12 @@ set(TEST_INCLUDE_DIRECTORIES ## Input files ############################################################################### -file(GLOB_RECURSE C_SOURCES CONFIGURE_DEPENDS "src/*.cpp") -file(GLOB_RECURSE C_HEADERS CONFIGURE_DEPENDS "inc/*.hpp") +file(GLOB_RECURSE C_SOURCES CONFIGURE_DEPENDS "src/*.cpp" "src/*.c") +file(GLOB_RECURSE C_HEADERS CONFIGURE_DEPENDS "inc/*.hpp" "inc/*.h") -file(GLOB_RECURSE TESTS_SOURCES CONFIGURE_DEPENDS "tests/src/*.cpp") -file(GLOB_RECURSE TESTS_HEADERS CONFIGURE_DEPENDS "tests/inc/*.hpp") -file(GLOB_RECURSE TESTS_BIN CONFIGURE_DEPENDS "tests/bin/*.cpp") +file(GLOB_RECURSE TESTS_SOURCES CONFIGURE_DEPENDS "tests/src/*.cpp" "tests/src/*.c") +file(GLOB_RECURSE TESTS_HEADERS CONFIGURE_DEPENDS "tests/inc/*.hpp" "tests/inc/*.h") +file(GLOB_RECURSE TESTS_BIN CONFIGURE_DEPENDS "tests/bin/*.cpp" "tests/bin/*.c") file(GLOB_RECURSE CUBE_SOURCES CONFIGURE_DEPENDS "cube/Src/*.c") @@ -185,7 +185,10 @@ targets_generate_helpme_target() ############################################################################### # Since each test has its own main function, we don't need the main.cpp from the project -list(REMOVE_ITEM C_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp) +list(REMOVE_ITEM C_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c +) foreach(TEST_FILE ${TESTS_BIN}) From 693fe59ef5c7de014358cfbf7b4f5c148c6ed8f0 Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sun, 22 Oct 2023 16:42:11 -0300 Subject: [PATCH 08/14] =?UTF-8?q?=F0=9F=94=A7=20Set=20uncrustify=20as=20de?= =?UTF-8?q?fault=20formatter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 3eaff06..a7fb1d5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,18 +2,16 @@ "editor.tabSize": 4, "editor.detectIndentation": false, "editor.insertSpaces": true, - "files.trimFinalNewlines": true, "files.trimTrailingWhitespace": true, "files.insertFinalNewline": true, "files.eol": "\n", "files.encoding": "utf8", + "editor.defaultFormatter": "zachflower.uncrustify", "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", - "[c]": { "editor.formatOnSave": true }, - "[markdown]": { "files.trimTrailingWhitespace": false, "files.trimFinalNewlines": false From 345a274fe93b20cf7fe54ef9a4b0ca994d09d3e6 Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sun, 22 Oct 2023 16:53:43 -0300 Subject: [PATCH 09/14] =?UTF-8?q?=F0=9F=8E=A8=20Function=20definitions=20i?= =?UTF-8?q?nside=20namespace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bruno1406 --- src/mcu.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mcu.cpp b/src/mcu.cpp index 3cc472d..b11fcff 100644 --- a/src/mcu.cpp +++ b/src/mcu.cpp @@ -15,8 +15,8 @@ * Public Function Body Definitions *****************************************/ -void hal::mcu::init(void) -{ +namespace hal { +void mcu::init(void) { HAL_Init(); SystemClock_Config(); @@ -24,12 +24,11 @@ void hal::mcu::init(void) MX_GPIO_Init(); } -void hal::mcu::sleep(uint32_t ms) -{ +void mcu::sleep(uint32_t ms) { HAL_Delay(ms); } -void hal::mcu::led_toggle(void) -{ +void mcu::led_toggle(void) { HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5); } +} From 545a38eaca72fd59485d6b361821f5cb783de943 Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Sun, 22 Oct 2023 16:54:06 -0300 Subject: [PATCH 10/14] =?UTF-8?q?=F0=9F=8E=A8=20Format=20with=20uncrustify?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/mcu.hpp | 18 ++++++++---------- src/main.cpp | 6 ++---- tests/bin/test_main.cpp | 6 ++---- tests/src/test_core.cpp | 3 +-- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/inc/mcu.hpp b/inc/mcu.hpp index cb5ea2d..223c8c4 100644 --- a/inc/mcu.hpp +++ b/inc/mcu.hpp @@ -15,17 +15,15 @@ extern "C" { - /** - * @brief Initializes System Clock. - * @note Defined by cube. - */ - void SystemClock_Config(void); +/** + * @brief Initializes System Clock. + * @note Defined by cube. + */ +void SystemClock_Config(void); } -namespace hal -{ - class mcu - { +namespace hal { +class mcu { public: /** * @brief Initializes MCU and some peripherals. @@ -43,6 +41,6 @@ namespace hal * @brief Toggles LED. */ static void led_toggle(void); - }; +}; }; #endif // __MCU_H__ diff --git a/src/main.cpp b/src/main.cpp index 2ebd573..98620eb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,12 +16,10 @@ static constexpr uint16_t led_toggle_delay_ms = 1500; * Main Function *****************************************/ -int main(void) -{ +int main(void) { hal::mcu::init(); - for (;;) - { + for (;;) { hal::mcu::led_toggle(); hal::mcu::sleep(led_toggle_delay_ms); } diff --git a/tests/bin/test_main.cpp b/tests/bin/test_main.cpp index c581fb3..76447bd 100644 --- a/tests/bin/test_main.cpp +++ b/tests/bin/test_main.cpp @@ -7,11 +7,9 @@ #include #include "test_core.hpp" -int main(void) -{ +int main(void) { test_core_init(); - for (;;) - { + for (;;) { } } diff --git a/tests/src/test_core.cpp b/tests/src/test_core.cpp index 6072f59..ed9f909 100644 --- a/tests/src/test_core.cpp +++ b/tests/src/test_core.cpp @@ -16,7 +16,6 @@ * Public Functions Bodies Definitions *****************************************/ -void test_core_init(void) -{ +void test_core_init(void) { hal::mcu::init(); } From fd43d6ccda8ca9d12a650bd6fe6bab58ece035bb Mon Sep 17 00:00:00 2001 From: Eduardo Santos Barreto Date: Mon, 30 Oct 2023 20:07:11 -0300 Subject: [PATCH 11/14] =?UTF-8?q?=F0=9F=93=9D=20Fix=20guard=20macros=20nam?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Lucas Haug <39196309+LucasHaug@users.noreply.github.com> --- inc/mcu.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/mcu.hpp b/inc/mcu.hpp index 223c8c4..b5834e9 100644 --- a/inc/mcu.hpp +++ b/inc/mcu.hpp @@ -4,8 +4,8 @@ * @brief MCU related */ -#ifndef __MCU_H__ -#define __MCU_H__ +#ifndef __MCU_HPP__ +#define __MCU_HPP__ #include From 66891682d583be90fb5c1e24202d9926d00eb63f Mon Sep 17 00:00:00 2001 From: Eduardo Santos Barreto Date: Mon, 30 Oct 2023 20:07:46 -0300 Subject: [PATCH 12/14] =?UTF-8?q?=F0=9F=93=9D=20Fix=20guard=20macros=20nam?= =?UTF-8?q?e=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Lucas Haug <39196309+LucasHaug@users.noreply.github.com> --- inc/mcu.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/mcu.hpp b/inc/mcu.hpp index b5834e9..b543948 100644 --- a/inc/mcu.hpp +++ b/inc/mcu.hpp @@ -43,4 +43,4 @@ class mcu { static void led_toggle(void); }; }; -#endif // __MCU_H__ +#endif // __MCU_HPP__ From 42f102d446305cc37ee7386b2570d8f1bbdab608 Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Mon, 30 Oct 2023 20:26:07 -0300 Subject: [PATCH 13/14] =?UTF-8?q?=F0=9F=A9=B9=20Rename=20C=5FThings=20to?= =?UTF-8?q?=20PROJECT=5FThings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fefdcc0..213c51c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,7 @@ set(LIB_INCLUDE_DIRECTORIES ## Include directories ############################################################################### -set(C_INCLUDE_DIRECTORIES +set(PROJECT_INCLUDE_DIRECTORIES ./inc ./cube/Inc ) @@ -125,8 +125,8 @@ set(TEST_INCLUDE_DIRECTORIES ## Input files ############################################################################### -file(GLOB_RECURSE C_SOURCES CONFIGURE_DEPENDS "src/*.cpp" "src/*.c") -file(GLOB_RECURSE C_HEADERS CONFIGURE_DEPENDS "inc/*.hpp" "inc/*.h") +file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "src/*.cpp" "src/*.c") +file(GLOB_RECURSE PROJECT_HEADERS CONFIGURE_DEPENDS "inc/*.hpp" "inc/*.h") file(GLOB_RECURSE TESTS_SOURCES CONFIGURE_DEPENDS "tests/src/*.cpp" "tests/src/*.c") file(GLOB_RECURSE TESTS_HEADERS CONFIGURE_DEPENDS "tests/inc/*.hpp" "tests/inc/*.h") @@ -142,7 +142,7 @@ list(REMOVE_ITEM CUBE_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cube/Src/system_${DEVI set(FORCED_INCLUDE_HEADERS ) -targets_generate_format_target(C_SOURCES C_HEADERS TESTS_SOURCES TESTS_HEADERS TESTS_BIN) +targets_generate_format_target(PROJECT_SOURCES PROJECT_HEADERS TESTS_SOURCES TESTS_HEADERS TESTS_BIN) ############################################################################### ## Main executable target @@ -150,12 +150,12 @@ targets_generate_format_target(C_SOURCES C_HEADERS TESTS_SOURCES TESTS_HEADERS T add_executable(${PROJECT_NAME} ${CUBE_SOURCES} - ${C_SOURCES} + ${PROJECT_SOURCES} ${LIB_SOURCES} ) target_include_directories(${PROJECT_NAME} PUBLIC - ${C_INCLUDE_DIRECTORIES} + ${PROJECT_INCLUDE_DIRECTORIES} ${LIB_INCLUDE_DIRECTORIES} ${CMSIS_INCLUDE_DIRS} ${HAL_INCLUDE_DIRS} @@ -185,7 +185,7 @@ targets_generate_helpme_target() ############################################################################### # Since each test has its own main function, we don't need the main.cpp from the project -list(REMOVE_ITEM C_SOURCES +list(REMOVE_ITEM PROJECT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c ) @@ -198,13 +198,13 @@ foreach(TEST_FILE ${TESTS_BIN}) add_executable(${TEST_NAME} EXCLUDE_FROM_ALL ${TEST_FILE} ${CUBE_SOURCES} - ${C_SOURCES} + ${PROJECT_SOURCES} ${TESTS_SOURCES} ${LIB_SOURCES} ) target_include_directories(${TEST_NAME} PUBLIC - ${C_INCLUDE_DIRECTORIES} + ${PROJECT_INCLUDE_DIRECTORIES} ${LIB_INCLUDE_DIRECTORIES} ${CMSIS_INCLUDE_DIRS} ${HAL_INCLUDE_DIRS} From c6497cd7351aedd14eb2e1b96bfa710a9b8d005d Mon Sep 17 00:00:00 2001 From: Eduardo-Barreto Date: Fri, 23 Feb 2024 10:26:30 -0300 Subject: [PATCH 14/14] =?UTF-8?q?=F0=9F=94=A5=20Remove=20mcu=20led=20toggl?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cube/stm32_project_template.ioc | 4 ++-- inc/mcu.hpp | 5 ----- src/main.cpp | 1 - src/mcu.cpp | 4 ---- 4 files changed, 2 insertions(+), 12 deletions(-) diff --git a/cube/stm32_project_template.ioc b/cube/stm32_project_template.ioc index 3e57cc9..c5eaea7 100644 --- a/cube/stm32_project_template.ioc +++ b/cube/stm32_project_template.ioc @@ -32,8 +32,8 @@ Mcu.PinsNb=14 Mcu.ThirdPartyNb=0 Mcu.UserConstants= Mcu.UserName=STM32F303RETx -MxCube.Version=6.9.1 -MxDb.Version=DB.6.0.91 +MxCube.Version=6.10.0 +MxDb.Version=DB.6.0.100 NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:false\:true\:false\:false NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:false\:true\:false\:false NVIC.ForceEnableDMAVector=true diff --git a/inc/mcu.hpp b/inc/mcu.hpp index b543948..168a505 100644 --- a/inc/mcu.hpp +++ b/inc/mcu.hpp @@ -36,11 +36,6 @@ class mcu { * @param ms Sleep time in milliseconds */ static void sleep(uint32_t ms); - - /** - * @brief Toggles LED. - */ - static void led_toggle(void); }; }; #endif // __MCU_HPP__ diff --git a/src/main.cpp b/src/main.cpp index 98620eb..94baf12 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,7 +20,6 @@ int main(void) { hal::mcu::init(); for (;;) { - hal::mcu::led_toggle(); hal::mcu::sleep(led_toggle_delay_ms); } } diff --git a/src/mcu.cpp b/src/mcu.cpp index b11fcff..35df8e2 100644 --- a/src/mcu.cpp +++ b/src/mcu.cpp @@ -27,8 +27,4 @@ void mcu::init(void) { void mcu::sleep(uint32_t ms) { HAL_Delay(ms); } - -void mcu::led_toggle(void) { - HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5); -} }