2 * Copyright Droids Corporation, Microb Technology, Eirbot (2005)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Revision : $Id: main.c,v 1.2.2.3 2007-05-23 17:18:13 zer0 Exp $
23 #include <aversive/wait.h>
26 #include <brushless.h>
30 #include <diagnostic.h>
34 #include <aversive/pgmspace.h>
40 void event0(brushless mesures)
43 static int8_t dir = 1;
54 brushless_0_set_parameters(BRUSHLESS_MAX_SPEED, PWM_MAX/10*cpt /1 );
56 printf_P(PSTR("vitesse M0 : %5i t/s %5i t/min "), mesures.speed /48, (int16_t)((int32_t)mesures.speed *60/48));
59 void event1(brushless mesures)
62 static int8_t dir = 1;
73 brushless_1_set_parameters(BRUSHLESS_MAX_SPEED, PWM_MAX/10*cpt /1 );
75 printf_P(PSTR("vitesse M1 : %5i t/s %5i t/min\n"), mesures.speed /48, (int16_t)((int32_t)mesures.speed *60/48));
79 void test_capteurs(void)
100 if(bit_is_set(PIN(BRUSHLESS_0_SENSOR_1_PORT),BRUSHLESS_0_SENSOR_1_BIT))
102 if(bit_is_set(PIN(BRUSHLESS_0_SENSOR_2_PORT),BRUSHLESS_0_SENSOR_2_BIT))
104 if(bit_is_set(PIN(BRUSHLESS_0_SENSOR_3_PORT),BRUSHLESS_0_SENSOR_3_BIT))
109 if(bit_is_set(PIN(BRUSHLESS_1_SENSOR_1_PORT),BRUSHLESS_1_SENSOR_1_BIT))
111 if(bit_is_set(PIN(BRUSHLESS_1_SENSOR_2_PORT),BRUSHLESS_1_SENSOR_2_BIT))
113 if(bit_is_set(PIN(BRUSHLESS_1_SENSOR_3_PORT),BRUSHLESS_1_SENSOR_3_BIT))
116 printf_P(PSTR("sensors M0 = %i%i%i "), sensor1_0,sensor2_0,sensor3_0);
118 printf_P(PSTR("sensors M1 = %i%i%i\n") , sensor1_1,sensor2_1,sensor3_1);
140 fdevopen((void *)uart0_send,NULL,0);
142 printf_P(PSTR("\nbonjour\n"));
151 // enable power bridges
157 brushless_0_register_periodic_event(event0);
158 brushless_1_register_periodic_event(event1);