My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HAL_Servo_Teensy.cpp 812B

1234567891011121314151617181920212223242526272829303132
  1. #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
  2. #include "../../inc/MarlinConfig.h"
  3. #if HAS_SERVOS
  4. #include "HAL_Servo_Teensy.h"
  5. int8_t libServo::attach(const int pin) {
  6. if (this->servoIndex >= MAX_SERVOS) return -1;
  7. return Servo::attach(pin);
  8. }
  9. int8_t libServo::attach(const int pin, const int min, const int max) {
  10. return Servo::attach(pin, min, max);
  11. }
  12. void libServo::move(const int value) {
  13. constexpr uint16_t servo_delay[] = SERVO_DELAY;
  14. static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
  15. if (this->attach(0) >= 0) {
  16. this->write(value);
  17. safe_delay(servo_delay[this->servoIndex]);
  18. #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
  19. this->detach();
  20. #endif
  21. }
  22. }
  23. #endif // HAS_SERVOS
  24. #endif // __MK64FX512__ || __MK66FX1M0__