Tweaks to Servo classes
This commit is contained in:
@ -1,20 +1,18 @@
|
||||
#if defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||
|
||||
|
||||
#include "HAL_Servo_Teensy.h"
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
|
||||
int8_t libServo::attach(int pin) {
|
||||
if (this->servoIndex >= MAX_SERVOS) return -1;
|
||||
return Servo::attach(pin);
|
||||
int8_t libServo::attach(const int pin) {
|
||||
if (this->servoIndex >= MAX_SERVOS) return -1;
|
||||
return Servo::attach(pin);
|
||||
}
|
||||
|
||||
int8_t libServo::attach(int pin, int min, int max) {
|
||||
return Servo::attach(pin, min, max);
|
||||
int8_t libServo::attach(const int pin, const int min, const int max) {
|
||||
return Servo::attach(pin, min, max);
|
||||
}
|
||||
|
||||
void libServo::move(int value) {
|
||||
void libServo::move(const int value) {
|
||||
if (this->attach(0) >= 0) {
|
||||
this->write(value);
|
||||
delay(SERVO_DELAY);
|
||||
@ -24,5 +22,4 @@ void libServo::move(int value) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif // __MK64FX512__ || __MK66FX1M0__
|
||||
|
@ -6,13 +6,13 @@
|
||||
// Inherit and expand on the official library
|
||||
class libServo : public Servo {
|
||||
public:
|
||||
int8_t attach(int pin);
|
||||
int8_t attach(int pin, int min, int max);
|
||||
void move(int value);
|
||||
int8_t attach(const int pin);
|
||||
int8_t attach(const int pin, const int min, const int max);
|
||||
void move(const int value);
|
||||
private:
|
||||
uint16_t min_ticks;
|
||||
uint16_t max_ticks;
|
||||
uint8_t servoIndex; // index into the channel data for this servo
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // HAL_Servo_Teensy_h
|
||||
|
Reference in New Issue
Block a user