Commit f65ac1a207cc940757cd33dc05346adb7a9c60b9
authorbsekisser <squirmyworms@embarqmail.com>
Sun, 26 Apr 2015 12:34:36 +0000 (08:34 -0400)
committerbsekisser <squirmyworms@embarqmail.com>
Sun, 26 Apr 2015 12:42:30 +0000 (08:42 -0400)
fix issue #118

modified:   simavr/sim/avr_adc.c

simavr/sim/avr_adc.c

index 712bfb73a3b59bd8195a6d0622300f3d743897fe..b1c5f553366280521c361fe9e20a051a8145ce3b 100644 (file)
@@ -326,7 +326,8 @@ void avr_adc_init(avr_t * avr, avr_adc_t * p)
        avr_io_setirqs(&p->io, AVR_IOCTL_ADC_GETIRQ, ADC_IRQ_COUNT, NULL);
 
        avr_register_io_write(avr, p->r_adcsra, avr_adc_write_adcsra, p);
-       avr_register_io_write(avr, p->r_adcsrb, avr_adc_write_adcsrb, p);
+       if (p->r_adcsrb)
+               avr_register_io_write(avr, p->r_adcsrb, avr_adc_write_adcsrb, p);
        avr_register_io_read(avr, p->r_adcl, avr_adc_read_l, p);
        avr_register_io_read(avr, p->r_adch, avr_adc_read_h, p);
 }