#include "config.h"


Go to the source code of this file.
Defines | |
| #define | CMD_BACKWARD 0x04 |
| #define | CMD_FORWARD 0x03 |
| #define | CMD_GET_ID 0x08 |
| #define | CMD_GET_STATUS 0x07 |
| #define | CMD_NONE 0x00 |
| #define | CMD_RD_REGPARAM 0x0A |
| #define | CMD_RUN 0x01 |
| #define | CMD_SET_JP 0x06 |
| #define | CMD_SET_SPEED 0x05 |
| #define | CMD_STOP 0x02 |
| #define | CMD_WR_REGPARAM 0x09 |
Functions | |
| void | build_cmd (void) |
| void | parse_cmd (void) |
| void | ushell_task (void) |
| Entry point of the explorer task management. | |
| void | ushell_task_init (void) |
| This function initializes the hardware/software ressources required for ushell task. | |
Variables | |
| unsigned char | data_received |
| unsigned char | data_to_send |
| Bool | is_data_received |
| Bool | is_data_to_send |
| volatile Bool | ushell_active |
| #define CMD_BACKWARD 0x04 |
| #define CMD_FORWARD 0x03 |
| #define CMD_GET_ID 0x08 |
| #define CMD_GET_STATUS 0x07 |
| #define CMD_NONE 0x00 |
| #define CMD_RD_REGPARAM 0x0A |
Definition at line 32 of file ushell_task.h.
| #define CMD_RUN 0x01 |
| #define CMD_SET_JP 0x06 |
Definition at line 28 of file ushell_task.h.
| #define CMD_SET_SPEED 0x05 |
| #define CMD_STOP 0x02 |
| #define CMD_WR_REGPARAM 0x09 |
Definition at line 31 of file ushell_task.h.
| void build_cmd | ( | void | ) |
| void parse_cmd | ( | void | ) |
| void ushell_task | ( | void | ) |
Entry point of the explorer task management.
This function links perform ushell task decoding to access file system functions.
| none |
Definition at line 67 of file ushell_task.c.
References BOARD_ID, CMD_BACKWARD, CMD_FORWARD, CMD_GET_ID, CMD_GET_STATUS, CMD_NONE, CMD_RUN, CMD_SET_SPEED, CMD_STOP, current, data_received, motorControlFlags_t::direction, DIRECTION_FORWARD, DIRECTION_REVERSE, FALSE, is_data_received, LSB, MSB, REV_ID, SOFT_ID, speed, motorControlFlags_t::speed, motorControlFlags_t::state, STATE_RUN, STATE_STOP, TRUE, ushell_active, USI_TWI_Receive_Byte(), and USI_TWI_Transmit_Byte().
Referenced by main().
00068 { 00069 if (is_data_received) //Something new of the UART ? 00070 { 00071 is_data_received=FALSE; 00072 switch (data_received) 00073 { 00074 case CMD_RUN: 00075 mcFastFlags.state = STATE_RUN; 00076 mcFastFlags.speed = (U16)(LSB(speed)<<2); 00077 break; 00078 00079 case CMD_STOP: 00080 mcFastFlags.state = STATE_STOP; 00081 break; 00082 00083 case CMD_FORWARD: 00084 mcFastFlags.direction = DIRECTION_FORWARD; 00085 break; 00086 00087 case CMD_BACKWARD: 00088 mcFastFlags.direction = DIRECTION_REVERSE; 00089 break; 00090 00091 case CMD_SET_SPEED: 00092 MSB(speed) = USI_TWI_Receive_Byte(); 00093 LSB(speed) = USI_TWI_Receive_Byte(); 00094 mcFastFlags.speed = (U16)(LSB(speed)<<2); 00095 break; 00096 00097 case CMD_GET_ID: 00098 USI_TWI_Transmit_Byte(BOARD_ID); 00099 USI_TWI_Transmit_Byte(SOFT_ID); 00100 USI_TWI_Transmit_Byte(REV_ID); 00101 break; 00102 00103 case CMD_GET_STATUS: 00104 // if(SpeedMeasure!=0) 00105 // current=12; 00106 // USI_TWI_Transmit_Byte(MSB(SpeedMeasure)); 00107 // USI_TWI_Transmit_Byte(LSB(SpeedMeasure)); 00108 USI_TWI_Transmit_Byte(MSB(speed)); 00109 USI_TWI_Transmit_Byte(LSB(speed)); 00110 USI_TWI_Transmit_Byte(MSB(current)); 00111 USI_TWI_Transmit_Byte(LSB(current)); 00112 00113 ushell_active = TRUE; 00114 break; 00115 default: //Unknown command 00116 break; 00117 } 00118 data_received=CMD_NONE; 00119 } 00120 }

| void ushell_task_init | ( | void | ) |
This function initializes the hardware/software ressources required for ushell task.
| none |
Definition at line 48 of file ushell_task.c.
Referenced by main().
00049 { 00050 #ifdef __GNUC__ 00051 // fdevopen((int (*)(char, FILE*))(USI_TWI_Transmit_Byte),(int (*)(FILE*))USI_TWI_Receive_Byte); //for printf redirection 00052 #endif 00053 }
| unsigned char data_received |
| unsigned char data_to_send |
| volatile Bool ushell_active |
1.5.7.1