MySensors Library & Examples  2.3.2
RF24registers.h
1 /*
2 * The MySensors Arduino library handles the wireless radio link and protocol
3 * between your home built sensors/actuators and HA controller of choice.
4 * The sensors forms a self healing radio network with optional repeaters. Each
5 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
6 * network topology allowing messages to be routed to nodes.
7 *
8 * Created by Henrik Ekblad <[email protected]>
9 * Copyright (C) 2013-2019 Sensnology AB
10 * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
11 *
12 * Documentation: http://www.mysensors.org
13 * Support Forum: http://forum.mysensors.org
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * version 2 as published by the Free Software Foundation.
18 *
19 * Based on maniacbug's RF24 library, copyright (C) 2011 J. Coliz <[email protected]>
20 * RF24 driver refactored and optimized for speed and size, copyright (C) 2016 Olivier Mauti <[email protected]>
21 */
22 
23 // PA levels
24 #define RF24_PA_MIN (0)
25 #define RF24_PA_LOW (1)
26 #define RF24_PA_HIGH (2)
27 #define RF24_PA_MAX (3)
28 
29 // power level limits
30 #define RF24_MIN_POWER_LEVEL (0)
31 #define RF24_MAX_POWER_LEVEL (3)
32 
33 // data rate
34 #define RF24_1MBPS (0)
35 #define RF24_2MBPS (1)
36 #define RF24_250KBPS (2)
37 
38 // CRC
39 #define RF24_CRC_DISABLED (0)
40 #define RF24_CRC_8 (2)
41 #define RF24_CRC_16 (3)
42 
43 // ARD, auto retry delay
44 #define RF24_SET_ARD (5) //=1500us
45 
46 // ARD, auto retry count
47 #define RF24_SET_ARC (15)
48 
49 // nRF24L01(+) register definitions
50 #define RF24_REG_NRF_CONFIG (0x00)
51 #define RF24_REG_EN_AA (0x01)
52 #define RF24_REG_EN_RXADDR (0x02)
53 #define RF24_REG_SETUP_AW (0x03)
54 #define RF24_REG_SETUP_RETR (0x04)
55 #define RF24_REG_RF_CH (0x05)
56 #define RF24_REG_RF_SETUP (0x06)
57 #define RF24_REG_STATUS (0x07)
58 #define RF24_REG_OBSERVE_TX (0x08)
59 #define RF24_REG_RPD (0x09) // nRF24L01+
60 #define RF24_REG_CD (RF24_REG_RPD) // nRF24L01
61 #define RF24_REG_RX_ADDR_P0 (0x0A)
62 #define RF24_REG_RX_ADDR_P1 (0x0B)
63 #define RF24_REG_RX_ADDR_P2 (0x0C)
64 #define RF24_REG_RX_ADDR_P3 (0x0D)
65 #define RF24_REG_RX_ADDR_P4 (0x0E)
66 #define RF24_REG_RX_ADDR_P5 (0x0F)
67 #define RF24_REG_TX_ADDR (0x10)
68 #define RF24_REG_RX_PW_P0 (0x11)
69 #define RF24_REG_RX_PW_P1 (0x12)
70 #define RF24_REG_RX_PW_P2 (0x13)
71 #define RF24_REG_RX_PW_P3 (0x14)
72 #define RF24_REG_RX_PW_P4 (0x15)
73 #define RF24_REG_RX_PW_P5 (0x16)
74 #define RF24_REG_FIFO_STATUS (0x17)
75 #define RF24_REG_DYNPD (0x1C)
76 #define RF24_REG_FEATURE (0x1D)
77 
78 // mask
79 #define RF24_REGISTER_MASK (0x1F)
80 
81 // instructions
82 #define RF24_CMD_READ_REGISTER (0x00)
83 #define RF24_CMD_WRITE_REGISTER (0x20)
84 #define RF24_CMD_ACTIVATE (0x50)
85 #define RF24_CMD_READ_RX_PL_WID (0x60)
86 #define RF24_CMD_READ_RX_PAYLOAD (0x61)
87 #define RF24_CMD_WRITE_TX_PAYLOAD (0xA0)
88 #define RF24_CMD_WRITE_ACK_PAYLOAD (0xA8)
89 #define RF24_CMD_WRITE_TX_PAYLOAD_NO_ACK (0xB0)
90 #define RF24_CMD_FLUSH_TX (0xE1)
91 #define RF24_CMD_FLUSH_RX (0xE2)
92 #define RF24_CMD_REUSE_TX_PL (0xE3)
93 #define RF24_CMD_NOP (0xFF)
94 
95 // bit mnemonics
96 #define RF24_MASK_RX_DR (6)
97 #define RF24_MASK_TX_DS (5)
98 #define RF24_MASK_MAX_RT (4)
99 #define RF24_EN_CRC (3)
100 #define RF24_CRCO (2)
101 #define RF24_PWR_UP (1)
102 #define RF24_PRIM_RX (0)
103 
104 // auto ACK
105 #define RF24_ENAA_P5 (5)
106 #define RF24_ENAA_P4 (4)
107 #define RF24_ENAA_P3 (3)
108 #define RF24_ENAA_P2 (2)
109 #define RF24_ENAA_P1 (1)
110 #define RF24_ENAA_P0 (0)
111 
112 // rx pipe
113 #define RF24_ERX_P5 (5)
114 #define RF24_ERX_P4 (4)
115 #define RF24_ERX_P3 (3)
116 #define RF24_ERX_P2 (2)
117 #define RF24_ERX_P1 (1)
118 #define RF24_ERX_P0 (0)
119 
120 // dynamic payload
121 #define RF24_DPL_P5 (5)
122 #define RF24_DPL_P4 (4)
123 #define RF24_DPL_P3 (3)
124 #define RF24_DPL_P2 (2)
125 #define RF24_DPL_P1 (1)
126 #define RF24_DPL_P0 (0)
127 
128 #define RF24_AW (0)
129 #define RF24_ARD (4)
130 #define RF24_ARC (0)
131 #define RF24_PLL_LOCK (4)
132 #define RF24_CONT_WAVE (7)
133 #define RF24_RF_DR (3)
134 #define RF24_RF_PWR (6)
135 #define RF24_RX_DR (6)
136 #define RF24_TX_DS (5)
137 #define RF24_MAX_RT (4)
138 #define RF24_RX_P_NO (1)
139 #define RF24_TX_FULL (0)
140 #define RF24_PLOS_CNT (4)
141 #define RF24_ARC_CNT (0)
142 #define RF24_TX_REUSE (6)
143 #define RF24_FIFO_FULL (5)
144 #define RF24_TX_EMPTY (4)
145 #define RF24_RX_FULL (1)
146 #define RF24_RX_EMPTY (0)
147 #define RF24_RPD (0) // nRF24L01+
148 #define RF24_CD (RF24_RPD) // nRF24L01
149 
150 // features
151 #define RF24_EN_DPL (2)
152 #define RF24_EN_ACK_PAY (1)
153 #define RF24_EN_DYN_ACK (0)
154 
155 #define RF24_LNA_HCURR (0)
156 #define RF24_RF_DR_LOW (5)
157 #define RF24_RF_DR_HIGH (3)
158 #define RF24_RF_PWR_LOW (1)
159 #define RF24_RF_PWR_HIGH (2)