diff --git a/api/mraa/uart.h b/api/mraa/uart.h index 7e46d14..3ca196f 100644 --- a/api/mraa/uart.h +++ b/api/mraa/uart.h @@ -34,7 +34,7 @@ * libmraa. It allows the exposure of UART pins on supported boards. * With functionality to expand at a later date. * - * @snippet uart_setup.c Interesting + * @snippet uart.c Interesting */ #ifdef __cplusplus diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 4f80340..72d9341 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -8,7 +8,7 @@ add_executable (gpio_read6 gpio_read6.c) add_executable (spi_mcp4261 spi_mcp4261.c) add_executable (mmap-io2 mmap-io2.c) add_executable (blink_onboard blink_onboard.c) -add_executable (uart_setup uart_setup.c) +add_executable (uart uart.c) add_executable (mraa-gpio mraa-gpio.c) add_executable (spi_max7219 spi_max7219.c) @@ -24,7 +24,7 @@ target_link_libraries (gpio_read6 mraa) target_link_libraries (spi_mcp4261 mraa) target_link_libraries (mmap-io2 mraa) target_link_libraries (blink_onboard mraa) -target_link_libraries (uart_setup mraa) +target_link_libraries (uart mraa) target_link_libraries (mraa-gpio mraa) target_link_libraries (spi_max7219 mraa) diff --git a/examples/uart_setup.c b/examples/uart.c similarity index 80% rename from examples/uart_setup.c rename to examples/uart.c index b62d975..51268aa 100644 --- a/examples/uart_setup.c +++ b/examples/uart.c @@ -1,6 +1,7 @@ /* * Author: Thomas Ingleby - * Copyright (c) 2014 Intel Corporation. + * Author: Brendan Le Foll + * Copyright (c) 2014, 2015 Intel Corporation. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -33,10 +34,17 @@ main(int argc, char** argv) uart = mraa_uart_init(0); if (uart == NULL) { - fprintf(stdout, "UART failed to setup\n"); + fprintf(stderr, "UART failed to setup\n"); + return EXIT_FAILURE; } + char buffer[] = "Hello Mraa!"; + mraa_uart_write(uart, buffer, sizeof(buffer)); + + mraa_uart_stop(uart); + mraa_deinit(); - return 0; + + return EXIT_SUCCESS; } //! [Interesting]