solenoid.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* Copyright 2018 mtdjr - modified by ishtob
  2. * Driver for solenoid written for QMK
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #pragma once
  18. #ifndef SOLENOID_DEFAULT_DWELL
  19. # define SOLENOID_DEFAULT_DWELL 12
  20. #endif
  21. #ifndef SOLENOID_MAX_DWELL
  22. # define SOLENOID_MAX_DWELL 100
  23. #endif
  24. #ifndef SOLENOID_MIN_DWELL
  25. # define SOLENOID_MIN_DWELL 4
  26. #endif
  27. #ifndef SOLENOID_DWELL_STEP_SIZE
  28. # define SOLENOID_DWELL_STEP_SIZE 1
  29. #endif
  30. #ifndef SOLENOID_DEFAULT_BUZZ
  31. # define SOLENOID_DEFAULT_BUZZ 0
  32. #endif
  33. #ifndef SOLENOID_BUZZ_ACTUATED
  34. # define SOLENOID_BUZZ_ACTUATED SOLENOID_MIN_DWELL
  35. #endif
  36. #ifndef SOLENOID_BUZZ_NONACTUATED
  37. # define SOLENOID_BUZZ_NONACTUATED SOLENOID_MIN_DWELL
  38. #endif
  39. #ifndef SOLENOID_PINS
  40. # ifdef SOLENOID_PIN
  41. # define SOLENOID_PINS \
  42. { SOLENOID_PIN }
  43. # else
  44. # error SOLENOID_PINS array not defined
  45. # endif
  46. #endif
  47. void solenoid_buzz_on(void);
  48. void solenoid_buzz_off(void);
  49. void solenoid_set_buzz(uint8_t buzz);
  50. void solenoid_set_dwell(uint8_t dwell);
  51. void solenoid_stop(uint8_t index);
  52. void solenoid_fire(uint8_t index);
  53. void solenoid_fire_handler(void);
  54. void solenoid_check(void);
  55. void solenoid_setup(void);
  56. void solenoid_shutdown(void);