Private
Public Access
2
0

uart: Make C API use const where appropriate

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2015-06-01 09:36:00 +01:00
parent 4628f3f2a0
commit 347fd449f9
2 changed files with 4 additions and 4 deletions

View File

@@ -61,7 +61,7 @@ mraa_uart_context mraa_uart_init(int uart);
* @param path for example "/dev/ttyS0" * @param path for example "/dev/ttyS0"
* @return uart context or NULL * @return uart context or NULL
*/ */
mraa_uart_context mraa_uart_init_raw(char* path); mraa_uart_context mraa_uart_init_raw(const char* path);
/** /**
* Flush the outbound data. * Flush the outbound data.
@@ -153,7 +153,7 @@ int mraa_uart_read(mraa_uart_context dev, char* buf, size_t length);
* @param length maximum size of buffer * @param length maximum size of buffer
* @return the number of bytes written, or -1 if an error occurred * @return the number of bytes written, or -1 if an error occurred
*/ */
int mraa_uart_write(mraa_uart_context dev, char* buf, size_t length); int mraa_uart_write(mraa_uart_context dev, const char* buf, size_t length);
/** /**
* Check to see if data is available on the device for reading * Check to see if data is available on the device for reading

View File

@@ -170,7 +170,7 @@ mraa_uart_init(int index)
} }
mraa_uart_context mraa_uart_context
mraa_uart_init_raw(char* path) mraa_uart_init_raw(const char* path)
{ {
mraa_uart_context dev = (mraa_uart_context) malloc(sizeof(struct _uart)); mraa_uart_context dev = (mraa_uart_context) malloc(sizeof(struct _uart));
if (dev == NULL) { if (dev == NULL) {
@@ -436,7 +436,7 @@ mraa_uart_read(mraa_uart_context dev, char* buf, size_t len)
} }
int int
mraa_uart_write(mraa_uart_context dev, char* buf, size_t len) mraa_uart_write(mraa_uart_context dev, const char* buf, size_t len)
{ {
if (!dev) { if (!dev) {
syslog(LOG_ERR, "uart: write: context is NULL"); syslog(LOG_ERR, "uart: write: context is NULL");