mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 13:27:14 +00:00
[spi] Skip logging on begin_transaction() of an auto-releasing write-only SPI device (#16921)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
committed by
Jesse Hills
parent
83504d2de2
commit
20925b3220
@@ -17,6 +17,11 @@ class SPIDelegateHw : public SPIDelegate {
|
|||||||
write_only_(write_only) {
|
write_only_(write_only) {
|
||||||
if (!this->release_device_)
|
if (!this->release_device_)
|
||||||
add_device_();
|
add_device_();
|
||||||
|
|
||||||
|
if (this->write_only_) {
|
||||||
|
ESP_LOGV(TAG, "SPI device with CS pin %d using half-duplex mode (write-only)",
|
||||||
|
Utility::get_pin_no(this->cs_pin_));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_ready() override { return this->handle_ != nullptr; }
|
bool is_ready() override { return this->handle_ != nullptr; }
|
||||||
@@ -195,11 +200,8 @@ class SPIDelegateHw : public SPIDelegate {
|
|||||||
config.post_cb = nullptr;
|
config.post_cb = nullptr;
|
||||||
if (this->bit_order_ == BIT_ORDER_LSB_FIRST)
|
if (this->bit_order_ == BIT_ORDER_LSB_FIRST)
|
||||||
config.flags |= SPI_DEVICE_BIT_LSBFIRST;
|
config.flags |= SPI_DEVICE_BIT_LSBFIRST;
|
||||||
if (this->write_only_) {
|
if (this->write_only_)
|
||||||
config.flags |= SPI_DEVICE_HALFDUPLEX | SPI_DEVICE_NO_DUMMY;
|
config.flags |= SPI_DEVICE_HALFDUPLEX | SPI_DEVICE_NO_DUMMY;
|
||||||
ESP_LOGD(TAG, "SPI device with CS pin %d using half-duplex mode (write-only)",
|
|
||||||
Utility::get_pin_no(this->cs_pin_));
|
|
||||||
}
|
|
||||||
esp_err_t const err = spi_bus_add_device(this->channel_, &config, &this->handle_);
|
esp_err_t const err = spi_bus_add_device(this->channel_, &config, &this->handle_);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Add device failed - err %X", err);
|
ESP_LOGE(TAG, "Add device failed - err %X", err);
|
||||||
|
|||||||
Reference in New Issue
Block a user