summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-08-22 19:42:32 +0800
committerGitHub <[email protected]>2021-08-22 19:42:32 +0800
commita280fb8f2a1aa7445ad475d94fdc4e3af5b6e071 (patch)
treee7ceb169f1cc8282d3849c190441400d3b14af53 /components
parentaf52c577a27253f2867c7255e47eac0d87517e8a (diff)
parent60aaa9f9d831427054477be9d5e70014b02cf804 (diff)
Merge pull request #4964 from mysterywolf/finshgetchar
[finsh] 将finsh_getchar函数暴露出来
Diffstat (limited to 'components')
-rw-r--r--components/finsh/shell.c8
-rw-r--r--components/finsh/shell.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index c89139c0ed..87dc6e0745 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -164,7 +164,7 @@ void finsh_set_prompt_mode(rt_uint32_t prompt_mode)
shell->prompt_mode = prompt_mode;
}
-static int finsh_getchar(void)
+char finsh_getchar(void)
{
#ifdef RT_USING_DEVICE
#ifdef RT_USING_POSIX
@@ -176,7 +176,7 @@ static int finsh_getchar(void)
while (rt_device_read(shell->device, -1, &ch, 1) != 1)
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
- return (int)ch;
+ return ch;
#endif
#else
extern char rt_hw_console_getchar(void);
@@ -329,7 +329,7 @@ static void finsh_wait_auth(void)
while (1)
{
/* read one character from device */
- ch = finsh_getchar();
+ ch = (int)finsh_getchar();
if (ch < 0)
{
continue;
@@ -541,7 +541,7 @@ void finsh_thread_entry(void *parameter)
while (1)
{
- ch = finsh_getchar();
+ ch = (int)finsh_getchar();
if (ch < 0)
{
continue;
diff --git a/components/finsh/shell.h b/components/finsh/shell.h
index 6a4dfff113..6a2737f422 100644
--- a/components/finsh/shell.h
+++ b/components/finsh/shell.h
@@ -97,6 +97,7 @@ rt_uint32_t finsh_get_echo(void);
int finsh_system_init(void);
void finsh_set_device(const char* device_name);
const char* finsh_get_device(void);
+char finsh_getchar(void);
rt_uint32_t finsh_get_prompt_mode(void);
void finsh_set_prompt_mode(rt_uint32_t prompt_mode);