Commit 4fa9d97e authored by Damien George's avatar Damien George

stmhal/servo: Don't compile servo code when it's not enabled.

parent 9cca14a5
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "timer.h" #include "timer.h"
#include "servo.h" #include "servo.h"
#if MICROPY_HW_ENABLE_SERVO
// This file implements the pyb.Servo class which controls standard hobby servo // This file implements the pyb.Servo class which controls standard hobby servo
// motors that have 3-wires (ground, power, signal). // motors that have 3-wires (ground, power, signal).
// //
...@@ -328,3 +330,5 @@ const mp_obj_type_t pyb_servo_type = { ...@@ -328,3 +330,5 @@ const mp_obj_type_t pyb_servo_type = {
.make_new = pyb_servo_make_new, .make_new = pyb_servo_make_new,
.locals_dict = (mp_obj_dict_t*)&pyb_servo_locals_dict, .locals_dict = (mp_obj_dict_t*)&pyb_servo_locals_dict,
}; };
#endif // MICROPY_HW_ENABLE_SERVO
...@@ -216,9 +216,11 @@ TIM_HandleTypeDef *timer_tim6_init(uint freq) { ...@@ -216,9 +216,11 @@ TIM_HandleTypeDef *timer_tim6_init(uint freq) {
// Interrupt dispatch // Interrupt dispatch
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
#if MICROPY_HW_ENABLE_SERVO
if (htim == &TIM5_Handle) { if (htim == &TIM5_Handle) {
servo_timer_irq_callback(); servo_timer_irq_callback();
} }
#endif
} }
// Get the frequency (in Hz) of the source clock for the given timer. // Get the frequency (in Hz) of the source clock for the given timer.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment