Private
Public Access
2
0

aio: added configuration within platform data.

* Allows for different bit shifting for each platform.
* New functions added for obtaining this information
* mraa_adc_raw_bits
* mraa_adc_supported_bits

* Update board information to include this. AIO module changed to allow
* use of the new board data

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
Thomas Ingleby
2014-06-25 17:32:41 +01:00
parent 9a81b043be
commit e5c7e64cf3
6 changed files with 57 additions and 9 deletions

View File

@@ -44,9 +44,6 @@ extern "C" {
#include "common.h"
#include "gpio.h"
#define ADC_RAW_RESOLUTION_BITS (12)
#define ADC_SUPPORTED_RESOLUTION_BITS (10)
/**
* Opaque pointer definition to the internal struct _aio. This context refers
* to one single AIO pin on the board.

View File

@@ -164,6 +164,8 @@ typedef struct {
unsigned int spi_bus_count; /**< Usable spi Count */
mraa_spi_bus_t spi_bus[6]; /**< Array of spi */
unsigned int def_spi_bus; /**< Position in array of defult spi bus */
unsigned int adc_raw; /**< ADC raw bit value */
unsigned int adc_supported; /**< ADC supported bit value */
mraa_pininfo_t* pins; /**< Pointer to pin array */
/*@}*/
} mraa_board_t;
@@ -193,6 +195,20 @@ mraa_result_t mraa_init();
*/
mraa_boolean_t mraa_pin_mode_test(int pin, mraa_pinmodes_t 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 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 mraa_adc_supported_bits();
#ifdef __cplusplus
}
#endif