[tuxdroid-svn] r758 - in firmware: tuxcore/trunk tuxdefs
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2007-12-06 17:17:51
|
Author: jaguarondi Date: 2007-12-06 18:17:52 +0100 (Thu, 06 Dec 2007) New Revision: 758 Modified: firmware/tuxcore/trunk/motors.c firmware/tuxdefs/defines.h Log: * Minor changes. Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2007-12-06 17:07:22 UTC (rev 757) +++ firmware/tuxcore/trunk/motors.c 2007-12-06 17:17:52 UTC (rev 758) @@ -29,6 +29,7 @@ #include "global.h" #include "motors.h" +#include "common/defines.h" /** * \name Braking delays @@ -54,10 +55,6 @@ /** Minimum difference required between the period the flippers are moving from * up to down and from down to up. */ #define FLIPPERS_RESETTIMER_HYST 0x10 -/** Mouth final state */ -#define MOUTH_UDEF 0 -#define MOUTH_OPEN 1 -#define MOUTH_CLOSE 2 /** Number of periods remaining before stopping the eyes. * Normally used when braking, to stop the motor after a short period of @@ -75,7 +72,7 @@ * Normally used when braking, to stop the motor after a short period of * inversion. */ static uint8_t flippers_stop_delay; -/** A flag which indicate the final wanted state for the mouth */ +/** State variable indicating the final requested state for the mouth */ static uint8_t mouth_final_state; /** Number of movements remaining before stopping the flippers. */ uint8_t flippers_move_counter; @@ -393,7 +390,7 @@ if (!(PSW_MOUTH_PIN & PSW_MOUTH_C_MK)) move_mouth(1); if (MOT_MOUTH_PT |= MOT_MOUTH_MK) - mouth_final_state = MOUTH_OPEN; + mouth_final_state = MOUTH_OPENED; move_mouth(2); } @@ -408,7 +405,7 @@ if (!(PSW_MOUTH_PIN & PSW_MOUTH_O_MK)) move_mouth(1); if (MOT_MOUTH_PT |= MOT_MOUTH_MK) - mouth_final_state = MOUTH_CLOSE; + mouth_final_state = MOUTH_CLOSED; move_mouth(2); } @@ -436,16 +433,16 @@ if (mouth_move_counter) { mouth_move_counter--; - if (mouth_final_state != MOUTH_UDEF) + if (mouth_final_state != MOUTH_UNKNOWN) { - if ((mouth_final_state == MOUTH_OPEN) && !(PSW_MOUTH_PIN & PSW_MOUTH_O_MK)) + if ((mouth_final_state == MOUTH_OPENED) && !(PSW_MOUTH_PIN & PSW_MOUTH_O_MK)) mouth_move_counter = 0; - else if ((mouth_final_state == MOUTH_CLOSE) && !(PSW_MOUTH_PIN & PSW_MOUTH_C_MK)) + else if ((mouth_final_state == MOUTH_CLOSED) && !(PSW_MOUTH_PIN & PSW_MOUTH_C_MK)) mouth_move_counter = 0; } if (!mouth_move_counter) { - mouth_final_state = MOUTH_UDEF; + mouth_final_state = MOUTH_UNKNOWN; stop_mouth_motor(); invert_mouth_motor(); mouth_stop_delay = MOUTH_BRAKING_DLY; Modified: firmware/tuxdefs/defines.h =================================================================== --- firmware/tuxdefs/defines.h 2007-12-06 17:07:22 UTC (rev 757) +++ firmware/tuxdefs/defines.h 2007-12-06 17:17:52 UTC (rev 758) @@ -163,7 +163,24 @@ /*! @} */ +/** + * \name Movements + */ +/*! @{ */ + +/** + * Type indicating the mouth position. + */ +typedef enum +{ + MOUTH_UNKNOWN, + MOUTH_OPENED, + MOUTH_CLOSED, +} MOUTH_POSITION_t; + /*! @} */ +/*! @} */ + #endif /* _DEFINES_H_ */ |