-
Notifications
You must be signed in to change notification settings - Fork 1
/
nRF24L01.h
121 lines (113 loc) · 4.02 KB
/
nRF24L01.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
/* nRF24L01.h
* Register definitions for manipulating the Nordic Semiconductor
* nRF24L01+ RF transceiver chipsets.
*
Copyright (c) 2007 Stefan Engelke <mbox@stefanengelke.de>
Some parts copyright (c) 2012 Eric Brundick <spirilis [at] linux dot com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef _NRF24L01_H
#define _NRF24L01_H
/* Register Map */
#define RF24_CONFIG 0x00
#define RF24_EN_AA 0x01
#define RF24_EN_RXADDR 0x02
#define RF24_SETUP_AW 0x03
#define RF24_SETUP_RETR 0x04
#define RF24_RF_CH 0x05
#define RF24_RF_SETUP 0x06
#define RF24_STATUS 0x07
#define RF24_OBSERVE_TX 0x08
#define RF24_CD 0x09
#define RF24_RPD 0x09
#define RF24_RX_ADDR_P0 0x0A
#define RF24_RX_ADDR_P1 0x0B
#define RF24_RX_ADDR_P2 0x0C
#define RF24_RX_ADDR_P3 0x0D
#define RF24_RX_ADDR_P4 0x0E
#define RF24_RX_ADDR_P5 0x0F
#define RF24_TX_ADDR 0x10
#define RF24_RX_PW_P0 0x11
#define RF24_RX_PW_P1 0x12
#define RF24_RX_PW_P2 0x13
#define RF24_RX_PW_P3 0x14
#define RF24_RX_PW_P4 0x15
#define RF24_RX_PW_P5 0x16
#define RF24_FIFO_STATUS 0x17
#define RF24_DYNPD 0x1C
#define RF24_FEATURE 0x1D
/* Register Bits */
#define RF24_MASK_RX_DR BIT6
#define RF24_MASK_TX_DS BIT5
#define RF24_MASK_MAX_RT BIT4
#define RF24_EN_CRC BIT3
#define RF24_CRCO BIT2
#define RF24_PWR_UP BIT1
#define RF24_PRIM_RX BIT0
#define RF24_ENAA_P5 BIT5
#define RF24_ENAA_P4 BIT4
#define RF24_ENAA_P3 BIT3
#define RF24_ENAA_P2 BIT2
#define RF24_ENAA_P1 BIT1
#define RF24_ENAA_P0 BIT0
#define RF24_ERX_P5 BIT5
#define RF24_ERX_P4 BIT4
#define RF24_ERX_P3 BIT3
#define RF24_ERX_P2 BIT2
#define RF24_ERX_P1 BIT1
#define RF24_ERX_P0 BIT0
#define RF24_AW BIT0
#define RF24_ARD BIT4
#define RF24_ARC BIT0
#define RF24_PLL_LOCK BIT4
#define RF24_CONT_WAVE BIT7
#define RF24_RF_DR BIT3
#define RF24_RF_DR_LOW BIT5
#define RF24_RF_DR_HIGH BIT3
#define RF24_RF_PWR BIT1
#define RF24_LNA_HCURR BIT0
#define RF24_RX_DR BIT6
#define RF24_TX_DS BIT5
#define RF24_MAX_RT BIT4
#define RF24_RX_P_NO BIT1
#define RF24_TX_FULL BIT0
#define RF24_PLOS_CNT BIT4
#define RF24_ARC_CNT BIT0
#define RF24_TX_REUSE BIT6
#define RF24_FIFO_FULL BIT5
#define RF24_TX_EMPTY BIT4
#define RF24_RX_FULL BIT1
#define RF24_RX_EMPTY BIT0
#define RF24_EN_DPL BIT2
#define RF24_EN_ACK_PAY BIT1
#define RF24_EN_DYN_ACK BIT0
/* Instructions */
#define RF24_R_REGISTER 0x00
#define RF24_W_REGISTER 0x20
#define RF24_REGISTER_MASK 0x1F
#define RF24_R_RX_PAYLOAD 0x61
#define RF24_W_TX_PAYLOAD 0xA0
#define RF24_FLUSH_TX 0xE1
#define RF24_FLUSH_RX 0xE2
#define RF24_REUSE_TX_PL 0xE3
#define RF24_R_RX_PL_WID 0x60
#define RF24_W_ACK_PAYLOAD 0xA8
#define RF24_W_TX_PAYLOAD_NOACK 0xB0
#define RF24_NOP 0xFF
#endif