uart: Make C API use const where appropriate
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user