Skip to content

Commit

Permalink
Merge branch 'contrib/github_pr_10856' into 'master'
Browse files Browse the repository at this point in the history
Correct typo in referenced function name (GitHub PR)

Closes IDFGH-9496

See merge request espressif/esp-idf!22537
  • Loading branch information
songruo committed Mar 1, 2023
2 parents 63d0494 + 6a21403 commit 0558d40
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
22 changes: 0 additions & 22 deletions components/driver/uart/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,28 +512,6 @@ esp_err_t uart_pattern_queue_reset(uart_port_t uart_num, int queue_length)
return ESP_OK;
}

#if CONFIG_IDF_TARGET_ESP32
esp_err_t uart_enable_pattern_det_intr(uart_port_t uart_num, char pattern_chr, uint8_t chr_num, int chr_tout, int post_idle, int pre_idle)
{
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
ESP_RETURN_ON_FALSE(chr_tout >= 0 && chr_tout <= UART_RX_GAP_TOUT_V, ESP_FAIL, UART_TAG, "uart pattern set error\n");
ESP_RETURN_ON_FALSE(post_idle >= 0 && post_idle <= UART_POST_IDLE_NUM_V, ESP_FAIL, UART_TAG, "uart pattern set error\n");
ESP_RETURN_ON_FALSE(pre_idle >= 0 && pre_idle <= UART_PRE_IDLE_NUM_V, ESP_FAIL, UART_TAG, "uart pattern set error\n");
uart_at_cmd_t at_cmd = {0};
at_cmd.cmd_char = pattern_chr;
at_cmd.char_num = chr_num;
at_cmd.gap_tout = chr_tout;
at_cmd.pre_idle = pre_idle;
at_cmd.post_idle = post_idle;
uart_hal_clr_intsts_mask(&(uart_context[uart_num].hal), UART_INTR_CMD_CHAR_DET);
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
uart_hal_set_at_cmd_char(&(uart_context[uart_num].hal), &at_cmd);
uart_hal_ena_intr_mask(&(uart_context[uart_num].hal), UART_INTR_CMD_CHAR_DET);
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
return ESP_OK;
}
#endif

esp_err_t uart_enable_pattern_det_baud_intr(uart_port_t uart_num, char pattern_chr, uint8_t chr_num, int chr_tout, int post_idle, int pre_idle)
{
ESP_RETURN_ON_FALSE(uart_num < UART_NUM_MAX, ESP_FAIL, UART_TAG, "uart_num error");
Expand Down
2 changes: 1 addition & 1 deletion docs/en/api-reference/peripherals/uart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ The API provides a convenient way to handle specific interrupts discussed in thi

- **Pattern detection**: An interrupt triggered on detecting a 'pattern' of the same character being received/sent repeatedly. This functionality is demonstrated in the example :example:`peripherals/uart/uart_events`. It can be used, e.g., to detect a command string with a specific number of identical characters (the 'pattern') at the end. The following functions are available:

- Configure and enable this interrupt using :cpp:func:`uart_enable_pattern_det_intr`
- Configure and enable this interrupt using :cpp:func:`uart_enable_pattern_det_baud_intr`
- Disable the interrupt using :cpp:func:`uart_disable_pattern_det_intr`


Expand Down
2 changes: 1 addition & 1 deletion docs/zh_CN/api-reference/peripherals/uart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ API 提供了一种便利的方法来处理本文所讨论的特定中断,即

- **模式检测**:在检测到重复接收/发送同一字符的“模式”时触发中断,请参考示例 :example:`peripherals/uart/uart_events`。例如,模式检测可用于检测命令字符串末尾是否存在特定数量的相同字符(“模式”)。可以调用以下函数:

- 配置并启用此中断:调用 :cpp:func:`uart_enable_pattern_det_intr`
- 配置并启用此中断:调用 :cpp:func:`uart_enable_pattern_det_baud_intr`
- 禁用中断:调用 :cpp:func:`uart_disable_pattern_det_intr`


Expand Down

0 comments on commit 0558d40

Please sign in to comment.