mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Fix a few ESP32-C3 compiler issues (#2265)
* Fix using Serial when using ESP32-C3 standard pins * Force type for std::min in pn532 * Fix variable size where size_t is different on exp32-c3
This commit is contained in:
parent
bad161a5c1
commit
affaaf7d2c
3 changed files with 6 additions and 2 deletions
|
@ -707,7 +707,7 @@ APIError APIPlaintextFrameHelper::try_read_frame_(ParsedFrame *frame) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t i = 1;
|
size_t i = 1;
|
||||||
size_t consumed = 0;
|
uint32_t consumed = 0;
|
||||||
auto msg_size_varint = ProtoVarInt::parse(&rx_header_buf_[i], rx_header_buf_.size() - i, &consumed);
|
auto msg_size_varint = ProtoVarInt::parse(&rx_header_buf_[i], rx_header_buf_.size() - i, &consumed);
|
||||||
if (!msg_size_varint.has_value()) {
|
if (!msg_size_varint.has_value()) {
|
||||||
// not enough data there yet
|
// not enough data there yet
|
||||||
|
|
|
@ -49,7 +49,7 @@ void PN532::setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up SAM (secure access module)
|
// Set up SAM (secure access module)
|
||||||
uint8_t sam_timeout = std::min(255u, this->update_interval_ / 50);
|
uint8_t sam_timeout = std::min<uint8_t>(255u, this->update_interval_ / 50);
|
||||||
if (!this->write_command_({
|
if (!this->write_command_({
|
||||||
PN532_COMMAND_SAMCONFIGURATION,
|
PN532_COMMAND_SAMCONFIGURATION,
|
||||||
0x01, // normal mode
|
0x01, // normal mode
|
||||||
|
|
|
@ -73,7 +73,11 @@ void UARTComponent::setup() {
|
||||||
// Use Arduino HardwareSerial UARTs if all used pins match the ones
|
// Use Arduino HardwareSerial UARTs if all used pins match the ones
|
||||||
// preconfigured by the platform. For example if RX disabled but TX pin
|
// preconfigured by the platform. For example if RX disabled but TX pin
|
||||||
// is 1 we still want to use Serial.
|
// is 1 we still want to use Serial.
|
||||||
|
#ifdef CONFIG_IDF_TARGET_ESP32C3
|
||||||
|
if (this->tx_pin_.value_or(21) == 21 && this->rx_pin_.value_or(20) == 20) {
|
||||||
|
#else
|
||||||
if (this->tx_pin_.value_or(1) == 1 && this->rx_pin_.value_or(3) == 3) {
|
if (this->tx_pin_.value_or(1) == 1 && this->rx_pin_.value_or(3) == 3) {
|
||||||
|
#endif
|
||||||
this->hw_serial_ = &Serial;
|
this->hw_serial_ = &Serial;
|
||||||
} else {
|
} else {
|
||||||
this->hw_serial_ = new HardwareSerial(next_uart_num++);
|
this->hw_serial_ = new HardwareSerial(next_uart_num++);
|
||||||
|
|
Loading…
Reference in a new issue