Skip to content

Fix compilation on targets with no UART_2 #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ports/atomvm_gps.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ static const char *const config_atom = ATOM_STR("\x6", "config"
static const char *const uart_port_atom = ATOM_STR("\x9", "uart_port");
static const char *const uart_0_atom = ATOM_STR("\x6", "uart_0");
static const char *const uart_1_atom = ATOM_STR("\x6", "uart_1");
static const char *const uart_2_atom = ATOM_STR("\x6", "uart_2");
#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S3)
static const char *const uart_2_atom = ATOM_STR("\x6", "uart_2");
#endif
static const char *const rx_pin_atom = ATOM_STR("\x6", "rx_pin");
static const char *const baud_rate_atom = ATOM_STR("\x9", "baud_rate");
static const char *const data_bits_atom = ATOM_STR("\x9", "data_bits");
Expand Down Expand Up @@ -334,9 +336,11 @@ static uart_port_t get_uart_port(Context *ctx, term config)
if (globalcontext_is_term_equal_to_atom_string(ctx->global, uart_port, uart_1_atom)) {
return UART_NUM_1;
}
#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S3)
if (globalcontext_is_term_equal_to_atom_string(ctx->global, uart_port, uart_2_atom)) {
return UART_NUM_2;
}
#endif
ESP_LOGE(TAG, "Invalid uart_port.");
return UART_NUM_MAX;
}
Expand Down