X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Ftests%2Fhostsim%2Factuator.c;fp=projects%2Fmicrob2010%2Ftests%2Fhostsim%2Factuator.c;h=9c132885a56364b91d0ab174c9c672d372651e0f;hp=0000000000000000000000000000000000000000;hb=87ccd3af8abb0da3e0fa98dc8e9216fc7b676f97;hpb=145b19e73ce5751b365bc53769189addeecee81b diff --git a/projects/microb2010/tests/hostsim/actuator.c b/projects/microb2010/tests/hostsim/actuator.c new file mode 100644 index 0000000..9c13288 --- /dev/null +++ b/projects/microb2010/tests/hostsim/actuator.c @@ -0,0 +1,78 @@ +/* + * Copyright Droids Corporation (2009) + * + * 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 of the License, 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 + * + * Revision : $Id: actuator.c,v 1.3 2009-05-02 10:08:09 zer0 Exp $ + * + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "main.h" +#include "robotsim.h" + +void pwm_set_and_save(void *pwm, int32_t val) +{ + /* we need to do the saturation here, before saving the + * value */ + if (val > 4095) + val = 4095; + if (val < -4095) + val = -4095; + + if (pwm == LEFT_PWM) + mainboard.pwm_l = val; + else if (pwm == RIGHT_PWM) + mainboard.pwm_r = val; +#ifdef HOST_VERSION + robotsim_pwm(pwm, val); +#else + pwm_ng_set(pwm, val); +#endif +} + +void pickup_wheels_on(void) +{ + mainboard.enable_pickup_wheels = 1; +} + +void pickup_wheels_off(void) +{ + mainboard.enable_pickup_wheels = 0; +} +