diff options
author | Constantin Musca <constantin.musca@intel.com> | 2016-01-14 02:05:07 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-01-14 02:05:07 +0000 |
commit | dee6cb5ab7990d5c9ebb5b868e74e070e3db5b47 (patch) | |
tree | f5b852c7620a6250a85857e0df123be0b095bfe5 | |
parent | 15f448c7721d38c3018339ee38c034009c861f9d (diff) | |
parent | 39bbf3e39686a35fbc19b1b9b3d2f1e03a8f72c6 (diff) | |
download | intel-dee6cb5ab7990d5c9ebb5b868e74e070e3db5b47.tar.gz |
light: add support for Minnowboard Max
am: 39bbf3e396
* commit '39bbf3e39686a35fbc19b1b9b3d2f1e03a8f72c6':
light: add support for Minnowboard Max
-rw-r--r-- | peripheral/light/edison_arduino/lights.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/peripheral/light/edison_arduino/lights.c b/peripheral/light/edison_arduino/lights.c index 651e9e3..00aa31e 100644 --- a/peripheral/light/edison_arduino/lights.c +++ b/peripheral/light/edison_arduino/lights.c @@ -63,11 +63,12 @@ static int const TRI_STATE_ALL_GPIO_RAW_PIN = 214; /* * Pin constants - * Please add a pin to ARDUINO_PINS & NON_ARDUINO_PINS - * when you add a new light type + * Please add a pin to EDISON_ARDUINO_PINS, EDISON_MINIBOARD_PINS & + * MINNOWBOARD_MAX_PINS when you add a new light type */ -static int const ARDUINO_PINS[LIGHTS_TYPE_NUM] = {13}; -static int const NON_ARDUINO_PINS[LIGHTS_TYPE_NUM] = {31}; +static int const EDISON_ARDUINO_PINS[LIGHTS_TYPE_NUM] = {13}; +static int const EDISON_MINIBOARD_PINS[LIGHTS_TYPE_NUM] = {31}; +static int const MINNOWBOARD_MAX_PINS[LIGHTS_TYPE_NUM] = {21}; /* * Array of light devices with write_mutex statically initialized @@ -415,19 +416,29 @@ mutex_unlock: */ static int init_module(int type) { - mraa_gpio_context gpio; + mraa_gpio_context gpio = NULL; if (type < 0 || type >= LIGHTS_TYPE_NUM) { return EINVAL; } - gpio = mraa_gpio_init_raw(TRI_STATE_ALL_GPIO_RAW_PIN); - if (gpio != NULL) { - /* Arduino board detected */ - mraa_gpio_close(gpio); - light_devices[type].pin = ARDUINO_PINS[type]; - } else { - light_devices[type].pin = NON_ARDUINO_PINS[type]; + switch(mraa_get_platform_type()) { + case MRAA_INTEL_EDISON_FAB_C: + gpio = mraa_gpio_init_raw(TRI_STATE_ALL_GPIO_RAW_PIN); + if (gpio != NULL) { + /* Arduino board detected */ + mraa_gpio_close(gpio); + light_devices[type].pin = EDISON_ARDUINO_PINS[type]; + } else { + light_devices[type].pin = EDISON_MINIBOARD_PINS[type]; + } + break; + case MRAA_INTEL_MINNOWBOARD_MAX: + light_devices[type].pin = MINNOWBOARD_MAX_PINS[type]; + break; + default: + ALOGE("%s: Hardware platform not supported", __func__); + return EINVAL; } return 0; |