Allow libServo::attach to work on Teensy 3.5/3.6

This commit is contained in:
Scott Lahteine 2018-05-28 20:55:50 -05:00
parent f89f7c4a82
commit cbcb284f4a
3 changed files with 7 additions and 3 deletions

View file

@ -24,6 +24,7 @@
#ifndef HAL_SERVO_STM32F1_H
#define HAL_SERVO_STM32F1_H
// Path needed, otherwise HAL version is used
#include <../../libraries/Servo/src/Servo.h>
// Inherit and expand on the official library

View file

@ -6,13 +6,17 @@
#include "HAL_Servo_Teensy.h"
uint8_t servoPin[MAX_SERVOS] = { 0 };
int8_t libServo::attach(const int pin) {
if (this->servoIndex >= MAX_SERVOS) return -1;
return Servo::attach(pin);
if (pin > 0) servoPin[this->servoIndex] = pin;
return Servo::attach(servoPin[this->servoIndex]);
}
int8_t libServo::attach(const int pin, const int min, const int max) {
return Servo::attach(pin, min, max);
if (pin > 0) servoPin[this->servoIndex] = pin;
return Servo::attach(servoPin[this->servoIndex], min, max);
}
void libServo::move(const int value) {

View file

@ -51,7 +51,6 @@
*
*/
#include "../inc/MarlinConfig.h"
#if HAS_SERVOS && !(IS_32BIT_TEENSY || defined(TARGET_LPC1768) || defined(STM32F4))