played around with different inputs to change the temperature display
[goodfet] / firmware / platforms / arduino.h
1 /*! \file goodfet.h
2   \author Travis Goodspeed
3   \brief Port descriptions for the GoodFET platform.
4 */
5
6 #define ARDUINO
7
8 #define F_CPU 8000000UL
9
10 void arduino_init();
11
12 #include <avr/io.h>
13 //#include <util/delay.h>
14
15 //LED on P1.0
16 #define PLEDOUT PORTB
17 #define PLEDDIR DDRB
18 #define PLEDPIN 0x20
19
20 //Use P3 instead of P5 for target I/O on chips without P5.
21 #ifdef msp430f2274
22 //#warning "No P5, using P3 instead.  Will break 2618 and 1612 support."
23 #define P5OUT P3OUT
24 #define P5DIR P3DIR
25 #define P5IN P3IN
26 #define P5REN P3REN
27
28 #define SPIOUT P3OUT
29 #define SPIDIR P3DIR
30 #define SPIIN  P3IN
31 #define SPIREN P3REN
32 #else
33
34 #define SPIOUT P5OUT
35 #define SPIDIR P5DIR
36 #define SPIIN  P5IN
37 #define SPIREN P5REN
38
39 #endif
40
41 //This is how things used to work, don't do it anymore.
42 //#ifdef msp430x1612
43 //#define P5REN somedamnedextern
44 //#endif
45
46 //No longer works for Hope badge.
47 #define SETSS P5OUT|=BIT0
48 #define CLRSS P5OUT&=~BIT0
49 #define DIRSS P5DIR|=BIT0;
50
51 //Used for the Nordic port, !RST pin on regular GoodFET.
52 #define SETCE P2OUT|=BIT6
53 #define CLRCE P2OUT&=~BIT6
54 #define DIRCE P2DIR|=BIT6
55
56 // network byte order converters
57 #define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \
58                                  (((uint16_t)(x) & 0x00FF) << 8))
59 #define htonl(x) ((((uint32_t)(x) & 0xFF000000) >> 24) | \
60                                   (((uint32_t)(x) & 0x00FF0000) >> 8) | \
61                                   (((uint32_t)(x) & 0x0000FF00) << 8) | \
62                                   (((uint32_t)(x) & 0x000000FF) << 24))
63
64 #define ntohs htons
65 #define ntohl htonl
66