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 | |
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')
-rw-r--r-- | apps/examples/serialrx/Makefile | 2 | ||||
-rw-r--r-- | apps/examples/serialrx/send.py | 14 | ||||
-rw-r--r-- | apps/examples/serialrx/serialrx_main.c | 11 |
3 files changed, 14 insertions, 13 deletions
diff --git a/apps/examples/serialrx/Makefile b/apps/examples/serialrx/Makefile index d99fd44a5..66d485b8d 100644 --- a/apps/examples/serialrx/Makefile +++ b/apps/examples/serialrx/Makefile @@ -63,7 +63,7 @@ ROOTDEPPATH = --dep-path . # Built-in application info APPNAME = serialrx -PRIORITY = SCHED_PRIORITY_DEFAULT +PRIORITY = SCHED_PRIORITY_LOW STACKSIZE = 2048 # Common build diff --git a/apps/examples/serialrx/send.py b/apps/examples/serialrx/send.py index 366bd9da0..29477dc26 100644 --- a/apps/examples/serialrx/send.py +++ b/apps/examples/serialrx/send.py @@ -5,16 +5,16 @@ from time import sleep f = open(sys.argv[1], "w") s = "" -while len(s) < 960: +while len(s) < 11520: s += "1" print("Sending to %s" % sys.argv[1]) while(True): - #f.write(s); - #f.flush(); - for i in range(len(s)): - f.write(s[i]) - f.flush() - #sleep(0.050) + f.write(s); + f.flush(); + #for i in range(len(s)): + # f.write(s[i]) + # f.flush() + # #sleep(0.050) sys.stdout.write(".") sys.stdout.flush() 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; } } |