bsp_nfc.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /**
  2. * Copyright (c) 2016 - 2019, 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. /**@file
  41. *
  42. * @defgroup bsp_nfc NFC BSP Module
  43. * @{
  44. * @ingroup bsp
  45. *
  46. * @brief Module for setting the NFCT peripheral as a wakeup source.
  47. *
  48. * @details The application must notify this module before going into System OFF mode.
  49. * Based on this notification, the NFC BSP Module sets the NFCT peripheral as a wakeup source
  50. * through the Board Support Package. Additionally, any BSP Button can be configured to
  51. * generate BSP sleep events. This module is applicable only if NFCT is used exclusively for
  52. * wakeup. If NFCT is used for a different purpose, this module cannot be used.
  53. */
  54. #ifndef BSP_NFC_H__
  55. #define BSP_NFC_H__
  56. #include <stdint.h>
  57. #include "sdk_errors.h"
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif
  61. /**@brief Function for initializing the NFC Button Module.
  62. *
  63. * Before calling this function, the BSP module must be initialized with buttons. The chosen
  64. * button is used to generate @ref BSP_EVENT_SLEEP events.
  65. *
  66. * @param[in] sleep_button Button ID used to generate @ref BSP_EVENT_SLEEP event.
  67. *
  68. * @retval NRF_SUCCESS If initialization was successful. Otherwise, a propagated error
  69. * code is returned.
  70. */
  71. ret_code_t bsp_nfc_btn_init(uint32_t sleep_button);
  72. /**@brief Function for deinitializing the NFC Button Module.
  73. *
  74. * Before calling this function, the BSP module must be initialized with buttons. The chosen
  75. * button is used to generate default @ref BSP_EVENT_DEFAULT events.
  76. *
  77. * @param[in] sleep_button Button ID used to restore default event generation.
  78. *
  79. * @retval NRF_SUCCESS If initialization was successful. Otherwise, a propagated error
  80. * code is returned.
  81. */
  82. ret_code_t bsp_nfc_btn_deinit(uint32_t sleep_button);
  83. /**@brief Function for setting up NFCT peripheral as wake-up source.
  84. *
  85. * This function must be called before going into System OFF mode.
  86. *
  87. * @note This function is only applicable if NFCT is used exclusively for wakeup.
  88. * If NFCT is used for a different purpose, this function cannot be used.
  89. *
  90. * @retval NRF_SUCCESS If NFCT peripheral was prepared successfully. Otherwise,
  91. * a propagated error code is returned.
  92. */
  93. ret_code_t bsp_nfc_sleep_mode_prepare(void);
  94. #ifdef __cplusplus
  95. }
  96. #endif
  97. #endif /* BSP_NFC_H__ */
  98. /** @} */