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.

servo_private.h 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 <https://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. /**
  42. * Based on "servo.h - Interrupt driven Servo library for Arduino using 16 bit timers -
  43. * Version 2 Copyright (c) 2009 Michael Margolis. All right reserved.
  44. *
  45. * The only modification was to update/delete macros to match the LPC176x.
  46. */
  47. #include <stdint.h>
  48. // Macros
  49. //values in microseconds
  50. #define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
  51. #define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
  52. #define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
  53. #define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
  54. #define MAX_SERVOS 4
  55. #define INVALID_SERVO 255 // flag indicating an invalid servo index
  56. // Types
  57. typedef struct {
  58. uint8_t nbr : 8 ; // a pin number from 0 to 254 (255 signals invalid pin)
  59. uint8_t isActive : 1 ; // true if this channel is enabled, pin not pulsed if false
  60. } ServoPin_t;
  61. typedef struct {
  62. ServoPin_t Pin;
  63. unsigned int pulse_width; // pulse width in microseconds
  64. } ServoInfo_t;
  65. // Global variables
  66. extern uint8_t ServoCount;
  67. extern ServoInfo_t servo_info[MAX_SERVOS];