uart: use const char* instead of plain char*
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
@@ -1067,6 +1067,7 @@ mraa_intel_edison_miniboard(mraa_board_t* b)
|
||||
b->def_uart_dev = 0;
|
||||
b->uart_dev[0].rx = 26;
|
||||
b->uart_dev[0].tx = 35;
|
||||
b->uart_dev[0].device_path = UART_DEV_PATH;
|
||||
|
||||
return MRAA_SUCCESS;
|
||||
}
|
||||
@@ -1365,13 +1366,7 @@ mraa_intel_edison_fab_c()
|
||||
b->def_uart_dev = 0;
|
||||
b->uart_dev[0].rx = 0;
|
||||
b->uart_dev[0].tx = 1;
|
||||
|
||||
int uart_path_length = strlen(UART_DEV_PATH) + 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, UART_DEV_PATH, uart_path_length);
|
||||
b->uart_dev[0].device_path = UART_DEV_PATH;
|
||||
|
||||
int il;
|
||||
for (il =0; il < MRAA_INTEL_EDISON_PINCOUNT; il++) {
|
||||
|
||||
@@ -405,25 +405,15 @@ mraa_intel_galileo_rev_d()
|
||||
b->spi_bus[0].miso = 12;
|
||||
b->spi_bus[0].sclk = 13;
|
||||
|
||||
int uart_path_length = strlen("/dev/ttyS0") + 1;
|
||||
|
||||
b->uart_dev_count = 2;
|
||||
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);
|
||||
b->uart_dev[0].device_path = "/dev/ttyS0";
|
||||
|
||||
b->uart_dev[1].rx = -1;
|
||||
b->uart_dev[1].tx = -1;
|
||||
b->uart_dev[1].device_path = (char*) malloc(sizeof(char) * uart_path_length);
|
||||
if (b->uart_dev[1].device_path == NULL) {
|
||||
goto error;
|
||||
}
|
||||
strncpy(b->uart_dev[1].device_path, "/dev/ttyS1", uart_path_length);
|
||||
b->uart_dev[1].device_path = "/dev/ttyS1";
|
||||
|
||||
return b;
|
||||
error:
|
||||
|
||||
@@ -746,17 +746,11 @@ 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);
|
||||
b->uart_dev[0].device_path = "/dev/ttyS0";
|
||||
|
||||
return b;
|
||||
error:
|
||||
|
||||
Reference in New Issue
Block a user