Skip to content

Commit 46705b7

Browse files
committed
Add support for hal overloading on stm32g4, cleanup index to injected rank util
1 parent 6c36005 commit 46705b7

5 files changed

Lines changed: 5 additions & 10 deletions

File tree

src/current_sense/hardware_specific/stm32/stm32_adc_utils.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,29 +417,24 @@ uint32_t _getADCChannel(PinName pin, ADC_TypeDef *AdcHandle )
417417

418418
uint32_t _getADCInjectedRank(uint8_t ind){
419419
switch (ind) {
420-
#ifdef ADC_INJECTED_RANK_1
420+
#ifdef ADC_INJECTED_RANK_1
421421
case 0:
422422
return ADC_INJECTED_RANK_1;
423-
break;
424423
#endif
425424
#ifdef ADC_INJECTED_RANK_2
426425
case 1:
427426
return ADC_INJECTED_RANK_2;
428-
break;
429427
#endif
430428
#ifdef ADC_INJECTED_RANK_3
431429
case 2:
432430
return ADC_INJECTED_RANK_3;
433-
break;
434431
#endif
435432
#ifdef ADC_INJECTED_RANK_4
436433
case 3:
437434
return ADC_INJECTED_RANK_4;
438-
break;
439435
#endif
440436
default:
441437
return 0;
442-
break;
443438
}
444439
}
445440

src/current_sense/hardware_specific/stm32/stm32_mcu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
#include "../../hardware_api.h"
33

4-
#if defined(_STM32_DEF_) and !defined(ARDUINO_B_G431B_ESC1)
4+
#if defined(_STM32_DEF_) and !defined(ARDUINO_B_G431B_ESC1) && !defined(SIMPLEFOC_HAL_OVERRIDE)
55

66
#include "stm32_mcu.h"
77

src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_hal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "stm32g4_hal.h"
22

3-
#if defined(STM32G4xx) && !defined(ARDUINO_B_G431B_ESC1)
3+
#if defined(STM32G4xx) && !defined(ARDUINO_B_G431B_ESC1) && !defined(SIMPLEFOC_HAL_OVERRIDE)
44

55
#include "../../../../communication/SimpleFOCDebug.h"
66

src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_hal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "Arduino.h"
55

6-
#if defined(STM32G4xx) && !defined(ARDUINO_B_G431B_ESC1)
6+
#if defined(STM32G4xx) && !defined(ARDUINO_B_G431B_ESC1) && !defined(SIMPLEFOC_HAL_OVERRIDE)
77

88
#include "stm32g4xx_hal.h"
99
#include "../stm32_mcu.h"

src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_mcu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "../../../hardware_api.h"
22

3-
#if defined(STM32G4xx) && !defined(ARDUINO_B_G431B_ESC1)
3+
#if defined(STM32G4xx) && !defined(ARDUINO_B_G431B_ESC1) && !defined(SIMPLEFOC_HAL_OVERRIDE)
44

55
#include "../../../../common/foc_utils.h"
66
#include "../../../../drivers/hardware_api.h"

0 commit comments

Comments
 (0)