void init_pwm()
{
/* Async clock */
- PLLCSR = _BV(LSM) | _BV(PLLE);
+ PLLCSR = _BV(PLLE);
/* Synchronize to the phase lock */
_delay_ms(1);
TCCR1B = _BV(7) // PWM1X: PWM inversion mode
| _BV(CS10) // no clock prescaling
;
+ TC1H = 0x01;
OCR1C = 0xFF; // TOP value
+ TC1H = 0x00;
OCR1D = OCR1B = OCR1A = 0; // initial stride is 0
DDRB &= ~(_BV( PB1 ) | _BV( PB3 ) | _BV( PB5 )); // tristate it
void pwm_set(unsigned char n, unsigned char stride)
{
+ TC1H = 0x00;
switch (n) {
case 0: OCR1A = stride; break;
case 1: OCR1B = stride; break;