annotate target-utils/helloapp/mygetchar.c @ 114:17b0511b243c

nuc-fw: continuing lowest-level BSP integration
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 24 Oct 2013 02:47:14 +0000
parents 40f607bb0a2c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
1 /*
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
2 * The interactive command entry (editing) function in libcommon
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
3 * will call mygetchar() for its character input. It is supposed
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
4 * to be a blocking wait for input, but in some programs other
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
5 * processing can be done while waiting - for example, check for
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
6 * keypad presses as well. This is the basic version which waits
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
7 * for serial input and nothing else.
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
8 */
1
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 extern int serial_in_poll();
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11
11
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
12 int
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 1
diff changeset
13 mygetchar()
1
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 {
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 register int c;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 do
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 c = serial_in_poll();
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 while (c < 0);
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 return c;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 }