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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (C) 2017 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. /**
  23. * The class Servo uses the PWM class to implement its functions
  24. *
  25. * The PWM1 module is only used to generate interrups at specified times. It
  26. * is NOT used to directly toggle pins. The ISR writes to the pin assigned to
  27. * that interrupt
  28. *
  29. * All PWMs use the same repetition rate - 20mS because that's the normal servo rate
  30. *
  31. */
  32. #ifndef LPC1768_SERVO_H
  33. #define LPC1768_SERVO_H
  34. #include <stdint.h>
  35. class Servo {
  36. public:
  37. Servo();
  38. int8_t attach(int pin); // attach the given pin to the next free channel, set pinMode, return channel number (-1 on fail)
  39. int8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
  40. void detach();
  41. void write(int value); // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
  42. void writeMicroseconds(int value); // write pulse width in microseconds
  43. void move(int value); // attach the servo, then move to value
  44. // if value is < 200 it is treated as an angle, otherwise as pulse width in microseconds
  45. // if DEACTIVATE_SERVOS_AFTER_MOVE wait SERVO_DELAY, then detach
  46. int read(); // returns current pulse width as an angle between 0 and 180 degrees
  47. int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release)
  48. bool attached(); // return true if this servo is attached, otherwise false
  49. private:
  50. uint8_t servoIndex; // index into the channel data for this servo
  51. int min;
  52. int max;
  53. };
  54. #define HAL_SERVO_LIB Servo
  55. #endif // LPC1768_SERVO_H