|
|
@@ -3,32 +3,32 @@
|
|
3
|
3
|
|
|
4
|
4
|
|
|
5
|
5
|
/* NRF24L01 register mnemonic definitions */
|
|
6
|
|
-#define CONFIG 0x0
|
|
7
|
|
-#define EN_AA 0x1
|
|
8
|
|
-#define EN_RXADDR 0x2
|
|
9
|
|
-#define SETUP_AW 0x3
|
|
10
|
|
-#define SETUP_RETR 0x4
|
|
11
|
|
-#define RF_CH 0x5
|
|
12
|
|
-#define RF_SETUP 0x6
|
|
13
|
|
-#define STATUS 0x7
|
|
14
|
|
-#define OBSERVE_TX 0x8
|
|
15
|
|
-#define CD 0x9
|
|
16
|
|
-#define RX_ADDR_P0 0xA
|
|
17
|
|
-#define RX_ADDR_P1 0xB
|
|
18
|
|
-#define RX_ADDR_P2 0xC
|
|
19
|
|
-#define RX_ADDR_P3 0xD
|
|
20
|
|
-#define RX_ADDR_P4 0xE
|
|
21
|
|
-#define RX_ADDR_P5 0xF
|
|
22
|
|
-#define TX_ADDR 0x10
|
|
23
|
|
-#define RX_PW_P0 0x11
|
|
24
|
|
-#define RX_PW_P1 0x12
|
|
25
|
|
-#define RX_PW_P2 0x13
|
|
26
|
|
-#define RX_PW_P3 0x14
|
|
27
|
|
-#define RX_PW_P4 0x15
|
|
28
|
|
-#define RX_PW_P5 0x16
|
|
29
|
|
-#define FIFO_STATUS 0x17
|
|
30
|
|
-#define DYNPD 0x1C
|
|
31
|
|
-#define FEATURE 0x1D
|
|
|
6
|
+#define CONFIG_ADDRESS 0x0
|
|
|
7
|
+#define EN_AA_ADDRESS 0x1
|
|
|
8
|
+#define EN_RXADDR_ADDRESS 0x2
|
|
|
9
|
+#define SETUP_AW_ADDRESS 0x3
|
|
|
10
|
+#define SETUP_RETR_ADDRESS 0x4
|
|
|
11
|
+#define RF_CH_ADDRESS 0x5
|
|
|
12
|
+#define RF_SETUP_ADDRESS 0x6
|
|
|
13
|
+#define STATUS_ADDRESS 0x7
|
|
|
14
|
+#define OBSERVE_TX_ADDRESS 0x8
|
|
|
15
|
+#define CD_ADDRESS 0x9
|
|
|
16
|
+#define RX_ADDR_P0_ADDRESS 0xA
|
|
|
17
|
+#define RX_ADDR_P1_ADDRESS 0xB
|
|
|
18
|
+#define RX_ADDR_P2_ADDRESS 0xC
|
|
|
19
|
+#define RX_ADDR_P3_ADDRESS 0xD
|
|
|
20
|
+#define RX_ADDR_P4_ADDRESS 0xE
|
|
|
21
|
+#define RX_ADDR_P5_ADDRESS 0xF
|
|
|
22
|
+#define TX_ADDR_ADDRESS 0x10
|
|
|
23
|
+#define RX_PW_P0_ADDRESS 0x11
|
|
|
24
|
+#define RX_PW_P1_ADDRESS 0x12
|
|
|
25
|
+#define RX_PW_P2_ADDRESS 0x13
|
|
|
26
|
+#define RX_PW_P3_ADDRESS 0x14
|
|
|
27
|
+#define RX_PW_P4_ADDRESS 0x15
|
|
|
28
|
+#define RX_PW_P5_ADDRESS 0x16
|
|
|
29
|
+#define FIFO_STATUS_ADDRESS 0x17
|
|
|
30
|
+#define DYNPD_ADDRESS 0x1C
|
|
|
31
|
+#define FEATURE_ADDRESS 0x1D
|
|
32
|
32
|
|
|
33
|
33
|
/* Register bits definitions */
|
|
34
|
34
|
/* CONFIG*/
|
|
|
@@ -37,46 +37,203 @@ typedef union
|
|
37
|
37
|
uint8_t byte;
|
|
38
|
38
|
struct
|
|
39
|
39
|
{
|
|
40
|
|
- uint8_t bit012 : 3;
|
|
41
|
|
- uint8_t bit34 : 2;
|
|
42
|
|
- uint8_t bit5 : 1;
|
|
43
|
|
- uint8_t bit6 : 1;
|
|
44
|
|
- uint8_t bit7 : 1;
|
|
|
40
|
+ uint8_t RESERVED : 1;
|
|
|
41
|
+ uint8_t MASK_RX_DR : 1;
|
|
|
42
|
+ uint8_t MASK_TX_DS : 1;
|
|
|
43
|
+ uint8_t MASK_MAX_RT : 1;
|
|
|
44
|
+ uint8_t EN_CRC : 1;
|
|
|
45
|
+ uint8_t CRCO : 1;
|
|
|
46
|
+ uint8_t PWR_UP : 1;
|
|
|
47
|
+ uint8_t PRIM_RX : 1;
|
|
45
|
48
|
}bits;
|
|
46
|
49
|
}CONFIG_REGISTER;
|
|
47
|
50
|
|
|
48
|
|
-#define MASK_RX_DR (1<<6)
|
|
49
|
|
-#define MASK_TX_DS (1<<5)
|
|
50
|
|
-#define MASK_MAX_RT (1<<4)
|
|
51
|
|
-#define EN_CRC (1<<3)
|
|
52
|
|
-#define CRCO (1<<2)
|
|
53
|
|
-#define PWR_UP (1<<1)
|
|
54
|
|
-#define PRIM_RX (1<<0)
|
|
55
|
|
-
|
|
56
|
51
|
/*EN_AA */
|
|
57
|
|
-#define ENAA_P5 (1<<5)
|
|
58
|
|
-#define ENAA_P4 (1<<4)
|
|
59
|
|
-#define ENAA_P3 (1<<3)
|
|
60
|
|
-#define ENAA_P2 (1<<2)
|
|
61
|
|
-#define ENAA_P1 (1<<1)
|
|
62
|
|
-#define ENAA_P0 (1<<0)
|
|
|
52
|
+typedef union
|
|
|
53
|
+{
|
|
|
54
|
+ uint8_t byte;
|
|
|
55
|
+ struct
|
|
|
56
|
+ {
|
|
|
57
|
+ uint8_t RESERVED : 2;
|
|
|
58
|
+ uint8_t ENAA_P5 : 1;
|
|
|
59
|
+ uint8_t ENAA_P4 : 1;
|
|
|
60
|
+ uint8_t ENAA_P3 : 1;
|
|
|
61
|
+ uint8_t ENAA_P2 : 1;
|
|
|
62
|
+ uint8_t ENAA_P1 : 1;
|
|
|
63
|
+ uint8_t ENAA_P0 : 1;
|
|
|
64
|
+ }bits;
|
|
|
65
|
+}EN_AA_REGISTER;
|
|
63
|
66
|
|
|
64
|
67
|
/* EN_RXADDR */
|
|
65
|
|
-#define ERX_P5 (1<<5)
|
|
66
|
|
-#define ERX_P4 (1<<4)
|
|
67
|
|
-#define ERX_P3 (1<<3)
|
|
68
|
|
-#define ERX_P2 (1<<2)
|
|
69
|
|
-#define ERX_P1 (1<<1)
|
|
70
|
|
-#define ERX_P0 (1<<0)
|
|
71
|
|
-
|
|
72
|
|
-
|
|
73
|
|
-#define (1<<)
|
|
74
|
|
-#define (1<<)
|
|
75
|
|
-#define (1<<)
|
|
76
|
|
-#define (1<<)
|
|
77
|
|
-#define (1<<)
|
|
78
|
|
-#define (1<<)
|
|
79
|
|
-#define (1<<)
|
|
80
|
|
-#define (1<<)
|
|
|
68
|
+typedef union
|
|
|
69
|
+{
|
|
|
70
|
+ uint8_t byte;
|
|
|
71
|
+ struct
|
|
|
72
|
+ {
|
|
|
73
|
+ uint8_t RESERVED : 2;
|
|
|
74
|
+ uint8_t ERX_P5 : 1;
|
|
|
75
|
+ uint8_t ERX_P4 : 1;
|
|
|
76
|
+ uint8_t ERX_P3 : 1;
|
|
|
77
|
+ uint8_t ERX_P2 : 1;
|
|
|
78
|
+ uint8_t ERX_P1 : 1;
|
|
|
79
|
+ uint8_t ERX_P0 : 1;
|
|
|
80
|
+ }bits;
|
|
|
81
|
+}EN_RXADDR_REGISTER;
|
|
|
82
|
+
|
|
|
83
|
+/* SETUP_AW */
|
|
|
84
|
+typedef union
|
|
|
85
|
+{
|
|
|
86
|
+ uint8_t byte;
|
|
|
87
|
+ struct
|
|
|
88
|
+ {
|
|
|
89
|
+ uint8_t RESERVED : 6;
|
|
|
90
|
+ uint8_t AW : 2;
|
|
|
91
|
+ }bits;
|
|
|
92
|
+}SETUP_AW_REGISTER;
|
|
|
93
|
+
|
|
|
94
|
+#define ADDRESS_WIDTH_3_BYTES 0x1
|
|
|
95
|
+#define ADDRESS_WIDTH_4_BYTES 0x2
|
|
|
96
|
+#define ADDRESS_WIDTH_5_BYTES 0x3
|
|
|
97
|
+
|
|
|
98
|
+/* SETUP_RETR */
|
|
|
99
|
+typedef union
|
|
|
100
|
+{
|
|
|
101
|
+ uint8_t byte;
|
|
|
102
|
+ struct
|
|
|
103
|
+ {
|
|
|
104
|
+ uint8_t ARD : 4;
|
|
|
105
|
+ uint8_t ARC : 4;
|
|
|
106
|
+ }bits;
|
|
|
107
|
+}SETUP_RETR_REGISTER;
|
|
|
108
|
+
|
|
|
109
|
+/* RF_CH */
|
|
|
110
|
+typedef union
|
|
|
111
|
+{
|
|
|
112
|
+ uint8_t byte;
|
|
|
113
|
+ struct
|
|
|
114
|
+ {
|
|
|
115
|
+ uint8_t RESERVED : 1;
|
|
|
116
|
+ uint8_t RF_CH : 7;
|
|
|
117
|
+ }bits;
|
|
|
118
|
+}RF_CH_REGISTER;
|
|
|
119
|
+
|
|
|
120
|
+/* RF_SETUP */
|
|
|
121
|
+typedef union
|
|
|
122
|
+{
|
|
|
123
|
+ uint8_t byte;
|
|
|
124
|
+ struct
|
|
|
125
|
+ {
|
|
|
126
|
+ uint8_t RESERVED : 3;
|
|
|
127
|
+ uint8_t PLL_LOCK : 1;
|
|
|
128
|
+ uint8_t RF_DR : 1;
|
|
|
129
|
+ uint8_t RF_PWR : 2;
|
|
|
130
|
+ uint8_t LNA_HCURR : 1;
|
|
|
131
|
+ }bits;
|
|
|
132
|
+}RF_SETUP_REGISTER;
|
|
|
133
|
+
|
|
|
134
|
+#define RF_DATA_RATE_1MBPS 0x0
|
|
|
135
|
+#define RF_DATA_RATE_2MBPS 0x1
|
|
|
136
|
+
|
|
|
137
|
+#define RF_OUTPUT_POWER_MINUS_18DBM
|
|
|
138
|
+#define RF_OUTPUT_POWER_MINUS_12DBM
|
|
|
139
|
+#define RF_OUTPUT_POWER_MINUS_16DBM
|
|
|
140
|
+#define RF_OUTPUT_POWER_0DBM
|
|
|
141
|
+
|
|
|
142
|
+/* STATUS */
|
|
|
143
|
+typedef union
|
|
|
144
|
+{
|
|
|
145
|
+ uint8_t byte;
|
|
|
146
|
+ struct
|
|
|
147
|
+ {
|
|
|
148
|
+ uint8_t RESERVED : 1;
|
|
|
149
|
+ uint8_t TX_DR : 1;
|
|
|
150
|
+ uint8_t TX_DS : 1;
|
|
|
151
|
+ uint8_t MAX_RT : 1;
|
|
|
152
|
+ uint8_t RX_P_NO : 3;
|
|
|
153
|
+ uint8_t TX_FULL : 1;
|
|
|
154
|
+ }bits;
|
|
|
155
|
+}STATUS_REGISTER;
|
|
|
156
|
+
|
|
|
157
|
+#define RX_FIFO_EMPTY 0x7
|
|
|
158
|
+
|
|
|
159
|
+/* OBSERVE_TX */
|
|
|
160
|
+typedef union
|
|
|
161
|
+{
|
|
|
162
|
+ uint8_t byte;
|
|
|
163
|
+ struct
|
|
|
164
|
+ {
|
|
|
165
|
+ uint8_t PLOS_CNT : 4;
|
|
|
166
|
+ uint8_t ARC_CNT : 4;
|
|
|
167
|
+ }bits;
|
|
|
168
|
+}OBSERVE_TX_REGISTER;
|
|
|
169
|
+
|
|
|
170
|
+/* CD */
|
|
|
171
|
+typedef union
|
|
|
172
|
+{
|
|
|
173
|
+ uint8_t byte;
|
|
|
174
|
+ struct
|
|
|
175
|
+ {
|
|
|
176
|
+ uint8_t RESERVED : 7;
|
|
|
177
|
+ uint8_t CD : 1;
|
|
|
178
|
+ }bits;
|
|
|
179
|
+}CD_REGISTER;
|
|
|
180
|
+
|
|
|
181
|
+/* RX_PW_Pn */
|
|
|
182
|
+typedef union
|
|
|
183
|
+{
|
|
|
184
|
+ uint8_t byte;
|
|
|
185
|
+ struct
|
|
|
186
|
+ {
|
|
|
187
|
+ uint8_t RESERVED : 2;
|
|
|
188
|
+ uint8_t RX_PW_Pn : 6;
|
|
|
189
|
+ }bits;
|
|
|
190
|
+}RX_PW_Pn_REGISTER;
|
|
|
191
|
+
|
|
|
192
|
+/* FIFO_STATUS */
|
|
|
193
|
+typedef union
|
|
|
194
|
+{
|
|
|
195
|
+ uint8_t byte;
|
|
|
196
|
+ struct
|
|
|
197
|
+ {
|
|
|
198
|
+ uint8_t RESERVED0 : 1;
|
|
|
199
|
+ uint8_t TX_REUSE : 1;
|
|
|
200
|
+ uint8_t TX_FULL : 1;
|
|
|
201
|
+ uint8_t TX_EMPTY : 1;
|
|
|
202
|
+ uint8_t RESERVED1 : 2;
|
|
|
203
|
+ uint8_t RX_FULL : 1;
|
|
|
204
|
+ uint8_t RX_EMPTY : 1;
|
|
|
205
|
+ }bits;
|
|
|
206
|
+}FIFO_STATUS_REGISTER;
|
|
|
207
|
+
|
|
|
208
|
+/* DYNPD */
|
|
|
209
|
+typedef union
|
|
|
210
|
+{
|
|
|
211
|
+ uint8_t byte;
|
|
|
212
|
+ struct
|
|
|
213
|
+ {
|
|
|
214
|
+ uint8_t RESERVED : 2;
|
|
|
215
|
+ uint8_t DPL_P5 : 1;
|
|
|
216
|
+ uint8_t DPL_P4 : 1;
|
|
|
217
|
+ uint8_t DPL_P3 : 1;
|
|
|
218
|
+ uint8_t DPL_P2 : 1;
|
|
|
219
|
+ uint8_t DPL_P1 : 1;
|
|
|
220
|
+ uint8_t DPL_P0 : 1;
|
|
|
221
|
+ }bits;
|
|
|
222
|
+}DYNPD_REGISTER;
|
|
|
223
|
+
|
|
|
224
|
+/* FEATURE */
|
|
|
225
|
+typedef union
|
|
|
226
|
+{
|
|
|
227
|
+ uint8_t byte;
|
|
|
228
|
+ struct
|
|
|
229
|
+ {
|
|
|
230
|
+ uint8_t RESERVED : 5;
|
|
|
231
|
+ uint8_t EN_DPL : 1;
|
|
|
232
|
+ uint8_t EN_ACK_PAY : 1;
|
|
|
233
|
+ uint8_t EN_DYN_ACK : 1;
|
|
|
234
|
+ }bits;
|
|
|
235
|
+}FEATURE_REGISTER;
|
|
81
|
236
|
|
|
82
|
237
|
#endif
|
|
|
238
|
+
|
|
|
239
|
+
|