2 #include <avr/interrupt.h>
3 #include <util/delay.h>
4 #include <util/atomic.h>
9 * Single PWM channel on OC1B (pin PB4 of Tiny45).
10 * Counts from 0 to 0xFF, without OCR1C compare.
13 static void inline enable_pll()
18 /* Synchronize to the phase lock */
20 while ((PLLCSR & _BV(PLOCK)) == 0)
29 TCCR1 = _BV(CTC1) | _BV(CS10); // no clock prescaling
30 GTCCR = _BV(COM1B1) | _BV(PWM1B);
33 OCR1B = 0; // initial stride is 0
35 DDRB &= ~_BV(PB4); // tristate it
36 PORTB &= ~_BV(PB4); // set to zero
44 for (i = 0; i < N_PWMLEDS; i++)
47 DDRB &= ~(_BV( PB1 ) | _BV( PB3 ) | _BV( PB5 ));
48 TCCR1D = TCCR1C = TCCR1B = TCCR1A = 0;
52 PLLCSR &= ~(_BV(PLLE) | _BV(PCKE));
62 void pwm_set(uint8_t stride)