#include "config.h"
#include "ushell_task.h"
#include "ascii.h"
#include "USI_TWI_Slave.h"

Go to the source code of this file.
Functions | |
| U16 | debug_get_value1 (void) |
| U16 | debug_get_value2 (void) |
| void | MotorSetDutyCycle (U16 duty) |
| 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 | |
| U16 | current |
| volatile U8 | debug8 |
| U8 | direction |
| volatile motorControlFlags_t | mcFastFlags |
| U16 | speed |
| volatile U16 | SpeedMeasure |
| volatile Bool | ushell_active = FALSE |
Copyright (c) 2006 Atmel.
This file manages the µshell task for communication.
Definition in file ushell_task.c.
| U16 debug_get_value1 | ( | void | ) |
| U16 debug_get_value2 | ( | void | ) |
| void MotorSetDutyCycle | ( | U16 | duty | ) |
Definition at line 260 of file main.c.
References TC1_WRITE_10_BIT_REGISTER.
00261 { 00262 TC1_WRITE_10_BIT_REGISTER(OCR1A, duty); 00263 }
| 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 }
Definition at line 38 of file ushell_task.c.
| volatile motorControlFlags_t mcFastFlags |
| volatile U16 SpeedMeasure |
| volatile Bool ushell_active = FALSE |
1.5.7.1