nrf52_to_nrf52840.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. Copyright (c) 2010 - 2020, Nordic Semiconductor ASA
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without modification,
  5. are permitted provided that the following conditions are met:
  6. 1. Redistributions of source code must retain the above copyright notice, this
  7. list of conditions and the following disclaimer.
  8. 2. Redistributions in binary form, except as embedded into a Nordic
  9. Semiconductor ASA integrated circuit in a product or a software update for
  10. such product, must reproduce the above copyright notice, this list of
  11. conditions and the following disclaimer in the documentation and/or other
  12. materials provided with the distribution.
  13. 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  14. contributors may be used to endorse or promote products derived from this
  15. software without specific prior written permission.
  16. 4. This software, with or without modification, must only be used with a
  17. Nordic Semiconductor ASA integrated circuit.
  18. 5. Any software provided in binary form under this license must not be reverse
  19. engineered, decompiled, modified and/or disassembled.
  20. THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  21. OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  22. OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23. DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  24. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  26. GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  29. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. #ifndef NRF52_TO_NRF52840_H
  32. #define NRF52_TO_NRF52840_H
  33. /*lint ++flb "Enter library region */
  34. /* This file is given to prevent your SW from not compiling with the name changes between nRF51 or nRF52832 and nRF52840 devices.
  35. * It redefines the old nRF51 or nRF52832 names into the new ones as long as the functionality is still supported. If the
  36. * functionality is gone, there old names are not defined, so compilation will fail. Note that also includes macros
  37. * from the nrf52_namechange.h file. */
  38. /* Differences between latest nRF52 headers and nRF52840 headers. */
  39. /* UART */
  40. /* The registers PSELRTS, PSELTXD, PSELCTS, PSELRXD were restructured into a struct. */
  41. #ifndef PSELRTS
  42. #define PSELRTS PSEL.RTS
  43. #endif
  44. #ifndef PSELTXD
  45. #define PSELTXD PSEL.TXD
  46. #endif
  47. #ifndef PSELCTS
  48. #define PSELCTS PSEL.CTS
  49. #endif
  50. #ifndef PSELRXD
  51. #define PSELRXD PSEL.RXD
  52. #endif
  53. /* TWI */
  54. /* The registers PSELSCL, PSELSDA were restructured into a struct. */
  55. #ifndef PSELSCL
  56. #define PSELSCL PSEL.SCL
  57. #endif
  58. #ifndef PSELSDA
  59. #define PSELSDA PSEL.SDA
  60. #endif
  61. /* LPCOMP */
  62. /* The hysteresis control enumerated values has changed name for nRF52840 devices. */
  63. #ifndef LPCOMP_HYST_HYST_NoHyst
  64. #define LPCOMP_HYST_HYST_NoHyst LPCOMP_HYST_HYST_Disabled
  65. #endif
  66. #ifndef LPCOMP_HYST_HYST_Hyst50mV
  67. #define LPCOMP_HYST_HYST_Hyst50mV LPCOMP_HYST_HYST_Enabled
  68. #endif
  69. /* From nrf52_name_change.h. Several macros changed in different versions of nRF52 headers. By defining the following, any code written for any version of nRF52 headers will still compile. */
  70. /* I2S */
  71. /* Several enumerations changed case. Adding old macros to keep compilation compatibility. */
  72. #ifndef I2S_ENABLE_ENABLE_DISABLE
  73. #define I2S_ENABLE_ENABLE_DISABLE I2S_ENABLE_ENABLE_Disabled
  74. #endif
  75. #ifndef I2S_ENABLE_ENABLE_ENABLE
  76. #define I2S_ENABLE_ENABLE_ENABLE I2S_ENABLE_ENABLE_Enabled
  77. #endif
  78. #ifndef I2S_CONFIG_MODE_MODE_MASTER
  79. #define I2S_CONFIG_MODE_MODE_MASTER I2S_CONFIG_MODE_MODE_Master
  80. #endif
  81. #ifndef I2S_CONFIG_MODE_MODE_SLAVE
  82. #define I2S_CONFIG_MODE_MODE_SLAVE I2S_CONFIG_MODE_MODE_Slave
  83. #endif
  84. #ifndef I2S_CONFIG_RXEN_RXEN_DISABLE
  85. #define I2S_CONFIG_RXEN_RXEN_DISABLE I2S_CONFIG_RXEN_RXEN_Disabled
  86. #endif
  87. #ifndef I2S_CONFIG_RXEN_RXEN_ENABLE
  88. #define I2S_CONFIG_RXEN_RXEN_ENABLE I2S_CONFIG_RXEN_RXEN_Enabled
  89. #endif
  90. #ifndef I2S_CONFIG_TXEN_TXEN_DISABLE
  91. #define I2S_CONFIG_TXEN_TXEN_DISABLE I2S_CONFIG_TXEN_TXEN_Disabled
  92. #endif
  93. #ifndef I2S_CONFIG_TXEN_TXEN_ENABLE
  94. #define I2S_CONFIG_TXEN_TXEN_ENABLE I2S_CONFIG_TXEN_TXEN_Enabled
  95. #endif
  96. #ifndef I2S_CONFIG_MCKEN_MCKEN_DISABLE
  97. #define I2S_CONFIG_MCKEN_MCKEN_DISABLE I2S_CONFIG_MCKEN_MCKEN_Disabled
  98. #endif
  99. #ifndef I2S_CONFIG_MCKEN_MCKEN_ENABLE
  100. #define I2S_CONFIG_MCKEN_MCKEN_ENABLE I2S_CONFIG_MCKEN_MCKEN_Enabled
  101. #endif
  102. #ifndef I2S_CONFIG_SWIDTH_SWIDTH_8BIT
  103. #define I2S_CONFIG_SWIDTH_SWIDTH_8BIT I2S_CONFIG_SWIDTH_SWIDTH_8Bit
  104. #endif
  105. #ifndef I2S_CONFIG_SWIDTH_SWIDTH_16BIT
  106. #define I2S_CONFIG_SWIDTH_SWIDTH_16BIT I2S_CONFIG_SWIDTH_SWIDTH_16Bit
  107. #endif
  108. #ifndef I2S_CONFIG_SWIDTH_SWIDTH_24BIT
  109. #define I2S_CONFIG_SWIDTH_SWIDTH_24BIT I2S_CONFIG_SWIDTH_SWIDTH_24Bit
  110. #endif
  111. #ifndef I2S_CONFIG_ALIGN_ALIGN_LEFT
  112. #define I2S_CONFIG_ALIGN_ALIGN_LEFT I2S_CONFIG_ALIGN_ALIGN_Left
  113. #endif
  114. #ifndef I2S_CONFIG_ALIGN_ALIGN_RIGHT
  115. #define I2S_CONFIG_ALIGN_ALIGN_RIGHT I2S_CONFIG_ALIGN_ALIGN_Right
  116. #endif
  117. #ifndef I2S_CONFIG_FORMAT_FORMAT_ALIGNED
  118. #define I2S_CONFIG_FORMAT_FORMAT_ALIGNED I2S_CONFIG_FORMAT_FORMAT_Aligned
  119. #endif
  120. #ifndef I2S_CONFIG_CHANNELS_CHANNELS_STEREO
  121. #define I2S_CONFIG_CHANNELS_CHANNELS_STEREO I2S_CONFIG_CHANNELS_CHANNELS_Stereo
  122. #endif
  123. #ifndef I2S_CONFIG_CHANNELS_CHANNELS_LEFT
  124. #define I2S_CONFIG_CHANNELS_CHANNELS_LEFT I2S_CONFIG_CHANNELS_CHANNELS_Left
  125. #endif
  126. #ifndef I2S_CONFIG_CHANNELS_CHANNELS_RIGHT
  127. #define I2S_CONFIG_CHANNELS_CHANNELS_RIGHT I2S_CONFIG_CHANNELS_CHANNELS_Right
  128. #endif
  129. /* LPCOMP */
  130. /* Corrected typo in RESULT register. */
  131. #ifndef LPCOMP_RESULT_RESULT_Bellow
  132. #define LPCOMP_RESULT_RESULT_Bellow LPCOMP_RESULT_RESULT_Below
  133. #endif
  134. /*lint --flb "Leave library region" */
  135. #endif /* NRF51_TO_NRF52840_H */