diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-04-22 09:31:25 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-04-22 09:31:25 -0600 |
commit | 180c5eab363381c8feb8025409787fdefebd5a08 (patch) | |
tree | 499d55bbc07731a7a2ecdbb10e17181fa010a277 /apps/examples/serialrx/serialrx_main.c | |
parent | 9e172d2430639aff338247c7dc3da821dd468584 (diff) | |
download | nuttx-180c5eab363381c8feb8025409787fdefebd5a08.tar.gz nuttx-180c5eab363381c8feb8025409787fdefebd5a08.tar.bz2 nuttx-180c5eab363381c8feb8025409787fdefebd5a08.zip |
Updates to the serialrx example from Bob Doison
Diffstat (limited to 'apps/examples/serialrx/serialrx_main.c')
-rw-r--r-- | apps/examples/serialrx/serialrx_main.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/apps/examples/serialrx/serialrx_main.c b/apps/examples/serialrx/serialrx_main.c index 4ff672098..21b3d9494 100644 --- a/apps/examples/serialrx/serialrx_main.c +++ b/apps/examples/serialrx/serialrx_main.c @@ -51,8 +51,8 @@ * Pre-processor Definitions ****************************************************************************/ -#undef BUFFERED_IO -#define CHUNK 960 +#define BUFFERED_IO +#define CHUNK 11520 /**************************************************************************** * Private Data @@ -70,7 +70,7 @@ static int count = 0; int serialrx_main(int argc, char *argv[]) { - FAR char *buf = (FAR char *)malloc(CHUNK*3); + FAR char *buf = (FAR char *)malloc(CHUNK); FAR FILE *f; printf("Reading from %s\n", argv[1]); f = fopen(argv[1], "r"); @@ -78,14 +78,15 @@ int serialrx_main(int argc, char *argv[]) while(1) { #ifdef BUFFERED_IO - int ret = fread(&buf[CHUNK], 1, CHUNK, f); + int ret = fread(buf, 1, CHUNK, f); #else - int ret = read(f->fs_fd, buf, CHUNK); + int ret = read(f->fs_fd, buf, CHUNK); #endif count += ret; if (count >= CHUNK) { printf("-"); + fflush(stdout); count -= CHUNK; } } |