mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-17 06:52:18 +01:00
commit
3bbdf495f2
@ -30,6 +30,7 @@ Version Modified By Date Comments
|
|||||||
0006 D Mellis 09/12/29 Replaced objects with functions
|
0006 D Mellis 09/12/29 Replaced objects with functions
|
||||||
0007 M Sproul 10/08/29 Changed #ifdefs from cpu to register
|
0007 M Sproul 10/08/29 Changed #ifdefs from cpu to register
|
||||||
0008 S Kanemoto 12/06/22 Fixed for Leonardo by @maris_HY
|
0008 S Kanemoto 12/06/22 Fixed for Leonardo by @maris_HY
|
||||||
|
0009 J Reucker 15/04/10 Issue #292 Fixed problems with ATmega8 (thanks to Pete62)
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
@ -296,13 +297,13 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
|
|||||||
#if defined(TCCR0B)
|
#if defined(TCCR0B)
|
||||||
if (_timer == 0)
|
if (_timer == 0)
|
||||||
{
|
{
|
||||||
TCCR0B = prescalarbits;
|
TCCR0B = (TCCR0B & 0b11111000) | prescalarbits;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#if defined(TCCR2B)
|
#if defined(TCCR2B)
|
||||||
{
|
{
|
||||||
TCCR2B = prescalarbits;
|
TCCR2B = (TCCR2B & 0b11111000) | prescalarbits;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
@ -389,7 +390,7 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TIMSK3)
|
#if defined(OCR3A) && defined(TIMSK3) && defined(OCIE3A)
|
||||||
case 3:
|
case 3:
|
||||||
OCR3A = ocr;
|
OCR3A = ocr;
|
||||||
timer3_toggle_count = toggle_count;
|
timer3_toggle_count = toggle_count;
|
||||||
@ -397,7 +398,7 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TIMSK4)
|
#if defined(OCR4A) && defined(TIMSK4) && defined(OCIE4A)
|
||||||
case 4:
|
case 4:
|
||||||
OCR4A = ocr;
|
OCR4A = ocr;
|
||||||
timer4_toggle_count = toggle_count;
|
timer4_toggle_count = toggle_count;
|
||||||
@ -454,21 +455,21 @@ void disableTimer(uint8_t _timer)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined(TIMSK3)
|
#if defined(TIMSK3) && defined(OCIE3A)
|
||||||
case 3:
|
case 3:
|
||||||
TIMSK3 = 0;
|
bitWrite(TIMSK3, OCIE3A, 0);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TIMSK4)
|
#if defined(TIMSK4) && defined(OCIE4A)
|
||||||
case 4:
|
case 4:
|
||||||
TIMSK4 = 0;
|
bitWrite(TIMSK4, OCIE4A, 0);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TIMSK5)
|
#if defined(TIMSK5) && defined(OCIE5A)
|
||||||
case 5:
|
case 5:
|
||||||
TIMSK5 = 0;
|
bitWrite(TIMSK5, OCIE5A, 0);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user