From: bsekisser Date: Sun, 26 Apr 2015 12:34:36 +0000 (-0400) Subject: adc: check r_adcsrb is valid before init X-Git-Tag: v1.3~48^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=f65ac1a207cc940757cd33dc05346adb7a9c60b9;p=sx%2Fsimavr.git adc: check r_adcsrb is valid before init fix issue #118 modified: simavr/sim/avr_adc.c --- diff --git a/simavr/sim/avr_adc.c b/simavr/sim/avr_adc.c index 712bfb7..b1c5f55 100644 --- a/simavr/sim/avr_adc.c +++ b/simavr/sim/avr_adc.c @@ -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); }