00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _USHELL_TASK_H_
00012 #define _USHELL_TASK_H_
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #define CMD_NONE 0x00
00023 #define CMD_HELP 0x01
00024 #define CMD_RUN 0x02
00025 #define CMD_STOP 0x03
00026 #define CMD_FORWARD 0x04
00027 #define CMD_BACKWARD 0x05
00028 #define CMD_SET_SPEED 0x06
00029 #define CMD_GET_ID 0x07
00030 #define CMD_GET_STATUS0 0x08
00031 #define CMD_GET_STATUS1 0x09
00032
00033
00034
00035 #define CR 0x0D
00036 #define LF 0x0A
00037 #define CTRL_Q 0x11
00038 #define CTRL_C 0x03
00039 #define BKSPACE_CHAR 0x08
00040 #define ABORT_CHAR CTRL_C
00041 #define QUIT_APPEND CTRL_Q
00042
00043
00044 #define STR_RUN "ru"
00045 #define STR_STOP "st"
00046 #define STR_HELP "help"
00047 #define STR_FORWARD "fw"
00048 #define STR_BACKWARD "bw"
00049 #define STR_SET_SPEED "ss"
00050 #define STR_GET_ID "gi"
00051 #define STR_GET_STATUS0 "g0"
00052 #define STR_GET_STATUS1 "g1"
00053
00054
00055 #define MSG_PROMPT "\r>"
00056 #define MSG_WELCOME "\rATMEL Motor Control Interface"
00057 #define MSG_ER_CMD_NOT_FOUND "Unknown Command"
00058 #define MSG_HELP "\r\
00059 ru : run\r\
00060 st : stop\r\
00061 fw : forward\r\
00062 bw : backward\r\
00063 ss : set speed\r\
00064 gi : get id\
00065 "
00066
00067
00068
00069 void build_cmd(void);
00070 void parse_cmd(void);
00071
00072 #ifdef __ICCAVR__ // IAR C Compiler
00073 U8 mystrncmp(U8 *str1,U8 code *str2,U8 i);
00074 void print_msg(U8 code *str);
00075 #endif
00076
00077 #ifdef __GNUC__ // GNU C Compiler
00078 U8 mystrncmp(U8 *str1,U8 *str2,U8 i);
00079 void print_msg(U8 *str);
00080 #endif
00081
00082 void ushell_task_init(void);
00083 void ushell_task(void);
00084
00085 #endif
00086