[tuxdroid-svn] r837 - firmware/tuxcore/trunk
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-01-07 16:42:42
|
Author: Paul_R Date: 2008-01-07 17:42:34 +0100 (Mon, 07 Jan 2008) New Revision: 837 Modified: firmware/tuxcore/trunk/motors.c firmware/tuxcore/trunk/motors.h Log: * Removed the backup structures (motors_t) Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2008-01-07 16:30:37 UTC (rev 836) +++ firmware/tuxcore/trunk/motors.c 2008-01-07 16:42:34 UTC (rev 837) @@ -31,18 +31,10 @@ #include "motors.h" #include "common/defines.h" /** - * \name Motors structures + * \name Motors PWM * @{ */ -motors_t eyes_params; -motors_t mouth_params; -motors_t flippers_params = -{ - .pwm = 5, -}; -motors_t spin_params = -{ - .pwm = 5, -}; +uint8_t flippers_params_pwm = 5; +uint8_t spin_params_pwm = 5; /*! @} */ /** @@ -185,73 +177,58 @@ \brief Parse the MOTORS_SET_CMD to command a motor with a specific number of movements. \param motor The motor to command \param value The number of movements or/ the timeout valueto execute - \param params bit 0 & 1 : The final state; bit 2 : 0 for count, 1 for timeout + \param param bit 0 : 0 for count, 1 for timeout */ void motors_run(uint8_t motor, uint8_t const value, uint8_t const param) { uint8_t cnt; + if (motor == MOT_EYES) { if (param & 0x01) { - eyes_params.delay = value; eyes_stop_delay = value; cnt = 0; } else - { - eyes_params.count = value; cnt = value; - } blink_eyes(cnt); } else if (motor == MOT_MOUTH) { if (param & 0x01) { - mouth_params.delay = value; mouth_stop_delay = value; cnt = 0; } else - { - mouth_params.count = value; cnt = value; - } move_mouth(cnt); } else if (motor == MOT_FLIPPERS) { if (param & 0x01) { - flippers_params.delay = value; flippers_stop_delay = value; cnt = 0; } else - { - flippers_params.count = value; cnt = value; - } - wave_flippers(cnt, flippers_params.pwm); + wave_flippers(cnt, flippers_params_pwm); } else if (motor == (MOT_SPIN_L) || motor == (MOT_SPIN_R)) { if (param & 0x01) { - spin_params.delay = value; spin_stop_delay = value; cnt = 0; } else - { - spin_params.count = value; cnt = value; - } if (motor == MOT_SPIN_L) - spin_left(value, spin_params.pwm); + spin_left(value, spin_params_pwm); else - spin_right(value, spin_params.pwm); + spin_right(value, spin_params_pwm); } } @@ -261,18 +238,17 @@ \param pwm The PWM value The PWM can be used only for the spinning and the flippers. - */ void motors_config(uint8_t const motor, uint8_t const pwm) { if (motor == MOT_FLIPPERS) { - flippers_params.pwm = pwm; + flippers_params_pwm = pwm; flippers_PWM = pwm; } else if (motor == (MOT_SPIN_L) || motor == (MOT_SPIN_R)) { - spin_params.pwm = pwm; + spin_params_pwm = pwm; spin_PWM = pwm; } } Modified: firmware/tuxcore/trunk/motors.h =================================================================== --- firmware/tuxcore/trunk/motors.h 2008-01-07 16:30:37 UTC (rev 836) +++ firmware/tuxcore/trunk/motors.h 2008-01-07 16:42:34 UTC (rev 837) @@ -106,19 +106,4 @@ */ extern void motor_control(void); -/* - * Motors status structure - */ -typedef struct motors_t -{ - uint8_t count; - uint8_t pwm; - uint8_t delay; -} motors_t; - -extern motors_t eyes_params; -extern motors_t mouth_params; -extern motors_t flippers_params; -extern motors_t spin_params; - #endif /* _MOTORS_H_ */ |