From 22a3551bf84a567dd40f6cef1adfe262b72d6496 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Thu, 14 Aug 2014 14:21:03 +0100 Subject: [PATCH] common.hpp: add ADC bitness calls to C++ api Signed-off-by: Brendan Le Foll --- api/mraa/common.hpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/api/mraa/common.hpp b/api/mraa/common.hpp index cb6cba1..982e2c2 100644 --- a/api/mraa/common.hpp +++ b/api/mraa/common.hpp @@ -93,4 +93,24 @@ bool pinModeTest(int pin, mraa_pinmodes_t mode) return (bool) mraa_pin_mode_test(pin,mode); } +/** + * Check the board's bit size when reading the value + * + * @return raw bits being read from kernel module. Zero if no ADC + */ +unsigned int adcRawBits() +{ + return mraa_adc_raw_bits(); +} + +/** + * Return value that the raw value should be shifted to. Zero if no ADC + * + * @return return actual bit size the adc value should be understood as. + */ +unsigned int adcSupportedBits() +{ + return mraa_adc_supported_bits(); +} + }