nrf_gzp_config.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /**
  2. * Copyright (c) 2008 - 2020, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #ifndef __GZP_CONFIG_H
  41. #define __GZP_CONFIG_H
  42. #include "nrf.h"
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. /**
  47. * Definition of "secret key" used during "Host ID exchange".
  48. */
  49. #define GZP_SECRET_KEY {1, 23, 45, 57, 26, 68, 12, 64, 13, 73, 13, 62, 26, 45, 12, 77}
  50. //-----------------------------------------------------------------------------
  51. /**
  52. Definition of the first static selected pairing channel. Should be located in
  53. the lower Nth of the channel range, where N is the size if the channel subset
  54. selected by the application.
  55. */
  56. #define GZP_CHANNEL_LOW 2
  57. /**
  58. Definition of the second static selected pairing channel. Should be located in
  59. the upper Nth of the channel range, where N is the size if the channel subset
  60. selected by the application.
  61. */
  62. #define GZP_CHANNEL_HIGH 79
  63. /**
  64. Definition of the static "global" pairing address.
  65. */
  66. #define GZP_ADDRESS 4, 6, 8, 10
  67. /**
  68. Reduced TX power for use during close proximity pairing.
  69. */
  70. #define GZP_POWER NRF_GZLL_TX_POWER_N16_DBM
  71. /**
  72. Definition of pairing request timeout.
  73. */
  74. #define GZP_REQ_TX_TIMEOUT 200
  75. /**
  76. Definition of the maximimum number of "backoff" packets (step 0) to be transmitted.
  77. */
  78. #define GZP_MAX_BACKOFF_PACKETS 100
  79. /**
  80. Definition of the period a device shall wait before attempting to send the packet for
  81. fetching the pairing response (step 1).
  82. */
  83. #define GZP_TX_ACK_WAIT_TIMEOUT (GZP_CLOSE_PROXIMITY_BACKOFF_RX_TIMEOUT + 50)
  84. /**
  85. Definition of the period a device in close proximity shall back off on the pairing
  86. address after a backoff packet has been received.
  87. */
  88. #define GZP_CLOSE_PROXIMITY_BACKOFF_RX_TIMEOUT ((GZP_REQ_TX_TIMEOUT / 2) + 50)
  89. /**
  90. Definition of the period a device NOT in close proximity shall back off on the pairing
  91. address after a backoff packet has been received.
  92. */
  93. #define GZP_NOT_PROXIMITY_BACKOFF_RX_TIMEOUT (GZP_CLOSE_PROXIMITY_BACKOFF_RX_TIMEOUT + GZP_STEP1_RX_TIMEOUT)
  94. /**
  95. Definition of the time the host waits for a device to complete
  96. transmission of the pairing request step 1 packet.
  97. */
  98. #define GZP_STEP1_RX_TIMEOUT (((GZP_REQ_TX_TIMEOUT / 2) + GZP_TX_ACK_WAIT_TIMEOUT) + 50)
  99. /**
  100. Definition of the lowest boundary for the channel range to be used.
  101. */
  102. #define GZP_CHANNEL_MIN 2
  103. /**
  104. Definition of the upper boundary for the channel range to be used.
  105. */
  106. #define GZP_CHANNEL_MAX 80
  107. /**
  108. Definition of the minimum channel spacing for the channel subset generated
  109. during pairing.
  110. */
  111. #define GZP_CHANNEL_SPACING_MIN 5
  112. /**
  113. Non volatile memory (Flash or OTP) storage address. A device will
  114. require GZP_DEVICE_PARAMS_STORAGE_SIZE bytes of memory, and
  115. Host 11 bytes. When using flash memory, storage address should
  116. be a multiple of chip page size.
  117. */
  118. #define GZP_PARAMS_STORAGE_ADR 0x00001000
  119. /**
  120. Number of bytes available for parameter storage in Device.
  121. It is equal to flash page size on nRF5x chips.
  122. */
  123. #if defined (NRF51)
  124. #define GZP_DEVICE_PARAMS_STORAGE_SIZE 1024
  125. #elif defined (NRF52_SERIES)
  126. #define GZP_DEVICE_PARAMS_STORAGE_SIZE 4096
  127. #else
  128. #error Chip type is undefined!
  129. #endif
  130. /**
  131. Maximum Device TX payload length [bytes].
  132. */
  133. #define GZP_MAX_FW_PAYLOAD_LENGTH 17
  134. /**
  135. Maximum Host ACK payload length [bytes].
  136. */
  137. #define GZP_MAX_ACK_PAYLOAD_LENGTH 10
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141. #endif