From 0d645c30bb1521b12890cf8cbcc83664b116f943 Mon Sep 17 00:00:00 2001 From: key Date: Tue, 21 Dec 2021 11:11:19 +0100 Subject: [PATCH] Edwin the variable that you commented for Cmake is currenly not implmeted Errors were generated due to the missing IFDEF __CPP__ wrappers on the .h Files --- CMakeLists.txt | 2 +- bsl/csl/interfaces/timer.h | 12 ++++++++++ .../stm32f042/Device/hardwareDescription.h | 23 +++++++++++++++---- bsl/csl/stm32f042/Src/timer.c | 1 - bsl/csl/stm32f042/Src/usart.c | 1 - bsl/nucleo_f042k6/bslConfig.cmake | 2 +- 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c6a7fc..97a1ef9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ add_subdirectory(utils) add_subdirectory(bsl) #set(BSL_HEADER_FILE ${CMAKE_SOURCE_DIR}/bsl/raspberry/bsl_raspberry.hpp) -set(BSL_HEADER_FILE ${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/bsl_nucleo_f042k6.hpp) +#set(BSL_HEADER_FILE ${CMAKE_SOURCE_DIR}/bsl/nucleo_f042k6/bsl_nucleo_f042k6.hpp) message("${BoldBlue}Project Info ${ColourReset}") message("${Blue} |--> Exec Name \t: ${EXECUTABLE} ${ColourReset}") diff --git a/bsl/csl/interfaces/timer.h b/bsl/csl/interfaces/timer.h index ee2befa..ee03756 100644 --- a/bsl/csl/interfaces/timer.h +++ b/bsl/csl/interfaces/timer.h @@ -15,6 +15,13 @@ ************************************************************************************************** */ +#ifndef _TIMER_H_ +#define _TIMER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + #include "hardwareDescription.h" typedef enum { @@ -58,3 +65,8 @@ uint32_t timerGetCount(timerNo_t timer); void timerThrowError(timerError_t error); +#ifdef __cplusplus +} +#endif + +#endif // _TIMER_H_ diff --git a/bsl/csl/stm32f042/Device/hardwareDescription.h b/bsl/csl/stm32f042/Device/hardwareDescription.h index 51d36fd..660c307 100644 --- a/bsl/csl/stm32f042/Device/hardwareDescription.h +++ b/bsl/csl/stm32f042/Device/hardwareDescription.h @@ -16,7 +16,15 @@ ************************************************************************************************** */ +#ifndef _hardwareDescription_H_ +#define _hardwareDescription_H_ + +#ifdef __cplusplus +extern "C" { +#endif + #include "stm32f042x6.h" +#include #define PACKAGE_LQFP32 1 @@ -154,11 +162,12 @@ typedef enum { /*! * Enum for awailable clok sources RM Page: 95 * */ + typedef enum { - HSI, /*!< High speed internal */ - HSE, /*!< High speed external */ - LSI, /*!< Low speed internal */ - LSE /*!< Low speed External */ + CLK_HSI, /*!< High speed internal */ + CLK_HSE, /*!< High speed external */ + CLK_LSI, /*!< Low speed internal */ + CLK_LSE /*!< Low speed External */ }clkSources_t; /*! @@ -193,3 +202,9 @@ static const uint8_t timerBus_No[MAX_TIMER_CHANNEL_COUNT] = { 2, 2 }; + +#ifdef __cplusplus +} +#endif + +#endif // _hardwareDescription_H_ diff --git a/bsl/csl/stm32f042/Src/timer.c b/bsl/csl/stm32f042/Src/timer.c index 8475fc9..e033787 100644 --- a/bsl/csl/stm32f042/Src/timer.c +++ b/bsl/csl/stm32f042/Src/timer.c @@ -51,7 +51,6 @@ void timerSetAutoReload(timerNo_t timer, uint32_t reload) void timerClearCounter(timerNo_t timer) { - BASE->CNT = 0; } diff --git a/bsl/csl/stm32f042/Src/usart.c b/bsl/csl/stm32f042/Src/usart.c index c86f12b..ccbc835 100644 --- a/bsl/csl/stm32f042/Src/usart.c +++ b/bsl/csl/stm32f042/Src/usart.c @@ -22,7 +22,6 @@ #include "usart.h" #include "pin.h" -#include "stm32f042x6.h" #define SYST_CLK 8000000 diff --git a/bsl/nucleo_f042k6/bslConfig.cmake b/bsl/nucleo_f042k6/bslConfig.cmake index 0c7695e..e4c16b0 100644 --- a/bsl/nucleo_f042k6/bslConfig.cmake +++ b/bsl/nucleo_f042k6/bslConfig.cmake @@ -76,5 +76,5 @@ list(APPEND EXTRA_LIBS sub::translator) list(APPEND EXTRA_LIBS sub::delay) list(APPEND EXTRA_LIBS sub::pin) list(APPEND EXTRA_LIBS sub::usart) -list(APPEND EXTRA_LIBS sub::init) list(APPEND EXTRA_LIBS sub::timer) +list(APPEND EXTRA_LIBS sub::init)