-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinitPorts.h
131 lines (90 loc) · 3.12 KB
/
initPorts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef INITPORTS_INCL
#define INITPORTS_INCL
//#include <stdint.h>
#include <io.h>
#define SWITCH ((P3IN >> 5) & 1 )
#define LED7ON P1OUT |= (1 << 0) //1
#define LED7OFF P1OUT &= ~(1 << 0)
#define LED7TOGGLE P1OUT ^= (1 << 0)
#define LED5ON P1OUT |= (1 << 1) //2
#define LED5OFF P1OUT &= ~(1 << 1)
#define LED5TOGGLE P1OUT ^= (1 << 1)
#define LED3ON P1OUT |= (1 << 2) //3
#define LED3OFF P1OUT &= ~(1 << 2)
#define LED3TOGGLE P1OUT ^= (1 << 2)
#define LED1ON P1OUT |= (1 << 3) //4
#define LED1OFF P1OUT &= ~(1 << 3)
#define LED1TOGGLE P1OUT ^= (1 << 3)
#define LED2ON P1OUT |= (1 << 4) //5
#define LED2OFF P1OUT &= ~(1 << 4)
#define LED2TOGGLE P1OUT ^= (1 << 4)
#define LED4ON P1OUT |= (1 << 5) //6
#define LED4OFF P1OUT &= ~(1 << 5)
#define LED4TOGGLE P1OUT ^= (1 << 5)
#define LED6ON P1OUT |= (1 << 6) //7
#define LED6OFF P1OUT &= ~(1 << 6)
#define LED6TOGGLE P1OUT ^= (1 << 6)
#define LED8ON P1OUT |= (1 << 7) //0
#define LED8OFF P1OUT &= ~(1 << 7)
#define LED8TOGGLE P1OUT ^= (1 << 7)
/*
#define LED10ON P4OUT |= (1 << 7)
#define LED10OFF P4OUT &= ~(1 << 7)
#define LED10TOGGLE P4OUT ^= (1 << 7)
#define LED12ON P5OUT |= (1 << 0)
#define LED12OFF P5OUT &= ~(1 << 0)
#define LED12TOGGLE P5OUT ^= (1 << 0)
#define LED14ON P5OUT |= (1 << 1)
#define LED14OFF P5OUT &= ~(1 << 1)
#define LED14TOGGLE P5OUT ^= (1 << 1)
#define LED16ON P5OUT |= (1 << 2)
#define LED16OFF P5OUT &= ~(1 << 2)
#define LED16TOGGLE P5OUT ^= (1 << 2)
#define LED15ON P5OUT |= (1 << 3)
#define LED15OFF P5OUT &= ~(1 << 3)
#define LED15TOGGLE P5OUT ^= (1 << 3)
#define LED13ON P5OUT |= (1 << 4)
#define LED13OFF P5OUT &= ~(1 << 4)
#define LED13TOGGLE P5OUT ^= (1 << 4)
#define LED11ON P5OUT |= (1 << 5)
#define LED11OFF P5OUT &= ~(1 << 5)
#define LED11TOGGLE P5OUT ^= (1 << 5)
#define LED9ON P5OUT |= (1 << 6)
#define LED9OFF P5OUT &= ~(1 << 6)
#define LED9TOGGLE P5OUT ^= (1 << 6)
*/
#define M2P1ON P5OUT |= (1 << 3)
#define M2P1OFF P5OUT &= ~(1 << 3)
#define M2P1TOGGLE P5OUT ^= (1 << 3)
#define M2P2ON P5OUT |= (1 << 0)
#define M2P2OFF P5OUT &= ~(1 << 0)
#define M2P2TOGGLE P5OUT ^= (1 << 0)
#define M2P3ON P5OUT |= (1 << 2)
#define M2P3OFF P5OUT &= ~(1 << 2)
#define M2P3TOGGLE P5OUT ^= (1 << 2)
#define M2P4ON P5OUT |= (1 << 1)
#define M2P4OFF P5OUT &= ~(1 << 1)
#define M2P4TOGGLE P5OUT ^= (1 << 1)
#define M1P1ON P5OUT |= (1 << 6)
#define M1P1OFF P5OUT &= ~(1 << 6)
#define M1P1TOGGLE P5OUT ^= (1 << 6)
#define M1P2ON P5OUT |= (1 << 5)
#define M1P2OFF P5OUT &= ~(1 << 5)
#define M1P2TOGGLE P5OUT ^= (1 << 5)
#define M1P3ON P5OUT |= (1 << 7)
#define M1P3OFF P5OUT &= ~(1 << 7)
#define M1P3TOGGLE P5OUT ^= (1 << 7)
#define M1P4ON P5OUT |= (1 << 4)
#define M1P4OFF P5OUT &= ~(1 << 4)
#define M1P4TOGGLE P5OUT ^= (1 << 4)
// RF i/o bits
#define RF_CE_BIT (1 << 4)
#define RF_CE_HIGH (P2OUT |= RF_CE_BIT)
#define RF_CE_LOW (P2OUT &= ~RF_CE_BIT)
#define RF_IRQ_BIT (1 << 2)
#define RF_IRQ_HIGH (P2IN & RF_IRQ_BIT)
#define RF_IRQ_EDGE (P2IFG & RF_IRQ_BIT)
#define RF_IRQ_EDGE_CLEAR (P2IFG &= ~RF_IRQ_BIT)
// prototypes
void PortsInit(void);
#endif