My Marlin configs for Fabrikator Mini and CTC i3 Pro B
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

HAL_Servo_STM32F7.cpp 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
  7. * Copyright (C) 2017 Victor Perez
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. #ifdef STM32F7
  24. #include "../../../src/inc/MarlinConfig.h"
  25. #if HAS_SERVOS
  26. #include "HAL_Servo_STM32F7.h"
  27. int8_t libServo::attach(const int pin) {
  28. if (this->servoIndex >= MAX_SERVOS) return -1;
  29. return Servo::attach(pin);
  30. }
  31. int8_t libServo::attach(const int pin, const int min, const int max) {
  32. return Servo::attach(pin, min, max);
  33. }
  34. void libServo::move(const int value) {
  35. if (this->attach(0) >= 0) {
  36. this->write(value);
  37. delay(SERVO_DELAY);
  38. #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
  39. this->detach();
  40. #endif
  41. }
  42. }
  43. #endif // HAS_SERVOS
  44. #endif // STM32F7