fucntion in C++ in CUBEide

I am trying to write a function in c for stm32 board. float computeMotorSpeed(TIM_HandleTypeDef &htimer, uint32_t &PreviousCount ) { int32_t DiffCount = 0; uint32_t CurrentCount = 0; CurrentCount = __HAL_TIM_GET_COUNTER(&htimer); /*evaluate increment of timer counter from previous count*/ if (__HAL_TIM_IS_TIM_COUNTING_DOWN(&htimer)) { /* check for counter underflow */ if (CurrentCount <= PreviousCount) { DiffCount = CurrentCount… Read More fucntion in C++ in CUBEide

How do I break, from outside of a loop in C?

I have a code: void core() { loop { first_process(); secound_process(); process_synchronizer(); } some_other_job(); } In the process suynchronizer() I evaluate synchronization and if the criterion has not beeing satisfied it will break the loop. The problem is the break is not allowed in that function since it’s not in the loop. void process_synchronizer() {… Read More How do I break, from outside of a loop in C?

How can I apply target-specific compiler and linker flags to subdirectories in CMake?

I am using CMake for a STM32 project as the project is outgrowing a plain Makefile. My directory structure looks something like what’s below. I have an executable defined in the root CMakeLists.txt and somelib compiled as an OBJECT library which is added to the main CMakeLists.txt using add_subdirectory. CMakeLists.txt src/ ├─ app/ │ ├─… Read More How can I apply target-specific compiler and linker flags to subdirectories in CMake?