Skip to content

Commit 43ea8cb

Browse files
committed
chore(servo): add HAL v2 support
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 90c185d commit 43ea8cb

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎libraries/Servo/src/stm32/Servo.cpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
#include <Servo.h>
2020
#include <HardwareTimer.h>
2121

22-
#if defined(HAL_TIM_MODULE_ENABLED) && defined(TIMER_SERVO) && !defined(HAL_TIM_MODULE_ONLY)
22+
#if defined(TIMER_SERVO) && !defined(HAL_TIM_MODULE_ONLY) &&\
23+
(defined(HAL_TIM_MODULE_ENABLED) || (defined(USE_HAL_TIM_MODULE) && (USE_HAL_TIM_MODULE == 1)))
2324

2425
static servo_t servos[MAX_SERVOS]; // static array of servo structures
2526
static volatile int8_t timerChannel[_Nbr_16timers] = {-1}; // counter for the servo being pulsed for each timer (or -1 if refresh interval)
@@ -196,7 +197,7 @@ bool Servo::attached()
196197

197198
#else
198199

199-
#warning "TIMER_TONE or HAL_TIM_MODULE_ENABLED not defined"
200+
#warning "TIMER_TONE or HAL_TIM_MODULE_ENABLED or USE_HAL_TIM_MODULE set to 1 not defined"
200201
Servo::Servo() {}
201202
uint8_t Servo::attach(pin_size_t pin)
202203
{
@@ -229,4 +230,4 @@ int Servo::readMicroseconds()
229230
}
230231
bool Servo::attached() {}
231232

232-
#endif /* HAL_TIM_MODULE_ENABLED && TIMER_SERVO & !HAL_TIM_MODULE_ONLY */
233+
#endif /* TIMER_SERVO && !HAL_TIM_MODULE_ONLY && (HAL_TIM_MODULE_ENABLED || USE_HAL_TIM_MODULE...) */

0 commit comments

Comments
 (0)