ushell_task.h File Reference

#include "config.h"

Include dependency graph for ushell_task.h:

This graph shows which files directly or indirectly include this file:

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 Documentation

#define CMD_BACKWARD   0x04

Definition at line 26 of file ushell_task.h.

Referenced by ushell_task().

#define CMD_FORWARD   0x03

Definition at line 25 of file ushell_task.h.

Referenced by ushell_task().

#define CMD_GET_ID   0x08

Definition at line 30 of file ushell_task.h.

Referenced by ushell_task().

#define CMD_GET_STATUS   0x07

Definition at line 29 of file ushell_task.h.

Referenced by ushell_task().

#define CMD_NONE   0x00

Definition at line 22 of file ushell_task.h.

Referenced by ushell_task().

#define CMD_RD_REGPARAM   0x0A

Definition at line 32 of file ushell_task.h.

#define CMD_RUN   0x01

Definition at line 23 of file ushell_task.h.

Referenced by ushell_task().

#define CMD_SET_JP   0x06

Definition at line 28 of file ushell_task.h.

#define CMD_SET_SPEED   0x05

Definition at line 27 of file ushell_task.h.

Referenced by ushell_task().

#define CMD_STOP   0x02

Definition at line 24 of file ushell_task.h.

Referenced by ushell_task().

#define CMD_WR_REGPARAM   0x09

Definition at line 31 of file ushell_task.h.


Function Documentation

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.

Parameters:
none 
Returns:
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 }

Here is the call graph for this function:

void ushell_task_init ( void   ) 

This function initializes the hardware/software ressources required for ushell task.

Parameters:
none 
Returns:
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 }


Variable Documentation

unsigned char data_received

Definition at line 66 of file main.c.

Referenced by main(), and ushell_task().

unsigned char data_to_send

Definition at line 65 of file main.c.

Definition at line 64 of file main.c.

Referenced by main(), and ushell_task().

Definition at line 63 of file main.c.

Referenced by main().

volatile Bool ushell_active

Definition at line 37 of file ushell_task.c.

Referenced by ushell_task().


Generated on Wed Oct 22 16:03:26 2008 for AVR496 : Atmel BLDC control on ATAVRMC301 with ATtiny861 by  doxygen 1.5.7.1