uart: add function mraa_uart_get_dev_path
Used for getting the path to the character device under linux for uart device. i.e. "/dev/ttyS0" Adds paths to existing platforms. Closes #84 Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
@@ -746,10 +746,17 @@ mraa_intel_galileo_gen2()
|
||||
b->spi_bus[0].miso = 12;
|
||||
b->spi_bus[0].sclk = 13;
|
||||
|
||||
int uart_path_length = strlen("/dev/ttyS0") + 1;
|
||||
|
||||
b->uart_dev_count = 1;
|
||||
b->def_uart_dev = 0;
|
||||
b->uart_dev[0].rx = 0;
|
||||
b->uart_dev[0].tx = 1;
|
||||
b->uart_dev[0].device_path = (char*) malloc(sizeof(char) * uart_path_length);
|
||||
if (b->uart_dev[0].device_path == NULL) {
|
||||
goto error;
|
||||
}
|
||||
strncpy(b->uart_dev[0].device_path, "/dev/ttyS0", uart_path_length);
|
||||
|
||||
return b;
|
||||
error:
|
||||
|
||||
Reference in New Issue
Block a user