[tuxdroid-svn] r1292 - in software_suite_v2/middleware/tuxdriver/trunk: src unix win32
Status: Beta
Brought to you by:
ks156
From: remi <c2m...@c2...> - 2008-07-02 07:04:21
|
Author: remi Date: 2008-07-02 09:04:25 +0200 (Wed, 02 Jul 2008) New Revision: 1292 Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_flippers.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_flippers.h Removed: software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.h Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile Log: *renamed tux_wings.* to tux_flippers.* Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-07-01 16:32:24 UTC (rev 1291) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-07-02 07:04:25 UTC (rev 1292) @@ -39,7 +39,7 @@ #include "tux_types.h" #include "tux_usb.h" #include "tux_user_inputs.h" -#include "tux_wings.h" +#include "tux_flippers.h" #define NRCMDS 512 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-07-01 16:32:24 UTC (rev 1291) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-07-02 07:04:25 UTC (rev 1292) @@ -39,7 +39,7 @@ #include "tux_user_inputs.h" #include "tux_spinning.h" #include "tux_usb.h" -#include "tux_wings.h" +#include "tux_flippers.h" #include "version.h" static bool driver_started = false; Copied: software_suite_v2/middleware/tuxdriver/trunk/src/tux_flippers.c (from rev 1291, software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c) =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_flippers.c (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_flippers.c 2008-07-02 07:04:25 UTC (rev 1292) @@ -0,0 +1,177 @@ +/* + * Tux Droid - Wings + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include <string.h> + +#include "tux_cmd_parser.h" +#include "tux_hw_status.h" +#include "tux_hw_cmd.h" +#include "tux_movements.h" +#include "tux_sw_status.h" +#include "tux_types.h" +#include "tux_usb.h" +#include "tux_flippers.h" + +static unsigned char mvmt_counter = 0; + +/** + * + */ +LIBLOCAL void +tux_wings_update_position(void) +{ + char *new_position = ""; + + if (!hw_status_table.position2.wings_down) + { + new_position = STRING_VALUE_DOWN; + } + else + { + new_position = STRING_VALUE_UP; + } + + tux_sw_status_set_strvalue(SW_ID_WINGS_POSITION, new_position, true); +} + +/** + * Update the status of the motor state of the flippers. + */ +LIBLOCAL void +tux_wings_update_motor(void) +{ + unsigned char new_state; + + new_state = hw_status_table.position2.motors.bits.flippers_on; + tux_sw_status_set_intvalue(SW_ID_FLIPPERS_MOTOR_ON, new_state, true); +} + +/** + * + */ +LIBLOCAL void +tux_wings_update_movements_remaining(void) +{ + unsigned char new_count; + + new_count = hw_status_table.position1.wings_remaining_mvm; + + mvmt_counter = new_count; + tux_sw_status_set_intvalue(SW_ID_WINGS_REMAINING_MVM, new_count, true); +} + +/** + * + */ +LIBLOCAL bool +tux_wings_cmd_speed(unsigned char speed) +{ + return tux_movement_perform(MOVE_FLIPPERS, 0, 0.0, speed, + FINAL_ST_UNDEFINED, true); +} + +/** + * + */ +LIBLOCAL bool +tux_wings_cmd_on(unsigned char counter, unsigned char final_state) +{ + return tux_movement_cmd_on(MOVE_FLIPPERS, counter, final_state); +} + +/** + * + */ +LIBLOCAL bool +tux_wings_cmd_on_during(float timeout, unsigned char final_state) +{ + bool ret; + data_frame frame = {WINGS_WAVE_CMD, 0, 5, 0}; + delay_cmd_t cmd = { 0.0, TUX_CMD, WINGS }; + + /* Short movements */ + if (timeout < 0.3) + { + return tux_movement_perform(MOVE_FLIPPERS, 0, timeout, 5, final_state, + false); + } + + /* Long movements */ + ret = tux_usb_send_to_tux(frame); + if (!ret) + { + return false; + } + + mvmt_counter = 255; + tux_sw_status_set_intvalue(SW_ID_WINGS_REMAINING_MVM, mvmt_counter, true); + + switch (final_state) { + case FINAL_ST_UNDEFINED: + cmd.sub_command = OFF; + break; + case FINAL_ST_OPEN_UP: + cmd.sub_command = UP; + break; + case FINAL_ST_CLOSE_DOWN: + cmd.sub_command = DOWN; + break; + case FINAL_ST_STOP: + cmd.sub_command = OFF; + break; + } + ret = tux_cmd_parser_insert_sys_command(timeout, &cmd); + + return ret; +} + +/** + * + */ +LIBLOCAL bool +tux_wings_cmd_up(void) +{ + return tux_movement_perform(MOVE_FLIPPERS, 0, 0, 5, FINAL_ST_OPEN_UP, false); +} + +/** + * + */ +LIBLOCAL bool +tux_wings_cmd_down(void) +{ + return tux_movement_perform(MOVE_FLIPPERS, 0, 0, 5, FINAL_ST_CLOSE_DOWN, false); +} + +/** + * + */ +LIBLOCAL bool +tux_wings_cmd_off(void) +{ + bool ret; + + tux_cmd_parser_clean_sys_command(WINGS); + ret = tux_movement_perform(MOVE_FLIPPERS, 0, 0, 5, FINAL_ST_STOP, false); + mvmt_counter = 0; + tux_sw_status_set_intvalue(SW_ID_WINGS_REMAINING_MVM, mvmt_counter, true); + + return ret; +} Copied: software_suite_v2/middleware/tuxdriver/trunk/src/tux_flippers.h (from rev 1291, software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.h) =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_flippers.h (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_flippers.h 2008-07-02 07:04:25 UTC (rev 1292) @@ -0,0 +1,39 @@ +/* + * Tux Droid - Wings + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _TUX_WINGS_H_ +#define _TUX_WINGS_H_ + +#include <stdbool.h> + +#define TUX_WINGS_POSITION_DOWN 0 +#define TUX_WINGS_POSITION_UP 1 + +extern void tux_wings_update_position(void); +extern void tux_wings_update_motor(void); +extern void tux_wings_update_movements_remaining(void); +extern bool tux_wings_cmd_speed(unsigned char speed); +extern bool tux_wings_cmd_on(unsigned char counter, unsigned char final_state); +extern bool tux_wings_cmd_on_during(float timeout, unsigned char final_state); +extern bool tux_wings_cmd_up(void); +extern bool tux_wings_cmd_down(void); +extern bool tux_wings_cmd_off(void); + +#endif /* _TUX_WINGS_H_ */ Deleted: software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c 2008-07-01 16:32:24 UTC (rev 1291) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c 2008-07-02 07:04:25 UTC (rev 1292) @@ -1,177 +0,0 @@ -/* - * Tux Droid - Wings - * Copyright (C) 2008 C2ME Sa - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include <string.h> - -#include "tux_cmd_parser.h" -#include "tux_hw_status.h" -#include "tux_hw_cmd.h" -#include "tux_movements.h" -#include "tux_sw_status.h" -#include "tux_types.h" -#include "tux_usb.h" -#include "tux_wings.h" - -static unsigned char mvmt_counter = 0; - -/** - * - */ -LIBLOCAL void -tux_wings_update_position(void) -{ - char *new_position = ""; - - if (!hw_status_table.position2.wings_down) - { - new_position = STRING_VALUE_DOWN; - } - else - { - new_position = STRING_VALUE_UP; - } - - tux_sw_status_set_strvalue(SW_ID_WINGS_POSITION, new_position, true); -} - -/** - * Update the status of the motor state of the flippers. - */ -LIBLOCAL void -tux_wings_update_motor(void) -{ - unsigned char new_state; - - new_state = hw_status_table.position2.motors.bits.flippers_on; - tux_sw_status_set_intvalue(SW_ID_FLIPPERS_MOTOR_ON, new_state, true); -} - -/** - * - */ -LIBLOCAL void -tux_wings_update_movements_remaining(void) -{ - unsigned char new_count; - - new_count = hw_status_table.position1.wings_remaining_mvm; - - mvmt_counter = new_count; - tux_sw_status_set_intvalue(SW_ID_WINGS_REMAINING_MVM, new_count, true); -} - -/** - * - */ -LIBLOCAL bool -tux_wings_cmd_speed(unsigned char speed) -{ - return tux_movement_perform(MOVE_FLIPPERS, 0, 0.0, speed, - FINAL_ST_UNDEFINED, true); -} - -/** - * - */ -LIBLOCAL bool -tux_wings_cmd_on(unsigned char counter, unsigned char final_state) -{ - return tux_movement_cmd_on(MOVE_FLIPPERS, counter, final_state); -} - -/** - * - */ -LIBLOCAL bool -tux_wings_cmd_on_during(float timeout, unsigned char final_state) -{ - bool ret; - data_frame frame = {WINGS_WAVE_CMD, 0, 5, 0}; - delay_cmd_t cmd = { 0.0, TUX_CMD, WINGS }; - - /* Short movements */ - if (timeout < 0.3) - { - return tux_movement_perform(MOVE_FLIPPERS, 0, timeout, 5, final_state, - false); - } - - /* Long movements */ - ret = tux_usb_send_to_tux(frame); - if (!ret) - { - return false; - } - - mvmt_counter = 255; - tux_sw_status_set_intvalue(SW_ID_WINGS_REMAINING_MVM, mvmt_counter, true); - - switch (final_state) { - case FINAL_ST_UNDEFINED: - cmd.sub_command = OFF; - break; - case FINAL_ST_OPEN_UP: - cmd.sub_command = UP; - break; - case FINAL_ST_CLOSE_DOWN: - cmd.sub_command = DOWN; - break; - case FINAL_ST_STOP: - cmd.sub_command = OFF; - break; - } - ret = tux_cmd_parser_insert_sys_command(timeout, &cmd); - - return ret; -} - -/** - * - */ -LIBLOCAL bool -tux_wings_cmd_up(void) -{ - return tux_movement_perform(MOVE_FLIPPERS, 0, 0, 5, FINAL_ST_OPEN_UP, false); -} - -/** - * - */ -LIBLOCAL bool -tux_wings_cmd_down(void) -{ - return tux_movement_perform(MOVE_FLIPPERS, 0, 0, 5, FINAL_ST_CLOSE_DOWN, false); -} - -/** - * - */ -LIBLOCAL bool -tux_wings_cmd_off(void) -{ - bool ret; - - tux_cmd_parser_clean_sys_command(WINGS); - ret = tux_movement_perform(MOVE_FLIPPERS, 0, 0, 5, FINAL_ST_STOP, false); - mvmt_counter = 0; - tux_sw_status_set_intvalue(SW_ID_WINGS_REMAINING_MVM, mvmt_counter, true); - - return ret; -} Deleted: software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.h 2008-07-01 16:32:24 UTC (rev 1291) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.h 2008-07-02 07:04:25 UTC (rev 1292) @@ -1,39 +0,0 @@ -/* - * Tux Droid - Wings - * Copyright (C) 2008 C2ME Sa - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef _TUX_WINGS_H_ -#define _TUX_WINGS_H_ - -#include <stdbool.h> - -#define TUX_WINGS_POSITION_DOWN 0 -#define TUX_WINGS_POSITION_UP 1 - -extern void tux_wings_update_position(void); -extern void tux_wings_update_motor(void); -extern void tux_wings_update_movements_remaining(void); -extern bool tux_wings_cmd_speed(unsigned char speed); -extern bool tux_wings_cmd_on(unsigned char counter, unsigned char final_state); -extern bool tux_wings_cmd_on_during(float timeout, unsigned char final_state); -extern bool tux_wings_cmd_up(void); -extern bool tux_wings_cmd_down(void); -extern bool tux_wings_cmd_off(void); - -#endif /* _TUX_WINGS_H_ */ Modified: software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile 2008-07-01 16:32:24 UTC (rev 1291) +++ software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile 2008-07-02 07:04:25 UTC (rev 1292) @@ -38,7 +38,7 @@ $(OBJ_DIR)/tux_sw_status.o \ $(OBJ_DIR)/tux_usb.o \ $(OBJ_DIR)/tux_user_inputs.o \ - $(OBJ_DIR)/tux_wings.o \ + $(OBJ_DIR)/tux_flippers.o \ $(OBJ_DIR)/log.o @@ -95,7 +95,7 @@ ../src/tux_error.h \ ../src/tux_eyes.h \ ../src/tux_mouth.h \ -../src/tux_wings.h \ +../src/tux_flippers.h \ ../src/tux_spinning.h \ ../src/tux_user_inputs.h \ ../src/tux_leds.h \ @@ -112,7 +112,7 @@ ../src/tux_firmware.h \ ../src/tux_sound_flash.h \ ../src/tux_id.h \ -../src/tux_wings.h \ +../src/tux_flippers.h \ ../src/tux_spinning.h \ ../src/tux_user_inputs.h \ ../src/tux_mouth.h \ @@ -303,7 +303,7 @@ ../src/tux_user_inputs.h $(compile_source) -$(OBJ_DIR)/tux_wings.o: ../src/tux_wings.c \ +$(OBJ_DIR)/tux_flippers.o: ../src/tux_flippers.c \ ../src/tux_hw_status.h \ ../src/tux_sw_status.h \ ../src/tux_misc.h \ @@ -311,7 +311,7 @@ ../src/tux_error.h \ ../src/tux_cmd_parser.h \ ../src/tux_movements.h \ -../src/tux_wings.h +../src/tux_flippers.h $(compile_source) $(OBJ_DIR)/log.o: ../src/log.c \ Modified: software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile 2008-07-01 16:32:24 UTC (rev 1291) +++ software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile 2008-07-02 07:04:25 UTC (rev 1292) @@ -41,7 +41,7 @@ $(OBJ_DIR)/tux_sw_status.o \ $(OBJ_DIR)/tux_usb.o \ $(OBJ_DIR)/tux_user_inputs.o \ - $(OBJ_DIR)/tux_wings.o \ + $(OBJ_DIR)/tux_flippers.o \ $(OBJ_DIR)/log.o define build_target @@ -90,7 +90,7 @@ ../src/tux_error.h \ ../src/tux_eyes.h \ ../src/tux_mouth.h \ -../src/tux_wings.h \ +../src/tux_flippers.h \ ../src/tux_spinning.h \ ../src/tux_user_inputs.h \ ../src/tux_leds.h \ @@ -107,7 +107,7 @@ ../src/tux_firmware.h \ ../src/tux_sound_flash.h \ ../src/tux_id.h \ -../src/tux_wings.h \ +../src/tux_flippers.h \ ../src/tux_spinning.h \ ../src/tux_user_inputs.h \ ../src/tux_mouth.h \ @@ -298,7 +298,7 @@ ../src/tux_user_inputs.h $(compile_source) -$(OBJ_DIR)/tux_wings.o: ../src/tux_wings.c \ +$(OBJ_DIR)/tux_flippers.o: ../src/tux_flippers.c \ ../src/tux_hw_status.h \ ../src/tux_sw_status.h \ ../src/tux_misc.h \ @@ -306,7 +306,7 @@ ../src/tux_error.h \ ../src/tux_cmd_parser.h \ ../src/tux_movements.h \ -../src/tux_wings.h +../src/tux_flippers.h $(compile_source) $(OBJ_DIR)/log.o: ../src/log.c \ |