My Marlin configs for Fabrikator Mini and CTC i3 Pro B
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Servo.h 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
  25. * Copyright (c) 2009 Michael Margolis. All right reserved.
  26. *
  27. * This library is free software; you can redistribute it and/or
  28. * modify it under the terms of the GNU Lesser General Public
  29. * License as published by the Free Software Foundation; either
  30. * version 2.1 of the License, or (at your option) any later version.
  31. *
  32. * This library is distributed in the hope that it will be useful,
  33. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  34. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  35. * Lesser General Public License for more details.
  36. *
  37. * You should have received a copy of the GNU Lesser General Public
  38. * License along with this library; if not, write to the Free Software
  39. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  40. */
  41. #pragma once
  42. /**
  43. * Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers -
  44. * Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
  45. *
  46. * The only modification was to update/delete macros to match the LPC176x.
  47. *
  48. */
  49. #include <Servo.h>
  50. class libServo: public Servo {
  51. public:
  52. void move(const int value) {
  53. constexpr uint16_t servo_delay[] = SERVO_DELAY;
  54. static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long.");
  55. if (attach(servo_info[servoIndex].Pin.nbr) >= 0) { // try to reattach
  56. write(value);
  57. safe_delay(servo_delay[servoIndex]); // delay to allow servo to reach position
  58. TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach());
  59. }
  60. }
  61. };
  62. #define HAL_SERVO_LIB libServo