1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-05 18:28:17 +00:00
Jimmy Hedman 19022ace12
Make SPI compile with IDF >= 5.0 (#6383)
Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
2024-03-19 15:56:36 +13:00

32 lines
859 B
C++

#include "spi_device.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include <cinttypes>
namespace esphome {
namespace spi_device {
static const char *const TAG = "spi_device";
void SPIDeviceComponent::setup() {
ESP_LOGD(TAG, "Setting up SPIDevice...");
this->spi_setup();
ESP_LOGCONFIG(TAG, "SPIDevice started!");
}
void SPIDeviceComponent::dump_config() {
ESP_LOGCONFIG(TAG, "SPIDevice");
LOG_PIN(" CS pin: ", this->cs_);
ESP_LOGCONFIG(TAG, " Mode: %d", this->mode_);
if (this->data_rate_ < 1000000) {
ESP_LOGCONFIG(TAG, " Data rate: %" PRId32 "kHz", this->data_rate_ / 1000);
} else {
ESP_LOGCONFIG(TAG, " Data rate: %" PRId32 "MHz", this->data_rate_ / 1000000);
}
}
float SPIDeviceComponent::get_setup_priority() const { return setup_priority::DATA; }
} // namespace spi_device
} // namespace esphome