timer02.h 1008 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //timer02.h
  2. // use atmega timer2 as main system timer instead of timer0
  3. // timer0 is used for fast pwm (OC0B output)
  4. // original OVF handler is disabled
  5. #ifndef TIMER02_H
  6. #define TIMER02_H
  7. #include <inttypes.h>
  8. #if defined(__cplusplus)
  9. extern "C" {
  10. #endif //defined(__cplusplus)
  11. ///! Initializes TIMER0 for fast PWM mode-driven bed heating
  12. extern void timer0_init(void);
  13. ///! Reimplemented original millis() using timer2
  14. extern unsigned long millis2(void);
  15. ///! Reimplemented original micros() using timer2
  16. extern unsigned long micros2(void);
  17. ///! Reimplemented original delay() using timer2
  18. extern void delay2(unsigned long ms);
  19. ///! Reimplemented original tone() using timer2
  20. ///! Does not perform any PWM tone generation, it just sets the beeper pin to 1
  21. extern void tone2(uint8_t _pin, unsigned int frequency/*, unsigned long duration*/);
  22. ///! Turn off beeping - set beeper pin to 0
  23. extern void noTone2(uint8_t _pin);
  24. #if defined(__cplusplus)
  25. }
  26. #endif //defined(__cplusplus)
  27. #endif //TIMER02_H