parent
fa537bc27a
commit
1dcd0a4edb
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
void timer_init(void)
|
||||||
|
{
|
||||||
|
ICR1 = (1 << 11) - 1;/* 11 bit pwm */
|
||||||
|
OCR1A = 0;
|
||||||
|
TCCR1A = (1 << COM1A1) | (1 << CS10) | (1 << WGM11);/* fast pwm, non inverted, top in ICR1 */
|
||||||
|
TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS10);/* fast pwm, top in ICR1, */
|
||||||
|
DDRD |= (1 << PD5);/* set pwm pin as output */
|
||||||
|
TIMSK = 1 << TOIE1;/* interrupt at top */
|
||||||
|
}
|
||||||
Loading…
Reference in new issue