Skip to content

Commit d75f873

Browse files
Merge pull request #247 from HyperloopUPV-H8/development
v2.1.0
2 parents 94daf7a + 3fdd0e7 commit d75f873

8 files changed

Lines changed: 63 additions & 37 deletions

File tree

.cproject

Lines changed: 12 additions & 36 deletions
Large diffs are not rendered by default.

.vscode/c_cpp_properties.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Linux",
5+
"includePath": [
6+
"${workspaceFolder}/**"
7+
],
8+
"defines": [],
9+
"compilerPath": "/usr/bin/gcc",
10+
"cStandard": "c17",
11+
"cppStandard": "c++20",
12+
"intelliSenseMode": "linux-gcc-x64",
13+
"configurationProvider": "ms-vscode.cmake-tools",
14+
"compileCommands": "compile_commands.json"
15+
}
16+
],
17+
"version": 4
18+
}

.vscode/settings.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"files.exclude": {
3+
"**/.cache": true,
4+
"**/.cproject": true,
5+
"**/.gitignore": true,
6+
"**/.mxproject": true,
7+
"**/.project": true,
8+
"**/.settings": true,
9+
"**/arm-none-eabi.cmake": true,
10+
"**/build": true,
11+
"**/cmake_install.cmake": true,
12+
"**/CMakeFiles": true,
13+
"**/CMakeLists.txt": true,
14+
"**/compile_commands.json": true,
15+
"**/Debug": true,
16+
"**/libst-lib.a": true,
17+
"**/Makefile": true
18+
},
19+
"C_Cpp.default.cppStandard": "c++20",
20+
"C_Cpp.default.cStandard": "c17"
21+
}

Inc/HALAL/Services/PWM/PWM/PWM.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class PWM {
1818
TimerPeripheral* peripheral;
1919
uint32_t channel;
2020
float duty_cycle;
21+
uint32_t frequency;
2122

2223
PWM() = default;
2324

@@ -28,6 +29,7 @@ class PWM {
2829
void turn_off();
2930
void set_duty_cycle(float duty_cycle);
3031
void set_frequency(uint32_t frequency);
32+
uint32_t get_frequency();
3133

3234
friend class DualPWM;
3335
friend class PhasedPWM;

Inc/ST-LIB_LOW/HalfBridge/HalfBridge.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class HalfBridge {
2424
void set_duty_cycle(float duty_cycle);
2525
void set_frequency(int32_t frequency);
2626
void set_phase(float phase);
27+
float get_phase();
2728

2829
private:
2930
bool is_dual;

Src/HALAL/Models/HALconfig/Halconfig.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ void HALconfig::system_clock() {
4545
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
4646
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
4747
RCC_OscInitStruct.PLL.PLLFRACN = 0;
48-
4948
#else
5049
static_assert(false, "No TARGET is choosen. Choose NUCLEO or BOARD");
5150
#endif

Src/HALAL/Services/PWM/PWM/PWM.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ void PWM::set_duty_cycle(float duty_cycle) {
4949
}
5050

5151
void PWM::set_frequency(uint32_t frequency) {
52+
this->frequency = frequency;
5253
TIM_TypeDef& timer = *peripheral->handle->Instance;
5354
timer.ARR = (HAL_RCC_GetPCLK1Freq()*2 / (timer.PSC+1)) / frequency;
5455
set_duty_cycle(duty_cycle);
5556
}
57+
58+
uint32_t PWM::get_frequency() {
59+
return frequency;
60+
}

Src/ST-LIB_LOW/HalfBridge/HalfBridge.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ void HalfBridge::set_phase(float phase) {
4545
positive_pwm.set_phase(phase);
4646
negative_pwm.set_phase(-phase);
4747
}
48+
49+
float HalfBridge::get_phase() {
50+
return positive_pwm.phase;
51+
}

0 commit comments

Comments
 (0)