Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
bt_shell/shell/tinyshell/tinysh.h@4:05484073a641, 2015-03-22 (annotated)
- Committer:
- majik
- Date:
- Sun Mar 22 06:34:30 2015 +0000
- Revision:
- 4:05484073a641
- Parent:
- 0:21019d94ad33
BOTH IMUs WORK NOW. Put them in separate threads. Servo is included.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| majik | 0:21019d94ad33 | 1 | /* |
| majik | 0:21019d94ad33 | 2 | * tinysh.h |
| majik | 0:21019d94ad33 | 3 | * |
| majik | 0:21019d94ad33 | 4 | * Header for minimal portable shell |
| majik | 0:21019d94ad33 | 5 | * |
| majik | 0:21019d94ad33 | 6 | * Copyright (C) 2001 Michel Gutierrez <mig@nerim.net> |
| majik | 0:21019d94ad33 | 7 | * |
| majik | 0:21019d94ad33 | 8 | * This library is free software; you can redistribute it and/or |
| majik | 0:21019d94ad33 | 9 | * modify it under the terms of the GNU Lesser General Public |
| majik | 0:21019d94ad33 | 10 | * License as published by the Free Software Foundation; either |
| majik | 0:21019d94ad33 | 11 | * version 2.1 of the License, or (at your option) any later version. |
| majik | 0:21019d94ad33 | 12 | * |
| majik | 0:21019d94ad33 | 13 | * This library is distributed in the hope that it will be useful, |
| majik | 0:21019d94ad33 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| majik | 0:21019d94ad33 | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| majik | 0:21019d94ad33 | 16 | * Lesser General Public License for more details. |
| majik | 0:21019d94ad33 | 17 | * |
| majik | 0:21019d94ad33 | 18 | * You should have received a copy of the GNU Lesser General Public |
| majik | 0:21019d94ad33 | 19 | * License along with this library; if not, write to the Free |
| majik | 0:21019d94ad33 | 20 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| majik | 0:21019d94ad33 | 21 | */ |
| majik | 0:21019d94ad33 | 22 | |
| majik | 0:21019d94ad33 | 23 | typedef void (*tinysh_fnt_t)(int argc, char **argv); |
| majik | 0:21019d94ad33 | 24 | |
| majik | 0:21019d94ad33 | 25 | typedef struct tinysh_cmd_t { |
| majik | 0:21019d94ad33 | 26 | struct tinysh_cmd_t *parent; /* 0 if top level command */ |
| majik | 0:21019d94ad33 | 27 | char *name; /* command input name, not 0 */ |
| majik | 0:21019d94ad33 | 28 | char *help; /* help string, can be 0 */ |
| majik | 0:21019d94ad33 | 29 | char *usage; /* usage string, can be 0 */ |
| majik | 0:21019d94ad33 | 30 | tinysh_fnt_t function; /* function to launch on cmd, can be 0 */ |
| majik | 0:21019d94ad33 | 31 | void *arg; /* current argument when function called */ |
| majik | 0:21019d94ad33 | 32 | struct tinysh_cmd_t *next; /* must be set to 0 at init */ |
| majik | 0:21019d94ad33 | 33 | struct tinysh_cmd_t *child; /* must be set to 0 at init */ |
| majik | 0:21019d94ad33 | 34 | } tinysh_cmd_t; |
| majik | 0:21019d94ad33 | 35 | |
| majik | 0:21019d94ad33 | 36 | #ifdef __cplusplus |
| majik | 0:21019d94ad33 | 37 | extern "C" { |
| majik | 0:21019d94ad33 | 38 | #endif |
| majik | 0:21019d94ad33 | 39 | |
| majik | 0:21019d94ad33 | 40 | |
| majik | 0:21019d94ad33 | 41 | extern int echo; |
| majik | 0:21019d94ad33 | 42 | |
| majik | 0:21019d94ad33 | 43 | /* |
| majik | 0:21019d94ad33 | 44 | * function void tinysh_char_out(unsigned char) must be provided by |
| majik | 0:21019d94ad33 | 45 | * the application |
| majik | 0:21019d94ad33 | 46 | */ |
| majik | 0:21019d94ad33 | 47 | void tinysh_char_out(unsigned char c); |
| majik | 0:21019d94ad33 | 48 | |
| majik | 0:21019d94ad33 | 49 | /* |
| majik | 0:21019d94ad33 | 50 | * Functions below are provided by the tinysh module |
| majik | 0:21019d94ad33 | 51 | */ |
| majik | 0:21019d94ad33 | 52 | |
| majik | 0:21019d94ad33 | 53 | /* new character input */ |
| majik | 0:21019d94ad33 | 54 | void tinysh_char_in(unsigned char c); |
| majik | 0:21019d94ad33 | 55 | |
| majik | 0:21019d94ad33 | 56 | /* add a new command */ |
| majik | 0:21019d94ad33 | 57 | void tinysh_add_command(tinysh_cmd_t *cmd); |
| majik | 0:21019d94ad33 | 58 | |
| majik | 0:21019d94ad33 | 59 | /* change tinysh prompt */ |
| majik | 0:21019d94ad33 | 60 | void tinysh_set_prompt(char *str); |
| majik | 0:21019d94ad33 | 61 | |
| majik | 0:21019d94ad33 | 62 | /* get command argument back */ |
| majik | 0:21019d94ad33 | 63 | void *tinysh_get_arg(); |
| majik | 0:21019d94ad33 | 64 | |
| majik | 0:21019d94ad33 | 65 | /* provide conversion string to scalar (decimal or hexadecimal) */ |
| majik | 0:21019d94ad33 | 66 | unsigned long tinysh_atoxi(char *s); |
| majik | 0:21019d94ad33 | 67 | |
| majik | 0:21019d94ad33 | 68 | #ifdef __cplusplus |
| majik | 0:21019d94ad33 | 69 | } |
| majik | 0:21019d94ad33 | 70 | #endif |
| majik | 0:21019d94ad33 | 71 | |
| majik | 0:21019d94ad33 | 72 |