BLDC control on ATAVRMC303 with ATxMega128A1
ushell_task.h
Go to the documentation of this file.
1 
11 #ifndef _USHELL_TASK_H_
12 #define _USHELL_TASK_H_
13 
14 //_____ I N C L U D E S ____________________________________________________
15 
16 //#include "config.h"
17 
18 //_____ M A C R O S ________________________________________________________
19 
20 
21 // Commands shell
22 #define CMD_NONE 0x00
23 #define CMD_HELP 0x01
24 #define CMD_RUN 0x02
25 #define CMD_STOP 0x03
26 #define CMD_FORWARD 0x04
27 #define CMD_BACKWARD 0x05
28 #define CMD_SET_SPEED 0x06
29 #define CMD_GET_ID 0x07
30 #define CMD_GET_STATUS0 0x08
31 #define CMD_GET_STATUS1 0x09
32 
33 
34 // Special char values
35 #define CR 0x0D
36 #define LF 0x0A
37 #define CTRL_Q 0x11
38 #define CTRL_C 0x03
39 #define BKSPACE_CHAR 0x08
40 #define ABORT_CHAR CTRL_C
41 #define QUIT_APPEND CTRL_Q
42 
43 // String values for commands
44 #define STR_RUN "ru"
45 #define STR_STOP "st"
46 #define STR_HELP "help"
47 #define STR_FORWARD "fw"
48 #define STR_BACKWARD "bw"
49 #define STR_SET_SPEED "ss"
50 #define STR_GET_ID "gi"
51 #define STR_GET_STATUS0 "g0"
52 #define STR_GET_STATUS1 "g1"
53 
54 // String messages
55 #define MSG_PROMPT "\r>"
56 #define MSG_WELCOME "\rATMEL Motor Control Interface"
57 #define MSG_ER_CMD_NOT_FOUND "Unknown Command"
58 #define MSG_HELP "\r\
59 ru : run\r\
60 st : stop\r\
61 fw : forward\r\
62 bw : backward\r\
63 ss : set speed\r\
64 gi : get id\
65 "
66 
67 //_____ D E C L A R A T I O N S ____________________________________________
68 extern volatile Bool ushell_active;
69 
70 
71 void build_cmd(void);
72 void parse_cmd(void);
73 U8 mystrncmp(U8 *str1,U8 code *str2,U8 i);
74 void print_msg(U8 code *str);
75 void ushell_task_init(void);
76 void ushell_task(void);
77 
78 #endif /* _USHELL_TASK_H_ */
79 
U8 mystrncmp(U8 *str1, U8 code *str2, U8 i)
compares two strings located in flash code area.
Definition: ushell_task.c:285
volatile Bool ushell_active
Definition: ushell_task.c:39
void ushell_task(void)
Entry point of the explorer task management.
Definition: ushell_task.c:93
void print_msg(U8 code *str)
Display an ASCII code string.
Definition: ushell_task.c:310
void build_cmd(void)
get the full command line to be interpreted.
Definition: ushell_task.c:161
void parse_cmd(void)
decodes full command line into command type and arguments
Definition: ushell_task.c:209
void ushell_task_init(void)
This function initializes the hardware/software ressources required for ushell task.
Definition: ushell_task.c:66