235faeeabb10f23e5dce9556d948f4ac18c00d31
[goodfet] / firmware / platforms / telosb.h
1 /*! \file telosb.h
2   \author Travis Goodspeed
3   \brief Port descriptions for the TelosB platform.
4   
5   This file defines the Telos B hardware, so that the GoodFET firmware
6   may be loaded onto it.  Adjustments include the !CS line of the CC2420
7   radio, the choice of serial port, and the LEDs.
8
9 */
10
11 #ifdef MSP430
12 #include <io.h>
13 #endif
14
15 //LED on P5.4
16 #define PLEDOUT P5OUT
17 #define PLEDDIR P5DIR
18 #define PLEDPIN BIT4
19
20
21 #define SPIOUT P3OUT
22 #define SPIDIR P3DIR
23 #define SPIIN  P3IN
24 #define SPIREN P3REN
25  
26 #define P5OUT P3OUT
27 #define P5DIR P3DIR
28 #define P5IN  P3IN
29 #define P5REN P3REN
30
31
32 /* For the radio to be used:
33    4.6 (!RST) must be low
34    4.5 (VREF_EN) must be high
35    4.2 (!CS) must be low for the transaction.
36 */
37
38 #define INITPLATFORM \
39   P4DIR|=BIT6+BIT5+BIT2+BIT7+BIT4; \
40   P4OUT=BIT5;
41
42 //Radio CS is P4.2
43 #define SETSS P4OUT|=BIT2
44 #define CLRSS P4OUT&=~BIT2
45 #define DIRSS P4DIR|=BIT2
46
47 //Flash CS is P4.4
48 //#define SETSS P4OUT|=BIT4
49 //#define CLRSS P4OUT&=~BIT4
50 //#define DIRSS P4DIR|=BIT4
51
52
53 //CC2420 Chip Reset.  Need to document this.
54 #define SETCE P4OUT|=BIT6
55 #define CLRCE P4OUT&=~BIT6
56 #define DIRCE P4DIR|=BIT6