From 43f857c899e543312dbabb2e53d8eaf10f6c82f6 Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Fri, 25 Jun 2010 09:17:19 +0100 Subject: [PATCH] ADC: Fix ADLAR bit handling Was shifting when zero, not one. Signed-off-by: Michel Pollet --- simavr/sim/avr_adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simavr/sim/avr_adc.c b/simavr/sim/avr_adc.c index 3657d60..7dafdbb 100644 --- a/simavr/sim/avr_adc.c +++ b/simavr/sim/avr_adc.c @@ -1,7 +1,7 @@ /* avr_adc.c - Copyright 2008, 2009 Michel Pollet + Copyright 2008, 2010 Michel Pollet This file is part of simavr. @@ -49,7 +49,7 @@ static uint8_t avr_adc_read_l(struct avr_t * avr, avr_io_addr_t addr, void * par uint8_t muxi = avr_regbit_get_array(avr, p->mux, ARRAY_SIZE(p->mux)); avr_adc_mux_t mux = p->muxmode[muxi]; // optional shift left/right - uint8_t shift = avr_regbit_get(avr, p->adlar) ? 0 : 6; + uint8_t shift = avr_regbit_get(avr, p->adlar) ? 6 : 0; // shift LEFT uint32_t reg = 0; switch (mux.kind) { -- 2.39.5