esp_ot_config.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: CC0-1.0
  5. *
  6. * OpenThread Command Line Example
  7. *
  8. * This example code is in the Public Domain (or CC0 licensed, at your option.)
  9. *
  10. * Unless required by applicable law or agreed to in writing, this
  11. * software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  12. * CONDITIONS OF ANY KIND, either express or implied.
  13. */
  14. #pragma once
  15. #include "esp_openthread_types.h"
  16. #if SOC_IEEE802154_SUPPORTED
  17. #define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \
  18. { \
  19. .radio_mode = RADIO_MODE_NATIVE, \
  20. }
  21. #else
  22. #define ESP_OPENTHREAD_DEFAULT_RADIO_CONFIG() \
  23. { \
  24. .radio_mode = RADIO_MODE_UART_RCP, \
  25. .radio_uart_config = { \
  26. .port = 1, \
  27. .uart_config = \
  28. { \
  29. .baud_rate = 115200, \
  30. .data_bits = UART_DATA_8_BITS, \
  31. .parity = UART_PARITY_DISABLE, \
  32. .stop_bits = UART_STOP_BITS_1, \
  33. .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \
  34. .rx_flow_ctrl_thresh = 0, \
  35. .source_clk = UART_SCLK_DEFAULT, \
  36. }, \
  37. .rx_pin = 4, \
  38. .tx_pin = 5, \
  39. }, \
  40. }
  41. #endif
  42. #if CONFIG_OPENTHREAD_CONSOLE_TYPE_UART
  43. #define ESP_OPENTHREAD_DEFAULT_HOST_CONFIG() \
  44. { \
  45. .host_connection_mode = HOST_CONNECTION_MODE_CLI_UART, \
  46. .host_uart_config = { \
  47. .port = 0, \
  48. .uart_config = \
  49. { \
  50. .baud_rate = 115200, \
  51. .data_bits = UART_DATA_8_BITS, \
  52. .parity = UART_PARITY_DISABLE, \
  53. .stop_bits = UART_STOP_BITS_1, \
  54. .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, \
  55. .rx_flow_ctrl_thresh = 0, \
  56. .source_clk = UART_SCLK_DEFAULT, \
  57. }, \
  58. .rx_pin = UART_PIN_NO_CHANGE, \
  59. .tx_pin = UART_PIN_NO_CHANGE, \
  60. }, \
  61. }
  62. #elif CONFIG_OPENTHREAD_CONSOLE_TYPE_USB_SERIAL_JTAG
  63. #define ESP_OPENTHREAD_DEFAULT_HOST_CONFIG() \
  64. { \
  65. .host_connection_mode = HOST_CONNECTION_MODE_CLI_USB, \
  66. .host_usb_config = USB_SERIAL_JTAG_DRIVER_CONFIG_DEFAULT(), \
  67. }
  68. #endif
  69. #define ESP_OPENTHREAD_DEFAULT_PORT_CONFIG() \
  70. { \
  71. .storage_partition_name = "nvs", \
  72. .netif_queue_size = 10, \
  73. .task_queue_size = 10, \
  74. }