You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a library requiring the UART conf1.rxfifo_full_thrhd being set to 1. To not leave that to the users, we do it like
...
uart_dev_t *uart = nullptr;
uint8_t uart_num = 0;
if (&serial == &Serial) {
uart_num = 0;
uart = &UART0;
} else {
if (&serial == &Serial1) {
uart_num = 1;
uart = &UART1;
} else {
if (&serial == &Serial2) {
uart_num = 2;
uart = &UART2;
}
}
}
// Is it a defined serial?
if (uart != nullptr) {
// Yes. get the current value and set ours instead
rc = uart->conf1.rxfifo_full_thrhd;
uart->conf1.rxfifo_full_thrhd = thresholdBytes;
LOG_D("Serial%u FIFO threshold set to %d (was %d)\n", thresholdBytes, rc);
} else {
LOG_W("Unable to identify serial\n");
}
}
...
While this was working okay for the "classic" ESP32s, like WROOM and WROVER, it failed due to the non-existing UARTs for the newer MCUs like the S2 or C3, because there was no way in the 1.0.x core to determine at compile time the number of UARTs present.
Now in core 2.0.x we have the SOC_UART_NUM preprocessor variable to do the differentiation. That is nice, but is failing again for the users still using the 1.0.x core.
Is there any advisable way to get the differentiation in both the old and newer core? I mean, without taking the core version to incllude/exclude a chunk of code depending on it?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We have a library requiring the UART
conf1.rxfifo_full_thrhd
being set to 1. To not leave that to the users, we do it likeWhile this was working okay for the "classic" ESP32s, like WROOM and WROVER, it failed due to the non-existing UARTs for the newer MCUs like the S2 or C3, because there was no way in the 1.0.x core to determine at compile time the number of UARTs present.
Now in core 2.0.x we have the SOC_UART_NUM preprocessor variable to do the differentiation. That is nice, but is failing again for the users still using the 1.0.x core.
Is there any advisable way to get the differentiation in both the old and newer core? I mean, without taking the core version to incllude/exclude a chunk of code depending on it?
Beta Was this translation helpful? Give feedback.
All reactions