Skip to content

Commit

Permalink
Update ADC data register before IRQ calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcornil-git committed Nov 20, 2024
1 parent 33566f7 commit 71c616d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions simavr/sim/avr_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ avr_adc_int_raise(
{
avr_adc_t * p = (avr_adc_t *)param;
if (avr_regbit_get(avr, p->aden)) {
// if the interrupts are not used, still raised the UDRE and TXC flag
avr_raise_interrupt(avr, &p->adc);
avr_regbit_clear(avr, p->adsc);
if( p->adts_mode == avr_adts_free_running )
avr_raise_irq(p->io.irq + ADC_IRQ_IN_TRIGGER, 1);
if (!p->read_status) {
/* Update I/O registers. */
avr_core_watch_write(avr, p->r_adcl, p->result & 0xff);
avr_core_watch_write(avr, p->r_adch, p->result >> 8);
}
// if the interrupts are not used, still raised the UDRE and TXC flag
avr_raise_interrupt(avr, &p->adc);
avr_regbit_clear(avr, p->adsc);
if( p->adts_mode == avr_adts_free_running )
avr_raise_irq(p->io.irq + ADC_IRQ_IN_TRIGGER, 1);
}
return 0;
}
Expand Down

0 comments on commit 71c616d

Please sign in to comment.