Browse Source

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

pull/1/head
Scott Lahteine 6 years ago
parent
commit
cbcb284f4a
  1. 1
      Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h
  2. 8
      Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.cpp
  3. 1
      Marlin/src/HAL/servo.cpp

1
Marlin/src/HAL/HAL_STM32F1/HAL_Servo_Stm32f1.h

@ -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

8
Marlin/src/HAL/HAL_TEENSY35_36/HAL_Servo_Teensy.cpp

@ -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) {

1
Marlin/src/HAL/servo.cpp

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

Loading…
Cancel
Save