1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:32:45 +01:00

drivers: ethos: make use of isrpipe module

This commit is contained in:
Kaspar Schleiser 2016-12-13 14:43:31 +01:00
parent dd70231bed
commit 9dea130a9e
2 changed files with 7 additions and 5 deletions

View File

@ -35,6 +35,8 @@
#ifdef USE_ETHOS_FOR_STDIO
#include "uart_stdio.h"
#include "isrpipe.h"
extern isrpipe_t uart_stdio_isrpipe;
#endif
#define ENABLE_DEBUG (0)
@ -100,7 +102,7 @@ static void _handle_char(ethos_t *dev, char c)
#ifdef USE_ETHOS_FOR_STDIO
case ETHOS_FRAME_TYPE_TEXT:
dev->framesize++;
uart_stdio_rx_cb(NULL, c);
isrpipe_write_one(&uart_stdio_isrpipe, c);
#endif
}
}

View File

@ -40,20 +40,20 @@ extern ethos_t ethos;
#include "debug.h"
static char _rx_buf_mem[UART_STDIO_RX_BUFSIZE];
static isrpipe_t _isrpipe = ISRPIPE_INIT(_rx_buf_mem);
isrpipe_t uart_stdio_isrpipe = ISRPIPE_INIT(_rx_buf_mem);
void uart_stdio_init(void)
{
#ifndef USE_ETHOS_FOR_STDIO
uart_init(UART_STDIO_DEV, UART_STDIO_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &_isrpipe);
uart_init(UART_STDIO_DEV, UART_STDIO_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &uart_stdio_isrpipe);
#else
uart_init(ETHOS_UART, ETHOS_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &_isrpipe);
uart_init(ETHOS_UART, ETHOS_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &uart_stdio_isrpipe);
#endif
}
int uart_stdio_read(char* buffer, int count)
{
return isrpipe_read(&_isrpipe, buffer, count);
return isrpipe_read(&uart_stdio_isrpipe, buffer, count);
}
int uart_stdio_write(const char* buffer, int len)