ESPHome  2024.10.2
spi_device.cpp
Go to the documentation of this file.
1 #include "spi_device.h"
2 #include "esphome/core/log.h"
3 #include "esphome/core/hal.h"
4 #include <cinttypes>
5 
6 namespace esphome {
7 namespace spi_device {
8 
9 static const char *const TAG = "spi_device";
10 
12  ESP_LOGD(TAG, "Setting up SPIDevice...");
13  this->spi_setup();
14  ESP_LOGCONFIG(TAG, "SPIDevice started!");
15 }
16 
18  ESP_LOGCONFIG(TAG, "SPIDevice");
19  LOG_PIN(" CS pin: ", this->cs_);
20  ESP_LOGCONFIG(TAG, " Mode: %d", this->mode_);
21  if (this->data_rate_ < 1000000) {
22  ESP_LOGCONFIG(TAG, " Data rate: %" PRId32 "kHz", this->data_rate_ / 1000);
23  } else {
24  ESP_LOGCONFIG(TAG, " Data rate: %" PRId32 "MHz", this->data_rate_ / 1000000);
25  }
26 }
27 
29 
30 } // namespace spi_device
31 } // namespace esphome
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
GPIOPin * cs_
Definition: spi.h:378
uint32_t data_rate_
Definition: spi.h:376
float get_setup_priority() const override
Definition: spi_device.cpp:28
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7