From b2972b2fea271e1aa9f7874689ffc92b2b0bd64a Mon Sep 17 00:00:00 2001 From: Bruce Beare Date: Tue, 5 Jan 2016 20:41:16 -0800 Subject: 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 Change-Id: I388be411516cd7df0745722b36812a246ef5886c --- peripheral/examples/edison_arduino/gpio_input/OutputGPIO.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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 #include @@ -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; } -- cgit v1.2.3