diff --git a/sys/include/isrpipe.h b/sys/include/isrpipe.h index f9bf0460c4..df2fde7439 100644 --- a/sys/include/isrpipe.h +++ b/sys/include/isrpipe.h @@ -52,7 +52,7 @@ typedef struct { * @param[in] buf buffer to use as ringbuffer (must be power of two sized!) * @param[in] bufsize size of @p buf */ -void isrpipe_init(isrpipe_t *isrpipe, char *buf, size_t bufsize); +void isrpipe_init(isrpipe_t *isrpipe, uint8_t *buf, size_t bufsize); /** * @brief Put one character into the isrpipe's buffer @@ -63,7 +63,7 @@ void isrpipe_init(isrpipe_t *isrpipe, char *buf, size_t bufsize); * @returns 0 if character could be added * @returns -1 if buffer was full */ -int isrpipe_write_one(isrpipe_t *isrpipe, char c); +int isrpipe_write_one(isrpipe_t *isrpipe, uint8_t c); /** * @brief Read data from isrpipe (blocking) @@ -74,7 +74,7 @@ int isrpipe_write_one(isrpipe_t *isrpipe, char c); * * @returns number of bytes read */ -int isrpipe_read(isrpipe_t *isrpipe, char *buf, size_t count); +int isrpipe_read(isrpipe_t *isrpipe, uint8_t *buf, size_t count); #ifdef __cplusplus } diff --git a/sys/include/isrpipe/read_timeout.h b/sys/include/isrpipe/read_timeout.h index f37947f19a..984de0c53f 100644 --- a/sys/include/isrpipe/read_timeout.h +++ b/sys/include/isrpipe/read_timeout.h @@ -44,7 +44,7 @@ extern "C" { * @returns number of bytes read * @returns -ETIMEDOUT on timeout */ -int isrpipe_read_timeout(isrpipe_t *isrpipe, char *buf, size_t count, uint32_t timeout); +int isrpipe_read_timeout(isrpipe_t *isrpipe, uint8_t *buf, size_t count, uint32_t timeout); /** * @brief Read data from isrpipe (with timeout, blocking, wait until all read) @@ -60,7 +60,7 @@ int isrpipe_read_timeout(isrpipe_t *isrpipe, char *buf, size_t count, uint32_t t * @returns number of bytes read * @returns -ETIMEDOUT on timeout */ -int isrpipe_read_all_timeout(isrpipe_t *isrpipe, char *buf, size_t count, uint32_t timeout); +int isrpipe_read_all_timeout(isrpipe_t *isrpipe, uint8_t *buf, size_t count, uint32_t timeout); #ifdef __cplusplus } diff --git a/sys/isrpipe/isrpipe.c b/sys/isrpipe/isrpipe.c index 9b8ce170d9..cb01b5b807 100644 --- a/sys/isrpipe/isrpipe.c +++ b/sys/isrpipe/isrpipe.c @@ -19,13 +19,13 @@ #include "isrpipe.h" -void isrpipe_init(isrpipe_t *isrpipe, char *buf, size_t bufsize) +void isrpipe_init(isrpipe_t *isrpipe, uint8_t *buf, size_t bufsize) { mutex_init(&isrpipe->mutex); - tsrb_init(&isrpipe->tsrb, (uint8_t *)buf, bufsize); + tsrb_init(&isrpipe->tsrb, buf, bufsize); } -int isrpipe_write_one(isrpipe_t *isrpipe, char c) +int isrpipe_write_one(isrpipe_t *isrpipe, uint8_t c) { int res = tsrb_add_one(&isrpipe->tsrb, c); @@ -37,11 +37,11 @@ int isrpipe_write_one(isrpipe_t *isrpipe, char c) return res; } -int isrpipe_read(isrpipe_t *isrpipe, char *buffer, size_t count) +int isrpipe_read(isrpipe_t *isrpipe, uint8_t *buffer, size_t count) { int res; - while (!(res = tsrb_get(&isrpipe->tsrb, (uint8_t *)buffer, count))) { + while (!(res = tsrb_get(&isrpipe->tsrb, buffer, count))) { mutex_lock(&isrpipe->mutex); } return res; diff --git a/sys/isrpipe/read_timeout/read_timeout.c b/sys/isrpipe/read_timeout/read_timeout.c index b33a9cbfda..d009131ffc 100644 --- a/sys/isrpipe/read_timeout/read_timeout.c +++ b/sys/isrpipe/read_timeout/read_timeout.c @@ -35,7 +35,7 @@ static void _cb(void *arg) mutex_unlock(_timeout->mutex); } -int isrpipe_read_timeout(isrpipe_t *isrpipe, char *buffer, size_t count, uint32_t timeout) +int isrpipe_read_timeout(isrpipe_t *isrpipe, uint8_t *buffer, size_t count, uint32_t timeout) { int res; @@ -44,7 +44,7 @@ int isrpipe_read_timeout(isrpipe_t *isrpipe, char *buffer, size_t count, uint32_ xtimer_t timer = { .callback = _cb, .arg = &_timeout }; xtimer_set(&timer, timeout); - while (!(res = tsrb_get(&isrpipe->tsrb, (uint8_t *)buffer, count))) { + while (!(res = tsrb_get(&isrpipe->tsrb, buffer, count))) { mutex_lock(&isrpipe->mutex); if (_timeout.flag) { res = -ETIMEDOUT; @@ -57,9 +57,9 @@ int isrpipe_read_timeout(isrpipe_t *isrpipe, char *buffer, size_t count, uint32_ } -int isrpipe_read_all_timeout(isrpipe_t *isrpipe, char *buffer, size_t count, uint32_t timeout) +int isrpipe_read_all_timeout(isrpipe_t *isrpipe, uint8_t *buffer, size_t count, uint32_t timeout) { - char *pos = buffer; + uint8_t *pos = buffer; while (count) { int res = isrpipe_read_timeout(isrpipe, pos, count, timeout);