nRF24L01.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. Copyright (c) 2007 Stefan Engelke <mbox@stefanengelke.de>
  3. Permission is hereby granted, free of charge, to any person
  4. obtaining a copy of this software and associated documentation
  5. files (the "Software"), to deal in the Software without
  6. restriction, including without limitation the rights to use, copy,
  7. modify, merge, publish, distribute, sublicense, and/or sell copies
  8. of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be
  11. included in all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  16. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  17. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  19. DEALINGS IN THE SOFTWARE.
  20. $Id$
  21. */
  22. /* Memory Map */
  23. #define CONFIG 0x00
  24. #define EN_AA 0x01
  25. #define EN_RXADDR 0x02
  26. #define SETUP_AW 0x03
  27. #define SETUP_RETR 0x04
  28. #define RF_CH 0x05
  29. #define RF_SETUP 0x06
  30. #define STATUS 0x07
  31. #define OBSERVE_TX 0x08
  32. #define CD 0x09
  33. #define RX_ADDR_P0 0x0A
  34. #define RX_ADDR_P1 0x0B
  35. #define RX_ADDR_P2 0x0C
  36. #define RX_ADDR_P3 0x0D
  37. #define RX_ADDR_P4 0x0E
  38. #define RX_ADDR_P5 0x0F
  39. #define TX_ADDR 0x10
  40. #define RX_PW_P0 0x11
  41. #define RX_PW_P1 0x12
  42. #define RX_PW_P2 0x13
  43. #define RX_PW_P3 0x14
  44. #define RX_PW_P4 0x15
  45. #define RX_PW_P5 0x16
  46. #define FIFO_STATUS 0x17
  47. /* Bit Mnemonics */
  48. #define MASK_RX_DR 6
  49. #define MASK_TX_DS 5
  50. #define MASK_MAX_RT 4
  51. #define EN_CRC 3
  52. #define CRCO 2
  53. #define PWR_UP 1
  54. #define PRIM_RX 0
  55. #define ENAA_P5 5
  56. #define ENAA_P4 4
  57. #define ENAA_P3 3
  58. #define ENAA_P2 2
  59. #define ENAA_P1 1
  60. #define ENAA_P0 0
  61. #define ERX_P5 5
  62. #define ERX_P4 4
  63. #define ERX_P3 3
  64. #define ERX_P2 2
  65. #define ERX_P1 1
  66. #define ERX_P0 0
  67. #define AW 0
  68. #define ARD 4
  69. #define ARC 0
  70. #define PLL_LOCK 4
  71. #define RF_DR 3
  72. #define RF_PWR 1
  73. #define LNA_HCURR 0
  74. #define RX_DR 6
  75. #define TX_DS 5
  76. #define MAX_RT 4
  77. #define RX_P_NO 1
  78. #define TX_FULL 0
  79. #define PLOS_CNT 4
  80. #define ARC_CNT 0
  81. #define TX_REUSE 6
  82. #define FIFO_FULL 5
  83. #define TX_EMPTY 4
  84. #define RX_FULL 1
  85. #define RX_EMPTY 0
  86. /* Instruction Mnemonics */
  87. #define R_REGISTER 0x00
  88. #define W_REGISTER 0x20
  89. #define REGISTER_MASK 0x1F
  90. #define R_RX_PAYLOAD 0x61
  91. #define W_TX_PAYLOAD 0xA0
  92. #define FLUSH_TX 0xE1
  93. #define FLUSH_RX 0xE2
  94. #define REUSE_TX_PL 0xE3
  95. #define NOP 0xFF