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:12 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;
55 brushless_0_set_parameters(BRUSHLESS_MAX_SPEED, PWM_MAX/10*cpt /1 );
57 printf_P(PSTR("vitesse M0 : %5i t/s %5i t/min "), mesures.speed /48, (int16_t)((int32_t)mesures.speed *60/48));
61 void test_capteurs(void)
64 uint8_t sensor1_0;uint8_t sensor2_0;uint8_t sensor3_0;
65 //uint8_t sensor1_1;uint8_t sensor2_1;uint8_t sensor3_1;
70 sensor1_0 = 0;sensor2_0 = 0;sensor3_0 = 0;
71 //sensor1_1 = 0;sensor2_1 = 0;sensor3_1 = 0;
74 if(bit_is_set(PIN(BRUSHLESS_0_SENSOR_1_PORT),BRUSHLESS_0_SENSOR_1_BIT))
76 if(bit_is_set(PIN(BRUSHLESS_0_SENSOR_2_PORT),BRUSHLESS_0_SENSOR_2_BIT))
78 if(bit_is_set(PIN(BRUSHLESS_0_SENSOR_3_PORT),BRUSHLESS_0_SENSOR_3_BIT))
83 /*if(bit_is_set(PIN(BRUSHLESS_1_SENSOR_1_PORT),BRUSHLESS_1_SENSOR_1_BIT))
85 if(bit_is_set(PIN(BRUSHLESS_1_SENSOR_2_PORT),BRUSHLESS_1_SENSOR_2_BIT))
87 if(bit_is_set(PIN(BRUSHLESS_1_SENSOR_3_PORT),BRUSHLESS_1_SENSOR_3_BIT))
90 printf_P(PSTR("sensors M0 = %i%i%i "), sensor1_0,sensor2_0,sensor3_0);
92 //printf_P(PSTR("sensors M1 = %i%i%i\n") , sensor1_1,sensor2_1,sensor3_1);
114 fdevopen((void *)uart0_dev_send, NULL,0);
116 printf_P(PSTR("\nbonjour\n"));
126 // enable power bridges
132 brushless_0_register_periodic_event(event0);