esp_zigbee_gateway.h 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: LicenseRef-Included
  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,
  10. * this list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Espressif Systems
  13. * integrated circuit in a product or a software update for such product,
  14. * must reproduce the above copyright notice, this list of conditions and
  15. * the following disclaimer in the documentation and/or other materials
  16. * provided with the distribution.
  17. *
  18. * 3. Neither the name of the copyright holder nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software without
  20. * specific prior written permission.
  21. *
  22. * 4. Any software provided in binary form under this license must not be reverse
  23. * engineered, decompiled, modified and/or disassembled.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  29. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  30. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  31. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  32. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  33. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  34. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  35. * POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. #include "esp_err.h"
  38. #include "esp_zigbee_core.h"
  39. /* Zigbee Configuration */
  40. #define MAX_CHILDREN 10 /* the max amount of connected devices */
  41. #define INSTALLCODE_POLICY_ENABLE false /* enable the install code policy for security */
  42. #define ESP_ZB_PRIMARY_CHANNEL_MASK (1l << 13) /* Zigbee primary channel mask use in the example */
  43. #define ESP_ZB_ZC_CONFIG() \
  44. { \
  45. .esp_zb_role = ESP_ZB_DEVICE_TYPE_COORDINATOR, \
  46. .install_code_policy = INSTALLCODE_POLICY_ENABLE, \
  47. .nwk_cfg.zczr_cfg = { \
  48. .max_children = MAX_CHILDREN, \
  49. }, \
  50. }
  51. #if CONFIG_ZB_RADIO_NATIVE
  52. #define ESP_ZB_DEFAULT_RADIO_CONFIG() \
  53. { \
  54. .radio_mode = RADIO_MODE_NATIVE, \
  55. }
  56. #else
  57. #define ESP_ZB_DEFAULT_RADIO_CONFIG() \
  58. { \
  59. .radio_mode = RADIO_MODE_UART_RCP, \
  60. .radio_uart_config = { \
  61. .port = 1, \
  62. .uart_config = \
  63. { \
  64. .baud_rate = 115200, \
  65. .data_bits = UART_DATA_8_BITS, \
  66. .parity = UART_PARITY_DISABLE, \
  67. .stop_bits = UART_STOP_BITS_1, \
  68. .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \
  69. .rx_flow_ctrl_thresh = 0, \
  70. .source_clk = UART_SCLK_DEFAULT, \
  71. }, \
  72. .rx_pin = 4, \
  73. .tx_pin = 5, \
  74. }, \
  75. }
  76. #endif
  77. #define ESP_ZB_DEFAULT_HOST_CONFIG() \
  78. { \
  79. .host_connection_mode = HOST_CONNECTION_MODE_NONE, \
  80. }