diff options
author | Bruce Beare <bruce.j.beare@intel.com> | 2016-01-05 20:41:16 -0800 |
---|---|---|
committer | Bruce Beare <bruce.j.beare@intel.com> | 2016-01-05 20:41:16 -0800 |
commit | b2972b2fea271e1aa9f7874689ffc92b2b0bd64a (patch) | |
tree | a3734358166de1332f0441c2d0662f0c73c0843c | |
parent | 259c4ae0e05f7ae3c5c0565629ab4ccb485f57c4 (diff) | |
download | intel-b2972b2fea271e1aa9f7874689ffc92b2b0bd64a.tar.gz |
Add mraa init call
The mraa library needs to be initialized to ensure that the
mappings are correctly loaded. A comment pointing to a
table with the GPIO mappings to MRAA parameters is also
added.
BUG=none
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Change-Id: I388be411516cd7df0745722b36812a246ef5886c
-rw-r--r-- | peripheral/examples/edison_arduino/gpio_input/OutputGPIO.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/peripheral/examples/edison_arduino/gpio_input/OutputGPIO.cpp b/peripheral/examples/edison_arduino/gpio_input/OutputGPIO.cpp index 55855f8..5f30fbb 100644 --- a/peripheral/examples/edison_arduino/gpio_input/OutputGPIO.cpp +++ b/peripheral/examples/edison_arduino/gpio_input/OutputGPIO.cpp @@ -23,6 +23,10 @@ * The on-board LED on the Edison Arudino expansion board may be * accessed with Digital I/O 13 (mapped from Linux GPIO 243): * example-gpio-output -p 13 -s + * + * See the following link for a table to map from the numbers on the + * board silk screen to the libmraa GPIO numbers: + * https://learn.sparkfun.com/tutorials/installing-libmraa-on-ubilinux-for-edison */ #include <getopt.h> #include <stdio.h> @@ -100,6 +104,7 @@ int main(int argc, char* argv[]) { if (ReadOpts(argc, argv, &options) < 0) return 1; + mraa_init(); mraa_gpio_context m_gpio = mraa_gpio_init(options.pin); if (!m_gpio) { fprintf(stderr, "Unable to initialize GPIO, invalid pin number?\n"); @@ -117,5 +122,6 @@ int main(int argc, char* argv[]) { if (options.clear) mraa_gpio_write(m_gpio, 0); + mraa_gpio_close(m_gpio); return 0; } |