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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 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. /**
  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. */
  48. #include <stdint.h>
  49. // Macros
  50. //values in microseconds
  51. #define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
  52. #define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
  53. #define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
  54. #define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
  55. #define MAX_SERVOS 4
  56. #define INVALID_SERVO 255 // flag indicating an invalid servo index
  57. // Types
  58. typedef struct {
  59. uint8_t nbr : 8 ; // a pin number from 0 to 254 (255 signals invalid pin)
  60. uint8_t isActive : 1 ; // true if this channel is enabled, pin not pulsed if false
  61. } ServoPin_t;
  62. typedef struct {
  63. ServoPin_t Pin;
  64. unsigned int pulse_width; // pulse width in microseconds
  65. } ServoInfo_t;
  66. // Global variables
  67. extern uint8_t ServoCount;
  68. extern ServoInfo_t servo_info[MAX_SERVOS];