work on trajectory, update cobboard and ballboard too
[aversive.git] / projects / firefly_example1 / firefly2_2.h
1 #ifndef FIREFLY2_2_H
2 #define FIREFLY2_2_H
3
4
5 /* Firefly2_2 hardware */
6 #define INPUT_PIN       0
7 #define OUTPUT_PIN      1
8
9 /* SPI */
10 #define SPI_SS          0       // PB.0 - Output: SPI Slave Select
11 #define SCK                     1       // PB.1 - Output: SPI Serial Clock
12 #define MOSI            2       // PB.2
13 #define CSN                     0       // PC.0 - Output: SPI Chip Select (CS_N)
14
15
16 /* User interface */
17 #define LED_DDR         DDRE
18 #define LED_PORT        PORTE
19 #define LED_ORANGE      2       // PE.2
20 #define LED_BLUE        3       // PE.3
21 #define LED_GREEN       4       // PE.4
22 #define LED_RED         5       // PE.5
23
24 #define BUTTON_DDR      DDRA
25 #define BUTTON_PORT     PINA
26 #define BUTTON_PIN      7       // PA.7
27
28 /* Debug interface */
29 #define DEBUG_0         3       // PA.3
30 #define DEBUG_1         4       // PA.4
31 #define DEBUG_2         0       // PD.0
32 #define DEBUG_3         1       // PD.1
33
34
35
36 /* Useful routines */
37
38 /* use sbi() and cbi() instead */
39 #define SET(port, pin)  port |= (1<<(pin))
40 #define CLR(port, pin)  port &= ~(1<<(pin))
41
42 /* test of bit (pin) of (port) 
43  * Substitutes as 1 if pin is set, or 0 if not */
44 #define TST(port, pin)  ((port & (1<<(pin)))>>(pin))
45
46 /* To set leds you have to clear the bit (yeah, I know...) */
47 #define LED_SET(led)    cbi(LED_PORT, (led))
48 #define LED_CLR(led)    sbi(LED_PORT, (led))
49
50
51 #endif