You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2016/03/01 23:57:59 UTC
[2/7] incubator-mynewt-site git commit: Fill in missing sections for
console API calls. Fix arguments table for console_echo.
Fill in missing sections for console API calls.
Fix arguments table for console_echo.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/2c834ada
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/2c834ada
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/2c834ada
Branch: refs/heads/master
Commit: 2c834ada5d80b5098e14dcad7211ff3b3e623bcd
Parents: dd36771
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Tue Mar 1 10:43:13 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Mar 1 10:44:53 2016 -0800
----------------------------------------------------------------------
docs/os/modules/console/console_echo.md | 2 +-
docs/os/modules/console/console_init.md | 29 +++++++++++++--------
docs/os/modules/console/console_read.md | 36 ++++++++++++++++++---------
docs/os/modules/console/console_write.md | 10 +++-----
4 files changed, 47 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/2c834ada/docs/os/modules/console/console_echo.md
----------------------------------------------------------------------
diff --git a/docs/os/modules/console/console_echo.md b/docs/os/modules/console/console_echo.md
index 36c03ec..6d58c67 100644
--- a/docs/os/modules/console/console_echo.md
+++ b/docs/os/modules/console/console_echo.md
@@ -9,7 +9,7 @@ Controls whether echoing is on or off for the console. When echoing is on, all c
#### Arguments
| Arguments | Description |
-|-------------------------|
+|-----------|-------------|
| on | 1 turns on echoing, 0 turns it off |
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/2c834ada/docs/os/modules/console/console_init.md
----------------------------------------------------------------------
diff --git a/docs/os/modules/console/console_init.md b/docs/os/modules/console/console_init.md
index e9598c5..400523a 100644
--- a/docs/os/modules/console/console_init.md
+++ b/docs/os/modules/console/console_init.md
@@ -7,26 +7,35 @@
Initializes console receive buffer and calls hal funtions hal_uart_init_cbs and hal_uart_config to initialize serial port connection and configure it (e.g. baud rate, flow control etc.)
+Caller registers a function pointer of type void (*console_rx_cb)(int full_line). This function will be called when console receives either a) full line of data or b) when RX buffer in console is full. Note that this function is most likely getting called from interrupt context.
+
#### Arguments
| Arguments | Description |
|-----------|-------------|
-| xx | explain argument xx |
-| yy | explain argument yy |
+| rx_cb | Function pointer, which gets called input is received. |
#### Returned values
-List any values returned.
-Error codes?
+Returns 0 on success.
+Non-zero if HAL UART function calls fail.
#### Notes
-Any special feature/special benefit that we want to tout.
-Does it need to be used with some other specific functions?
-Any caveats to be careful about (e.g. high memory requirements).
#### Example
-Give at least one example of usage.
-
-
+```no-highlight
+int
+main(int argc, char **argv)
+{
+ ....
+
+ /* Init tasks */
+ shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE,
+ SHELL_MAX_INPUT_LEN);
+ console_init(shell_console_rx_cb);
+
+ ....
+}
+```
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/2c834ada/docs/os/modules/console/console_read.md
----------------------------------------------------------------------
diff --git a/docs/os/modules/console/console_read.md b/docs/os/modules/console/console_read.md
index 9c7460f..dce217c 100644
--- a/docs/os/modules/console/console_read.md
+++ b/docs/os/modules/console/console_read.md
@@ -4,28 +4,40 @@ i## <font color="#F2853F" style="font-size:24pt"> console_read </font>
int
console_read(char *str, int cnt)
```
- Calls hal function hal_uart_start_rx to start receiving input from console terminal over serial port.
+
+Copies up to *cnt* bytes of received data to buffer pointed by *str*. Function tries to break the input into separate lines; once it encounters a newline character, it replaces that with end-of-string and returns.
#### Arguments
| Arguments | Description |
|-----------|-------------|
-| xx | explain argument xx |
-| yy | explain argument yy |
+| str | Buffer where data is copied to. |
+| cnt | Maximum number of characters to copy. |
#### Returned values
-List any values returned.
-Error codes?
+Returns the number of characters copied. 0 if there was no data
+available, or if the first received character was '\n'.
#### Notes
-Any special feature/special benefit that we want to tout.
-Does it need to be used with some other specific functions?
-Any caveats to be careful about (e.g. high memory requirements).
-
#### Example
-Give at least one example of usage.
-
-
+```no-highlight
+void
+task1_loop(void *arg)
+{
+ struct os_event *ev;
+ char rx_msg[128];
+ int rx_len;
+
+ while (1) {
+ ev = os_eventq_get(&task1_evq);
+ assert(ev);
+ if (ev->ev_type == CONS_EV_TYPE) {
+ rx_len = console_read(rx_msg, sizeof(rx_msg));
+ if (rx_len) {
+ if (!strncmp(rx_msg, "reset", rx_len)) {
+ assert(0);
+ }
+```
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/2c834ada/docs/os/modules/console/console_write.md
----------------------------------------------------------------------
diff --git a/docs/os/modules/console/console_write.md b/docs/os/modules/console/console_write.md
index 1d7a524..322f922 100644
--- a/docs/os/modules/console/console_write.md
+++ b/docs/os/modules/console/console_write.md
@@ -4,25 +4,21 @@
void
console_write(char *str, int cnt)
```
-Transmit characters to console display over serial port.
+Queues characters to console display over serial port.
#### Arguments
| Arguments | Description |
|-----------|-------------|
| *str | pointer to the character or packet to be transmitted |
-| cnt | size of the character or packet |
+| cnt | number of characters in *str* |
#### Returned values
-List any values returned.
-Error codes?
+N/A
#### Notes
-Any special feature/special benefit that we want to tout.
-Does it need to be used with some other specific functions?
-Any caveats to be careful about (e.g. high memory requirements).
#### Example