Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
nRF24L01.h
1 /*
2  Copyright (c) 2007 Stefan Engelke <mbox@stefanengelke.de>
3 
4  Permission is hereby granted, free of charge, to any person
5  obtaining a copy of this software and associated documentation
6  files (the "Software"), to deal in the Software without
7  restriction, including without limitation the rights to use, copy,
8  modify, merge, publish, distribute, sublicense, and/or sell copies
9  of the Software, and to permit persons to whom the Software is
10  furnished to do so, subject to the following conditions:
11 
12  The above copyright notice and this permission notice shall be
13  included in all copies or substantial portions of the Software.
14 
15  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23 */
24 
25 /* Memory Map */
26 #define CONFIG 0x00
27 #define EN_AA 0x01
28 #define EN_RXADDR 0x02
29 #define SETUP_AW 0x03
30 #define SETUP_RETR 0x04
31 #define RF_CH 0x05
32 #define RF_SETUP 0x06
33 #define REG_STATUS 0x07
34 #define OBSERVE_TX 0x08
35 #define CD 0x09
36 #define RX_ADDR_P0 0x0A
37 #define RX_ADDR_P1 0x0B
38 #define RX_ADDR_P2 0x0C
39 #define RX_ADDR_P3 0x0D
40 #define RX_ADDR_P4 0x0E
41 #define RX_ADDR_P5 0x0F
42 #define TX_ADDR 0x10
43 #define RX_PW_P0 0x11
44 #define RX_PW_P1 0x12
45 #define RX_PW_P2 0x13
46 #define RX_PW_P3 0x14
47 #define RX_PW_P4 0x15
48 #define RX_PW_P5 0x16
49 #define FIFO_STATUS 0x17
50 #define DYNPD 0x1C
51 #define FEATURE 0x1D
52 
53 /* Bit Mnemonics */
54 #define MASK_RX_DR 6
55 #define MASK_TX_DS 5
56 #define MASK_MAX_RT 4
57 #define EN_CRC 3
58 #define CRCO 2
59 #define PWR_UP 1
60 #define PRIM_RX 0
61 #define ENAA_P5 5
62 #define ENAA_P4 4
63 #define ENAA_P3 3
64 #define ENAA_P2 2
65 #define ENAA_P1 1
66 #define ENAA_P0 0
67 #define ERX_P5 5
68 #define ERX_P4 4
69 #define ERX_P3 3
70 #define ERX_P2 2
71 #define ERX_P1 1
72 #define ERX_P0 0
73 #define AW 0
74 #define ARD 4
75 #define ARC 0
76 #define PLL_LOCK 4
77 #define RF_DR 3
78 #define RF_PWR 6
79 #define RX_DR 6
80 #define TX_DS 5
81 #define MAX_RT 4
82 #define RX_P_NO 1
83 #define TX_FULL 0
84 #define PLOS_CNT 4
85 #define ARC_CNT 0
86 #define TX_REUSE 6
87 #define FIFO_FULL 5
88 #define TX_EMPTY 4
89 #define RX_FULL 1
90 #define RX_EMPTY 0
91 #define DPL_P5 5
92 #define DPL_P4 4
93 #define DPL_P3 3
94 #define DPL_P2 2
95 #define DPL_P1 1
96 #define DPL_P0 0
97 #define EN_DPL 2
98 #define EN_ACK_PAY 1
99 #define EN_DYN_ACK 0
100 
101 /* Instruction Mnemonics */
102 #define R_REGISTER 0x00
103 #define W_REGISTER 0x20
104 #define REGISTER_MASK 0x1F
105 #define ACTIVATE 0x50
106 #define R_RX_PL_WID 0x60
107 #define R_RX_PAYLOAD 0x61
108 #define W_TX_PAYLOAD 0xA0
109 #define W_ACK_PAYLOAD 0xA8
110 #define FLUSH_TX 0xE1
111 #define FLUSH_RX 0xE2
112 #define REUSE_TX_PL 0xE3
113 #define NOP 0xFF
114 
115 /* Non-P omissions */
116 #define LNA_HCURR 0
117 
118 /* P model memory Map */
119 #define RPD 0x09
120 
121 /* P model bit Mnemonics */
122 #define RF_DR_LOW 5
123 #define RF_DR_HIGH 3
124 #define RF_PWR_LOW 1
125 #define RF_PWR_HIGH 2