forked from espressif/esp-idf
Merge branch 'contrib/github_pr_10856' into 'master'
Correct typo in referenced function name (GitHub PR) Closes IDFGH-9496 See merge request espressif/esp-idf!22537
This commit is contained in:
@@ -512,28 +512,6 @@ esp_err_t uart_pattern_queue_reset(uart_port_t uart_num, int queue_length)
|
|||||||
return ESP_OK;
|
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_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");
|
ESP_RETURN_ON_FALSE(uart_num < UART_NUM_MAX, ESP_FAIL, UART_TAG, "uart_num error");
|
||||||
|
@@ -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:
|
- **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`
|
- Disable the interrupt using :cpp:func:`uart_disable_pattern_det_intr`
|
||||||
|
|
||||||
|
|
||||||
|
@@ -233,7 +233,7 @@ API 提供了一种便利的方法来处理本文所讨论的特定中断,即
|
|||||||
|
|
||||||
- **模式检测**:在检测到重复接收/发送同一字符的“模式”时触发中断,请参考示例 :example:`peripherals/uart/uart_events`。例如,模式检测可用于检测命令字符串末尾是否存在特定数量的相同字符(“模式”)。可以调用以下函数:
|
- **模式检测**:在检测到重复接收/发送同一字符的“模式”时触发中断,请参考示例 :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`
|
- 禁用中断:调用 :cpp:func:`uart_disable_pattern_det_intr`
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user