Private
Public Access
2
0

examples/uart.c: Add a _read call to example

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2015-07-19 12:39:45 +01:00
parent 73e9c2859d
commit e481026227
3 changed files with 14 additions and 6 deletions

View File

@@ -34,7 +34,7 @@
* libmraa. It allows the exposure of UART pins on supported boards. * libmraa. It allows the exposure of UART pins on supported boards.
* With functionality to expand at a later date. * With functionality to expand at a later date.
* *
* @snippet uart_setup.c Interesting * @snippet uart.c Interesting
*/ */
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -8,7 +8,7 @@ add_executable (gpio_read6 gpio_read6.c)
add_executable (spi_mcp4261 spi_mcp4261.c) add_executable (spi_mcp4261 spi_mcp4261.c)
add_executable (mmap-io2 mmap-io2.c) add_executable (mmap-io2 mmap-io2.c)
add_executable (blink_onboard blink_onboard.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 (mraa-gpio mraa-gpio.c)
add_executable (spi_max7219 spi_max7219.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 (spi_mcp4261 mraa)
target_link_libraries (mmap-io2 mraa) target_link_libraries (mmap-io2 mraa)
target_link_libraries (blink_onboard 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 (mraa-gpio mraa)
target_link_libraries (spi_max7219 mraa) target_link_libraries (spi_max7219 mraa)

View File

@@ -1,6 +1,7 @@
/* /*
* Author: Thomas Ingleby <thomas.c.ingleby@intel.com> * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
* Copyright (c) 2014 Intel Corporation. * Author: Brendan Le Foll <brendan.le.foll@intel.com>
* Copyright (c) 2014, 2015 Intel Corporation.
* *
* Permission is hereby granted, free of charge, to any person obtaining * Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the * a copy of this software and associated documentation files (the
@@ -33,10 +34,17 @@ main(int argc, char** argv)
uart = mraa_uart_init(0); uart = mraa_uart_init(0);
if (uart == NULL) { 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(); mraa_deinit();
return 0;
return EXIT_SUCCESS;
} }
//! [Interesting] //! [Interesting]