My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

HAL_Servo_Stm32f1.cpp 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 __STM32F1__
  24. #include "../../inc/MarlinConfig.h"
  25. #if HAS_SERVOS
  26. #include "HAL_Servo_Stm32f1.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. constexpr uint16_t servo_delay[] = SERVO_DELAY;
  36. static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
  37. if (this->attach(0) >= 0) {
  38. this->write(value);
  39. safe_delay(servo_delay[this->servoIndex]);
  40. #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
  41. this->detach();
  42. #endif
  43. }
  44. }
  45. #endif // HAS_SERVOS
  46. #endif // __STM32F1__