Skip to content

Commit

Permalink
aio: Fix setting adc bits when initializing
Browse files Browse the repository at this point in the history
Use the number of adc bits set by the hardware
instead of using the default hard-coded 10 bits

Signed-off-by: chao zeng <[email protected]>
  • Loading branch information
AsuraZeng committed Jan 13, 2023
1 parent 8b1c549 commit d03c75e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/aio/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#include "aio.h"
#include "mraa_internal.h"

#define DEFAULT_BITS 10

static int raw_bits;
static unsigned int shifter_value;
static float max_analog_value;
Expand Down Expand Up @@ -133,7 +131,7 @@ mraa_aio_init(unsigned int aio)
}

raw_bits = mraa_adc_raw_bits();
mraa_aio_set_bit(dev, DEFAULT_BITS);
mraa_aio_set_bit(dev, raw_bits);

if (IS_FUNC_DEFINED(dev, aio_init_pre)) {
mraa_result_t pre_ret = (dev->advance_func->aio_init_pre(aio));
Expand Down

0 comments on commit d03c75e

Please sign in to comment.