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:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* 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
|
||||
* 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]
|
||||
Reference in New Issue
Block a user