@@ -624,6 +624,8 @@ avr_timer_write_ocr(
624
624
avr_timer_reconfigure (timer , 0 ); // if OCRA is the top, reconfigure needed
625
625
}
626
626
avr_raise_irq (timer -> io .irq + TIMER_IRQ_OUT_PWM1 , _timer_get_ocr (timer , AVR_TIMER_COMPB ));
627
+ if (sizeof (timer -> comp )> 2 )
628
+ avr_raise_irq (timer -> io .irq + TIMER_IRQ_OUT_PWM2 , _timer_get_ocr (timer , AVR_TIMER_COMPC ));
627
629
break ;
628
630
case avr_timer_wgm_fast_pwm :
629
631
if (oldv != _timer_get_comp_ocr (avr , comp ))
@@ -632,6 +634,9 @@ avr_timer_write_ocr(
632
634
_timer_get_ocr (timer , AVR_TIMER_COMPA ));
633
635
avr_raise_irq (timer -> io .irq + TIMER_IRQ_OUT_PWM1 ,
634
636
_timer_get_ocr (timer , AVR_TIMER_COMPB ));
637
+ if (sizeof (timer -> comp )> 2 )
638
+ avr_raise_irq (timer -> io .irq + TIMER_IRQ_OUT_PWM2 ,
639
+ _timer_get_ocr (timer , AVR_TIMER_COMPC ));
635
640
break ;
636
641
default :
637
642
AVR_LOG (avr , LOG_WARNING , "TIMER: %s-%c mode %d UNSUPPORTED\n" ,
@@ -851,6 +856,7 @@ avr_timer_reset(
851
856
static const char * irq_names [TIMER_IRQ_COUNT ] = {
852
857
[TIMER_IRQ_OUT_PWM0 ] = "8>pwm0" ,
853
858
[TIMER_IRQ_OUT_PWM1 ] = "8>pwm1" ,
859
+ [TIMER_IRQ_OUT_PWM2 ] = "8>pwm2" ,
854
860
[TIMER_IRQ_IN_ICP ] = "<icp" ,
855
861
[TIMER_IRQ_OUT_COMP + 0 ] = ">compa" ,
856
862
[TIMER_IRQ_OUT_COMP + 1 ] = ">compb" ,
@@ -883,6 +889,7 @@ avr_timer_init(
883
889
// pwm value it makes sense not to bother.
884
890
p -> io .irq [TIMER_IRQ_OUT_PWM0 ].flags |= IRQ_FLAG_FILTERED ;
885
891
p -> io .irq [TIMER_IRQ_OUT_PWM1 ].flags |= IRQ_FLAG_FILTERED ;
892
+ p -> io .irq [TIMER_IRQ_OUT_PWM2 ].flags |= IRQ_FLAG_FILTERED ;
886
893
887
894
if (p -> wgm [0 ].reg ) // these are not present on older AVRs
888
895
avr_register_io_write (avr , p -> wgm [0 ].reg , avr_timer_write , p );
0 commit comments