},
// TIMER2_COMPB is only appeared in 2560
[AVR_TIMER_COMPB] = {
- .r_ocr = OCR2B,
- .com = AVR_IO_REGBITS(TCCR2A, COM2B0, 0x3),
- .com_pin = AVR_IO_REGBIT(PORTH, PH6),
- .interrupt = {
- .enable = AVR_IO_REGBIT(TIMSK2, OCIE2B),
- .raised = AVR_IO_REGBIT(TIFR2, OCF2B),
- .vector = TIMER2_COMPB_vect,
- },
+ .r_ocr = OCR2B,
+ .com = AVR_IO_REGBITS(TCCR2A, COM2B0, 0x3),
+ .com_pin = AVR_IO_REGBIT(PORTH, PH6),
+ .interrupt = {
+ .enable = AVR_IO_REGBIT(TIMSK2, OCIE2B),
+ .raised = AVR_IO_REGBIT(TIFR2, OCF2B),
+ .vector = TIMER2_COMPB_vect,
+ },
},
},
},
.r_ocrh = OCR1AH, // 16 bits timers have two bytes of it
.com = AVR_IO_REGBITS(TCCR1A, COM1A0, 0x3),
.com_pin = AVR_IO_REGBIT(PORTB, 1),
- .foc = AVR_IO_REGBIT(TCCR1C, FOC1A),
+ .foc = AVR_IO_REGBIT(TCCR1C, FOC1A),
.interrupt = {
.enable = AVR_IO_REGBIT(TIMSK1, OCIE1A),
.raised = AVR_IO_REGBIT(TIFR1, OCF1A),
.r_ocrh = OCR1BH,
.com = AVR_IO_REGBITS(TCCR1A, COM1B0, 0x3),
.com_pin = AVR_IO_REGBIT(PORTB, 2),
- .foc = AVR_IO_REGBIT(TCCR1C, FOC1B),
+ .foc = AVR_IO_REGBIT(TCCR1C, FOC1B),
.interrupt = {
.enable = AVR_IO_REGBIT(TIMSK1, OCIE1B),
.raised = AVR_IO_REGBIT(TIFR1, OCF1B),
uint8_t mode = avr_regbit_get(avr, p->comp[comp].com);
avr_irq_t * irq = &p->io.irq[TIMER_IRQ_OUT_COMP + comp];
- uint32_t flags = 0;
- if (p->comp[comp].com_pin.reg) // we got a physical pin
- flags |= AVR_IOPORT_OUTPUT;
- AVR_LOG(avr, LOG_TRACE, "Timer comp: irq %p, mode %d @%d\n", irq, mode, when);
+ uint32_t flags = 0;
+ if (p->comp[comp].com_pin.reg) // we got a physical pin
+ flags |= AVR_IOPORT_OUTPUT;
+ AVR_LOG(avr, LOG_TRACE, "Timer comp: irq %p, mode %d @%d\n", irq, mode, when);
switch (mode) {
case avr_timer_com_normal: // Normal mode OCnA disconnected
break;
uint8_t mode = avr_regbit_get(avr, p->comp[comp].com);
avr_irq_t * irq = &p->io.irq[TIMER_IRQ_OUT_COMP + comp];
- // only PWM modes have special behaviour on overflow
- if((p->wgm_op_mode_kind != avr_timer_wgm_pwm) &&
- (p->wgm_op_mode_kind != avr_timer_wgm_fast_pwm))
- return;
+ // only PWM modes have special behaviour on overflow
+ if((p->wgm_op_mode_kind != avr_timer_wgm_pwm) &&
+ (p->wgm_op_mode_kind != avr_timer_wgm_fast_pwm))
+ return;
switch (mode) {
case avr_timer_com_normal: // Normal mode
if (p->comp[compi].r_ocr) // not all timers have all comparators
avr_register_io_write(avr, p->comp[compi].r_ocr, avr_timer_write_ocr, &p->comp[compi]);
- if (p->comp[compi].foc.reg)
- avr_register_io_write(avr, p->comp[compi].foc.reg, avr_timer_write_foc, p);
+ if (p->comp[compi].foc.reg)
+ avr_register_io_write(avr, p->comp[compi].foc.reg, avr_timer_write_foc, p);
}
avr_register_io_write(avr, p->r_tcnt, avr_timer_tcnt_write, p);
avr_register_io_read(avr, p->r_tcnt, avr_timer_tcnt_read, p);