bsp_config.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /**
  2. * Copyright (c) 2014 - 2018, 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 Board Support Package
  43. * @{
  44. * @ingroup app_common
  45. *
  46. * @brief BSP module.
  47. * @details This module provides a layer of abstraction from the board.
  48. * It allows the user to indicate certain states on LEDs in a simple way.
  49. * Module functionality can be modified by additional defines:
  50. * - BSP_SIMPLE - reduces functionality of this module to enable
  51. * and read state of the buttons.
  52. * - BSP_UART_SUPPORT - enables support for UART.
  53. */
  54. #ifndef BSP_CONFIG_H__
  55. #define BSP_CONFIG_H__
  56. #include <stdint.h>
  57. #include <stdbool.h>
  58. #include "boards.h"
  59. #ifdef __cplusplus
  60. extern "C" {
  61. #endif
  62. #if !defined(BSP_DEFINES_ONLY) && !defined(BSP_SIMPLE)
  63. #include "app_button.h"
  64. #define BSP_BUTTON_ACTION_PUSH (APP_BUTTON_PUSH) /**< Represents pushing a button. See @ref bsp_button_action_t. */
  65. #define BSP_BUTTON_ACTION_RELEASE (APP_BUTTON_RELEASE) /**< Represents releasing a button. See @ref bsp_button_action_t. */
  66. #define BSP_BUTTON_ACTION_LONG_PUSH (2) /**< Represents pushing and holding a button for @ref BSP_LONG_PUSH_TIMEOUT_MS milliseconds. See also @ref bsp_button_action_t. */
  67. #endif
  68. #define BSP_MS_TO_TICK(MS) (m_app_ticks_per_100ms * (MS / 100))
  69. #define BUTTON_ERASE_BONDING BSP_BUTTON_0_MASK
  70. #define BUTTON_ERASE_ALL BSP_BUTTON_1_MASK
  71. #define BUTTON_ADVERTISE BSP_BUTTON_0_MASK
  72. #define BUTTON_CLEAR_EVT BSP_BUTTON_1_MASK
  73. #define BUTTON_CAPSLOCK BSP_BUTTON_2_MASK
  74. #define BSP_BUTTONS_ALL 0xFFFFFFFF
  75. #define BSP_BUTTONS_NONE 0
  76. #define BSP_LONG_PUSH_TIMEOUT_MS (1000) /**< The time to hold for a long push (in milliseconds). */
  77. /**@brief Types of BSP initialization.
  78. */
  79. #define ADVERTISING_LED_ON_INTERVAL 200
  80. #define ADVERTISING_LED_OFF_INTERVAL 1800
  81. #define ADVERTISING_DIRECTED_LED_ON_INTERVAL 200
  82. #define ADVERTISING_DIRECTED_LED_OFF_INTERVAL 200
  83. #define ADVERTISING_WHITELIST_LED_ON_INTERVAL 200
  84. #define ADVERTISING_WHITELIST_LED_OFF_INTERVAL 800
  85. #define ADVERTISING_SLOW_LED_ON_INTERVAL 400
  86. #define ADVERTISING_SLOW_LED_OFF_INTERVAL 4000
  87. #define BONDING_INTERVAL 100
  88. #define SENT_OK_INTERVAL 100
  89. #define SEND_ERROR_INTERVAL 500
  90. #define RCV_OK_INTERVAL 100
  91. #define RCV_ERROR_INTERVAL 500
  92. #define ALERT_INTERVAL 200
  93. #define BSP_LED_INDICATE_SENT_OK BSP_BOARD_LED_1
  94. #define BSP_LED_INDICATE_SEND_ERROR BSP_BOARD_LED_1
  95. #define BSP_LED_INDICATE_RCV_OK BSP_BOARD_LED_1
  96. #define BSP_LED_INDICATE_RCV_ERROR BSP_BOARD_LED_1
  97. #define BSP_LED_INDICATE_CONNECTED BSP_BOARD_LED_0
  98. #define BSP_LED_INDICATE_BONDING BSP_BOARD_LED_0
  99. #define BSP_LED_INDICATE_ADVERTISING_DIRECTED BSP_BOARD_LED_0
  100. #define BSP_LED_INDICATE_ADVERTISING_SLOW BSP_BOARD_LED_0
  101. #define BSP_LED_INDICATE_ADVERTISING_WHITELIST BSP_BOARD_LED_0
  102. #define BSP_LED_INDICATE_INDICATE_ADVERTISING BSP_BOARD_LED_0
  103. #define BSP_LED_INDICATE_USER_LED1 BSP_BOARD_LED_0
  104. #define BSP_LED_INDICATE_USER_LED2 BSP_BOARD_LED_1
  105. #define BSP_LED_INDICATE_USER_LED3 BSP_BOARD_LED_2
  106. #define BSP_LED_INDICATE_USER_LED4 BSP_BOARD_LED_3
  107. #define BSP_LED_ALERT BSP_BOARD_LED_2
  108. #ifdef __cplusplus
  109. }
  110. #endif
  111. #endif // BSP_CONFIG_H__
  112. /** @} */