diff --git a/.cproject b/.cproject index bff09a61..29e995c6 100644 --- a/.cproject +++ b/.cproject @@ -35,6 +35,7 @@ + @@ -57,6 +58,7 @@ + @@ -74,11 +76,6 @@ - - - - - @@ -86,9 +83,9 @@ - + @@ -120,20 +117,13 @@ - - - - - - - - + @@ -218,19 +208,16 @@ - - - + + + + - - - - @@ -238,7 +225,6 @@ - @@ -246,10 +232,10 @@ - + @@ -264,15 +250,11 @@ - - - - @@ -361,20 +343,14 @@ + - + - - - - - - - + - \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 00000000..ccf54aba --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/usr/bin/gcc", + "cStandard": "c17", + "cppStandard": "c++20", + "intelliSenseMode": "linux-gcc-x64", + "configurationProvider": "ms-vscode.cmake-tools", + "compileCommands": "compile_commands.json" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..da03cd5a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,21 @@ +{ + "files.exclude": { + "**/.cache": true, + "**/.cproject": true, + "**/.gitignore": true, + "**/.mxproject": true, + "**/.project": true, + "**/.settings": true, + "**/arm-none-eabi.cmake": true, + "**/build": true, + "**/cmake_install.cmake": true, + "**/CMakeFiles": true, + "**/CMakeLists.txt": true, + "**/compile_commands.json": true, + "**/Debug": true, + "**/libst-lib.a": true, + "**/Makefile": true + }, + "C_Cpp.default.cppStandard": "c++20", + "C_Cpp.default.cStandard": "c17" +} \ No newline at end of file diff --git a/Inc/HALAL/Services/PWM/PWM/PWM.hpp b/Inc/HALAL/Services/PWM/PWM/PWM.hpp index 3b98ec68..b1199b12 100644 --- a/Inc/HALAL/Services/PWM/PWM/PWM.hpp +++ b/Inc/HALAL/Services/PWM/PWM/PWM.hpp @@ -18,6 +18,7 @@ class PWM { TimerPeripheral* peripheral; uint32_t channel; float duty_cycle; + uint32_t frequency; PWM() = default; @@ -28,6 +29,7 @@ class PWM { void turn_off(); void set_duty_cycle(float duty_cycle); void set_frequency(uint32_t frequency); + uint32_t get_frequency(); friend class DualPWM; friend class PhasedPWM; diff --git a/Inc/ST-LIB_LOW/HalfBridge/HalfBridge.hpp b/Inc/ST-LIB_LOW/HalfBridge/HalfBridge.hpp index 72edef87..e408e54d 100644 --- a/Inc/ST-LIB_LOW/HalfBridge/HalfBridge.hpp +++ b/Inc/ST-LIB_LOW/HalfBridge/HalfBridge.hpp @@ -24,6 +24,7 @@ class HalfBridge { void set_duty_cycle(float duty_cycle); void set_frequency(int32_t frequency); void set_phase(float phase); + float get_phase(); private: bool is_dual; diff --git a/Src/HALAL/Models/HALconfig/Halconfig.cpp b/Src/HALAL/Models/HALconfig/Halconfig.cpp index 1f4dab64..a69cf372 100644 --- a/Src/HALAL/Models/HALconfig/Halconfig.cpp +++ b/Src/HALAL/Models/HALconfig/Halconfig.cpp @@ -45,7 +45,6 @@ void HALconfig::system_clock() { RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2; RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE; RCC_OscInitStruct.PLL.PLLFRACN = 0; - #else static_assert(false, "No TARGET is choosen. Choose NUCLEO or BOARD"); #endif diff --git a/Src/HALAL/Services/PWM/PWM/PWM.cpp b/Src/HALAL/Services/PWM/PWM/PWM.cpp index 59996fe4..37f4c2c4 100644 --- a/Src/HALAL/Services/PWM/PWM/PWM.cpp +++ b/Src/HALAL/Services/PWM/PWM/PWM.cpp @@ -49,7 +49,12 @@ void PWM::set_duty_cycle(float duty_cycle) { } void PWM::set_frequency(uint32_t frequency) { + this->frequency = frequency; TIM_TypeDef& timer = *peripheral->handle->Instance; timer.ARR = (HAL_RCC_GetPCLK1Freq()*2 / (timer.PSC+1)) / frequency; set_duty_cycle(duty_cycle); } + +uint32_t PWM::get_frequency() { + return frequency; +} diff --git a/Src/ST-LIB_LOW/HalfBridge/HalfBridge.cpp b/Src/ST-LIB_LOW/HalfBridge/HalfBridge.cpp index 9164c9e9..46c967e1 100644 --- a/Src/ST-LIB_LOW/HalfBridge/HalfBridge.cpp +++ b/Src/ST-LIB_LOW/HalfBridge/HalfBridge.cpp @@ -45,3 +45,7 @@ void HalfBridge::set_phase(float phase) { positive_pwm.set_phase(phase); negative_pwm.set_phase(-phase); } + +float HalfBridge::get_phase() { + return positive_pwm.phase; +} \ No newline at end of file