Closer to STM32 port.
[goodfet] / firmware / platforms / nhbadge.h
1 /*! \file nhbadge.h
2   \author Travis Goodspeed
3   \brief Port descriptions for the Next Hope Badge.
4 */
5
6
7 #ifdef MSP430
8 #include <msp430.h>
9 #endif
10
11
12 //LED on P1.0
13 #define PLEDOUT P1OUT
14 #define PLEDDIR P1DIR
15 #define PLEDPIN BIT0
16
17
18 //No longer works for Hope badge.
19 #define SETSS P5OUT|=BIT4
20 #define CLRSS P5OUT&=~BIT4
21 #define DIRSS P5DIR|=BIT4;
22
23 //BIT5 is Chip Enable
24 //#define RADIOACTIVE  P5OUT|=BIT5
25 //#define RADIOPASSIVE P5OUT&=~BIT5
26 #define SETCE P5OUT|=BIT5
27 #define CLRCE P5OUT&=~BIT5
28 #define DIRCE P5DIR|=BIT5
29
30 #define SPIOUT P5OUT
31 #define SPIDIR P5DIR
32 #define SPIIN  P5IN
33 #define SPIREN P5REN
34
35 // network byte order converters
36 #define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \
37                                  (((uint16_t)(x) & 0x00FF) << 8))
38 #define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \
39                                   (((uint32_t)(x) & 0x00FF0000) >> 8) | \
40                                   (((uint32_t)(x) & 0x0000FF00) << 8) | \
41                                   (((uint32_t)(x) & 0x000000FF) << 24))
42
43 #define ntohs htons
44 #define ntohl htonl