Skip to content

Commit

Permalink
Added UART GPIO out of range check
Browse files Browse the repository at this point in the history
  • Loading branch information
seeul8er committed Jan 1, 2025
1 parent 0d3993e commit 613d42d
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 298 deletions.
4 changes: 4 additions & 0 deletions main/db_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ esp_err_t open_uart_serial_socket() {
ESP_LOGW(TAG, "Init UART socket aborted. TX GPIO == RX GPIO - Configure first!");
return ESP_FAIL;
}
if (DB_UART_PIN_TX > SOC_GPIO_IN_RANGE_MAX || DB_UART_PIN_RX > SOC_GPIO_IN_RANGE_MAX || DB_UART_PIN_CTS > SOC_GPIO_IN_RANGE_MAX || DB_UART_PIN_RTS > SOC_GPIO_IN_RANGE_MAX) {
ESP_LOGW(TAG, "UART GPIO numbers out of range %i. Configure first!", SOC_GPIO_IN_RANGE_MAX);
return ESP_FAIL;
}
bool flow_control = DB_UART_PIN_CTS != DB_UART_PIN_RTS;
ESP_LOGI(TAG, "Flow control enabled: %s", flow_control ? "true" : "false");
uart_config_t uart_config = {
Expand Down
Loading

0 comments on commit 613d42d

Please sign in to comment.