Private
Public Access
2
0

mraa.c: do not check return value of mraa_gpio_dir when used on muxes

Doing so breaks galileo gen2 (gpio2) and others. Failing early is rather
pointless in any case so we may as well attempt the write, muxes do not
neccesarily have directions that work

Fixes #68

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-12-15 11:47:21 +00:00
parent f7256f1d5b
commit 71118af233

View File

@@ -132,10 +132,10 @@ mraa_setup_mux_mapped(mraa_pin_t meta)
if (mux_i == NULL) {
return MRAA_ERROR_INVALID_HANDLE;
}
if (mraa_gpio_dir(mux_i, MRAA_GPIO_OUT) != MRAA_SUCCESS) {
mraa_gpio_close(mux_i);
return MRAA_ERROR_UNSPECIFIED;
}
// this function will sometimes fail, however this is not critical as
// long as the write succeeds - Test case galileo gen2 pin2
mraa_gpio_dir(mux_i, MRAA_GPIO_OUT);
if (mraa_gpio_write(mux_i, meta.mux[mi].value) != MRAA_SUCCESS) {
mraa_gpio_close(mux_i);
return MRAA_ERROR_INVALID_RESOURCE;