Updates to the serialrx example from Bob Doison

This commit is contained in:
Gregory Nutt 2014-04-22 09:31:25 -06:00
parent c907a27469
commit 05d21a62e7
4 changed files with 15 additions and 14 deletions

View File

@ -63,7 +63,7 @@ ROOTDEPPATH = --dep-path .
# Built-in application info # Built-in application info
APPNAME = serialrx APPNAME = serialrx
PRIORITY = SCHED_PRIORITY_DEFAULT PRIORITY = SCHED_PRIORITY_LOW
STACKSIZE = 2048 STACKSIZE = 2048
# Common build # Common build

View File

@ -5,16 +5,16 @@ from time import sleep
f = open(sys.argv[1], "w") f = open(sys.argv[1], "w")
s = "" s = ""
while len(s) < 960: while len(s) < 11520:
s += "1" s += "1"
print("Sending to %s" % sys.argv[1]) print("Sending to %s" % sys.argv[1])
while(True): while(True):
#f.write(s); f.write(s);
#f.flush(); f.flush();
for i in range(len(s)): #for i in range(len(s)):
f.write(s[i]) # f.write(s[i])
f.flush() # f.flush()
#sleep(0.050) # #sleep(0.050)
sys.stdout.write(".") sys.stdout.write(".")
sys.stdout.flush() sys.stdout.flush()

View File

@ -51,8 +51,8 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#undef BUFFERED_IO #define BUFFERED_IO
#define CHUNK 960 #define CHUNK 11520
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@ -70,7 +70,7 @@ static int count = 0;
int serialrx_main(int argc, char *argv[]) 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; FAR FILE *f;
printf("Reading from %s\n", argv[1]); printf("Reading from %s\n", argv[1]);
f = fopen(argv[1], "r"); f = fopen(argv[1], "r");
@ -78,14 +78,15 @@ int serialrx_main(int argc, char *argv[])
while(1) while(1)
{ {
#ifdef BUFFERED_IO #ifdef BUFFERED_IO
int ret = fread(&buf[CHUNK], 1, CHUNK, f); int ret = fread(buf, 1, CHUNK, f);
#else #else
int ret = read(f->fs_fd, buf, CHUNK); int ret = read(f->fs_fd, buf, CHUNK);
#endif #endif
count += ret; count += ret;
if (count >= CHUNK) if (count >= CHUNK)
{ {
printf("-"); printf("-");
fflush(stdout);
count -= CHUNK; count -= CHUNK;
} }
} }

View File

@ -484,7 +484,7 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl,
* indicates that the application task was spawned successfully * indicates that the application task was spawned successfully
* but returned failure exit status. * but returned failure exit status.
* *
* Note the priority if not effected by nice-ness. * Note the priority is not effected by nice-ness.
*/ */
#ifdef CONFIG_NSH_FILE_APPS #ifdef CONFIG_NSH_FILE_APPS