[tuxdroid-svn] r532 - firmware/tuxcore/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2007-09-19 10:57:23
|
Author: jaguarondi Date: 2007-09-19 12:57:20 +0200 (Wed, 19 Sep 2007) New Revision: 532 Modified: firmware/tuxcore/trunk/motors.c firmware/tuxcore/trunk/motors.h Log: * Set parameters of functions as const in the motor module. Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2007-09-19 10:45:56 UTC (rev 531) +++ firmware/tuxcore/trunk/motors.c 2007-09-19 10:57:20 UTC (rev 532) @@ -208,7 +208,7 @@ is raising or lowering the eyelids. 'cnt' can be up to 256. If 'cnt' is null, waving will run indefinitely. */ -void blink_eyes(uint8_t cnt) +void blink_eyes(uint8_t const cnt) { eyes_move_counter = cnt; eyes_stop_delay = 0; @@ -365,7 +365,7 @@ is raising or lowering the eyelids. 'cnt' can be up to 256. If 'cnt' is null, waving will run indefinitely. */ -void move_mouth(uint8_t cnt) +void move_mouth(uint8_t const cnt) { mouth_move_counter = cnt; mouth_stop_delay = 0; @@ -485,7 +485,7 @@ motor. It's possible that the smallest PWM values won't deliver enough power to even start the motor. */ -void wave_flippers(uint8_t cnt, uint8_t pwm) +void wave_flippers(uint8_t const cnt, uint8_t const pwm) { flippers_move_counter = cnt; flippers_PWM = pwm; @@ -645,16 +645,16 @@ \param pwm PWM value assigned to the spinning. \ingroup spin */ -void spin_left(uint8_t angle, uint8_t pwm) +void spin_left(uint8_t const angle, uint8_t const pwm) { + spin_direction = LEFT; + spin_move_counter = angle; /* If the rotation direction is changing and we are not stopped exactly on * the switch (position switch not pressed), we need to increment the angle * value to prevent counting the first switch detection that will happen as * soon as the rotation starts. */ if ((spin_direction == RIGHT) && (PSW_SPIN_PIN & PSW_SPIN_MK)) - angle++; - spin_direction = LEFT; - spin_move_counter = angle; + spin_move_counter++; spin_PWM = pwm; spin_PWM_mask &= ~MOT_SPIN_R_MK; spin_PWM_mask |= MOT_SPIN_L_MK; @@ -666,16 +666,16 @@ \param pwm PWM value assigned to the spinning. \ingroup spin */ -void spin_right(uint8_t angle, uint8_t pwm) +void spin_right(uint8_t const angle, uint8_t const pwm) { + spin_direction = RIGHT; + spin_move_counter = angle; /* If the rotation direction is changing and we are not stopped exactly on * the switch (position switch not pressed), we need to increment the angle * value to prevent counting the first switch detection that will happen as * soon as the rotation starts. */ if ((spin_direction == LEFT) && (PSW_SPIN_PIN & PSW_SPIN_MK)) - angle++; - spin_direction = RIGHT; - spin_move_counter = angle; + spin_move_counter++; spin_PWM = pwm; spin_PWM_mask &= ~MOT_SPIN_L_MK; spin_PWM_mask |= MOT_SPIN_R_MK; Modified: firmware/tuxcore/trunk/motors.h =================================================================== --- firmware/tuxcore/trunk/motors.h 2007-09-19 10:45:56 UTC (rev 531) +++ firmware/tuxcore/trunk/motors.h 2007-09-19 10:57:20 UTC (rev 532) @@ -79,21 +79,21 @@ * Movements */ extern void stop_eyes(void); -extern void blink_eyes(uint8_t cnt); +extern void blink_eyes(uint8_t const cnt); extern void close_eyes(void); extern void open_eyes(void); extern void stop_mouth(void); -extern void move_mouth(uint8_t cnt); +extern void move_mouth(uint8_t const cnt); extern void open_mouth(void); extern void close_mouth(void); extern void stop_flippers(void); extern void reset_flippers(void); -extern void wave_flippers(uint8_t cnt, uint8_t pwm); +extern void wave_flippers(uint8_t const cnt, uint8_t const pwm); extern void lower_flippers(void); extern void raise_flippers(void); extern void stop_spinning(void); -extern void spin_left(uint8_t angle, uint8_t pwm); -extern void spin_right(uint8_t angle, uint8_t pwm); +extern void spin_left(uint8_t const angle, uint8_t const pwm); +extern void spin_right(uint8_t const angle, uint8_t const pwm); /* * Control |