PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

59 líneas
1.5KB

  1. /*
  2. || @author Brett Hagman <bhagman@wiring.org.co>
  3. || @url http://wiring.org.co/
  4. || @url http://roguerobotics.com/
  5. ||
  6. || @description
  7. || | A Software PWM Library
  8. || |
  9. || | Written by Brett Hagman
  10. || | http://www.roguerobotics.com/
  11. || | bhagman@roguerobotics.com, bhagman@wiring.org.co
  12. || |
  13. || | A Wiring (and Arduino) Library, for Atmel AVR8 bit series microcontrollers,
  14. || | to produce PWM signals on any arbitrary pin.
  15. || |
  16. || | It was originally designed for controlling the brightness of LEDs, but
  17. || | could be adapted to control servos and other low frequency PWM controlled
  18. || | devices as well.
  19. || |
  20. || | It uses a single hardware timer (Timer 2) on the Atmel microcontroller to
  21. || | generate up to 20 PWM channels (your mileage may vary).
  22. || |
  23. || #
  24. ||
  25. || @license Please see the accompanying LICENSE.txt file for this project.
  26. ||
  27. || @name Software PWM Library
  28. || @type Library
  29. || @target Atmel AVR 8 Bit
  30. ||
  31. || @version 1.0.0
  32. ||
  33. */
  34. #ifndef SOFTPWM_H
  35. #define SOFTPWM_H
  36. #define SOFTPWM_VERSION 10000
  37. #include <stdint.h>
  38. #define SOFTPWM_MAXCHANNELS 20
  39. #define SOFTPWM_PWMDEFAULT 0x00
  40. #define SOFTPWM_NORMAL 0
  41. #define SOFTPWM_INVERTED 1
  42. #define ALL -1
  43. void SoftPWMBegin(uint8_t defaultPolarity = SOFTPWM_NORMAL);
  44. void SoftPWMSet(int8_t pin, uint8_t value, uint8_t hardset = 0);
  45. void SoftPWMSetPercent(int8_t pin, uint8_t percent, uint8_t hardset = 0);
  46. void SoftPWMEnd(int8_t pin);
  47. void SoftPWMSetFadeTime(int8_t pin, uint16_t fadeUpTime, uint16_t fadeDownTime);
  48. void SoftPWMSetPolarity(int8_t pin, uint8_t polarity);
  49. #endif