work on beacon
[aversive.git] / projects / microb2010 / tests / beacon_tsop / main.h
1 /*  
2  *  Copyright Droids Corporation (2009)
3  *  Olivier Matz <zer0@droids-corp.org>
4  * 
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  *  Revision : $Id: main.c,v 1.8 2009-05-02 10:08:09 zer0 Exp $
20  *
21  */
22
23 #define BOARD2006
24
25 /********************** LEDs */
26 #define LED_TOGGLE(port, bit) do {              \
27                 if (port & _BV(bit))            \
28                         port &= ~_BV(bit);      \
29                 else                            \
30                         port |= _BV(bit);       \
31         } while(0)
32
33 #ifdef BOARD2006
34 #define LED1_PORT PORTE
35 #define LED1_DDR  DDRE
36 #define LED1_BIT  2
37 #define LED2_PORT PORTE
38 #define LED2_DDR  DDRE
39 #define LED2_BIT  3
40 #define LED3_PORT PORTB
41 #define LED3_DDR  DDRB
42 #define LED3_BIT  3
43 #define LED1_ON()  sbi(LED1_PORT, LED1_BIT)
44 #define LED1_OFF() cbi(LED1_PORT, LED1_BIT)
45 #define LED1_TOGGLE() LED1_TOGGLE(LED_PORT, LED1_BIT)
46 #define LED2_ON()  sbi(LED2_PORT, LED2_BIT)
47 #define LED2_OFF() cbi(LED2_PORT, LED2_BIT)
48 #define LED2_TOGGLE() LED_TOGGLE(LED2_PORT, LED2_BIT)
49 #define LED3_ON()  sbi(LED3_PORT, LED3_BIT)
50 #define LED3_OFF() cbi(LED3_PORT, LED3_BIT)
51 #define LED3_TOGGLE() LED_TOGGLE(LED3_PORT, LED3_BIT)
52 #else
53 #define LED_PORT PORTD
54 #define LED_DDR  DDRD
55 #define LED1_BIT  5
56 #define LED2_BIT  6
57 #define LED3_BIT  7
58 #define LED1_ON()  sbi(LED_PORT, LED1_BIT)
59 #define LED1_OFF() cbi(LED_PORT, LED1_BIT)
60 #define LED1_TOGGLE() LED_TOGGLE(LED_PORT, LED1_BIT)
61 #define LED2_ON()  sbi(LED_PORT, LED2_BIT)
62 #define LED2_OFF() cbi(LED_PORT, LED2_BIT)
63 #define LED2_TOGGLE() LED_TOGGLE(LED_PORT, LED2_BIT)
64 #define LED3_ON()  sbi(LED_PORT, LED3_BIT)
65 #define LED3_OFF() cbi(LED_PORT, LED3_BIT)
66 #define LED3_TOGGLE() LED_TOGGLE(LED_PORT, LED3_BIT)
67 #endif
68
69 struct beacon_tsop {
70         struct rdline rdl;
71         char prompt[RDLINE_PROMPT_SIZE];
72         struct pwm_ng pwm_motor;
73         struct pid_filter pid;
74         uint8_t debug_frame;
75         uint8_t debug_speed;
76 };
77
78 extern struct beacon_tsop beacon_tsop;