Browse Source

drivers: ethos: make use of isrpipe module

pr/spi.typo
Kaspar Schleiser 6 years ago
parent
commit
9dea130a9e
  1. 4
      drivers/ethos/ethos.c
  2. 8
      sys/uart_stdio/uart_stdio.c

4
drivers/ethos/ethos.c

@ -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
}
}

8
sys/uart_stdio/uart_stdio.c

@ -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)

Loading…
Cancel
Save