Skip to content

Commit 4fa9d97

Browse files
committed
stmhal/servo: Don't compile servo code when it's not enabled.
1 parent 9cca14a commit 4fa9d97

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

stmhal/servo.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include "timer.h"
3434
#include "servo.h"
3535

36+
#if MICROPY_HW_ENABLE_SERVO
37+
3638
// This file implements the pyb.Servo class which controls standard hobby servo
3739
// motors that have 3-wires (ground, power, signal).
3840
//
@@ -328,3 +330,5 @@ const mp_obj_type_t pyb_servo_type = {
328330
.make_new = pyb_servo_make_new,
329331
.locals_dict = (mp_obj_dict_t*)&pyb_servo_locals_dict,
330332
};
333+
334+
#endif // MICROPY_HW_ENABLE_SERVO

stmhal/timer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,11 @@ TIM_HandleTypeDef *timer_tim6_init(uint freq) {
216216

217217
// Interrupt dispatch
218218
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
219+
#if MICROPY_HW_ENABLE_SERVO
219220
if (htim == &TIM5_Handle) {
220221
servo_timer_irq_callback();
221222
}
223+
#endif
222224
}
223225

224226
// Get the frequency (in Hz) of the source clock for the given timer.

0 commit comments

Comments
 (0)