提交 60aaa9f9 编写于 作者: mysterywolf's avatar mysterywolf

[finsh] 将finsh_getchar函数暴露出来

上级 05098bd5
...@@ -164,7 +164,7 @@ void finsh_set_prompt_mode(rt_uint32_t prompt_mode) ...@@ -164,7 +164,7 @@ void finsh_set_prompt_mode(rt_uint32_t prompt_mode)
shell->prompt_mode = prompt_mode; shell->prompt_mode = prompt_mode;
} }
static int finsh_getchar(void) char finsh_getchar(void)
{ {
#ifdef RT_USING_DEVICE #ifdef RT_USING_DEVICE
#ifdef RT_USING_POSIX #ifdef RT_USING_POSIX
...@@ -176,7 +176,7 @@ static int finsh_getchar(void) ...@@ -176,7 +176,7 @@ static int finsh_getchar(void)
while (rt_device_read(shell->device, -1, &ch, 1) != 1) while (rt_device_read(shell->device, -1, &ch, 1) != 1)
rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER); rt_sem_take(&shell->rx_sem, RT_WAITING_FOREVER);
return (int)ch; return ch;
#endif #endif
#else #else
extern char rt_hw_console_getchar(void); extern char rt_hw_console_getchar(void);
...@@ -329,7 +329,7 @@ static void finsh_wait_auth(void) ...@@ -329,7 +329,7 @@ static void finsh_wait_auth(void)
while (1) while (1)
{ {
/* read one character from device */ /* read one character from device */
ch = finsh_getchar(); ch = (int)finsh_getchar();
if (ch < 0) if (ch < 0)
{ {
continue; continue;
...@@ -541,7 +541,7 @@ void finsh_thread_entry(void *parameter) ...@@ -541,7 +541,7 @@ void finsh_thread_entry(void *parameter)
while (1) while (1)
{ {
ch = finsh_getchar(); ch = (int)finsh_getchar();
if (ch < 0) if (ch < 0)
{ {
continue; continue;
......
...@@ -97,6 +97,7 @@ rt_uint32_t finsh_get_echo(void); ...@@ -97,6 +97,7 @@ rt_uint32_t finsh_get_echo(void);
int finsh_system_init(void); int finsh_system_init(void);
void finsh_set_device(const char* device_name); void finsh_set_device(const char* device_name);
const char* finsh_get_device(void); const char* finsh_get_device(void);
char finsh_getchar(void);
rt_uint32_t finsh_get_prompt_mode(void); rt_uint32_t finsh_get_prompt_mode(void);
void finsh_set_prompt_mode(rt_uint32_t prompt_mode); void finsh_set_prompt_mode(rt_uint32_t prompt_mode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册