diff options
author | Constantin Musca <constantin.musca@intel.com> | 2016-01-08 13:25:53 +0200 |
---|---|---|
committer | Bruce Beare <bruce.j.beare@intel.com> | 2016-01-11 16:15:10 -0800 |
commit | 39bbf3e39686a35fbc19b1b9b3d2f1e03a8f72c6 (patch) | |
tree | ec5062087e60b7132d8ff5082a46dc8019fdd5ae | |
parent | 2a67f2c7bad3e2a1fa11679c19d0d71c301fe6c1 (diff) | |
download | intel-39bbf3e39686a35fbc19b1b9b3d2f1e03a8f72c6.tar.gz |
light: add support for Minnowboard Max
Use mraa_get_platform_type to detect the platform and
add support for Minnowboard Max.
BUG=none
Change-Id: Ib968f5f0662af09e525a4e0525aa1dbdf3fca36a
Tracked-On: https://jira01.devtools.intel.com/browse/BP-188
Signed-off-by: Constantin Musca <constantin.musca@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
-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; |