ESPHome  2024.9.2
mcp3204.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/hal.h"
6 
7 namespace esphome {
8 namespace mcp3204 {
9 
10 class MCP3204 : public Component,
11  public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
12  spi::DATA_RATE_1MHZ> {
13  public:
14  MCP3204() = default;
15 
16  void set_reference_voltage(float reference_voltage) { this->reference_voltage_ = reference_voltage; }
17 
18  void setup() override;
19  void dump_config() override;
20  float get_setup_priority() const override;
21  float read_data(uint8_t pin);
22 
23  protected:
25 };
26 
27 } // namespace mcp3204
28 } // namespace esphome
float read_data(uint8_t pin)
Definition: mcp3204.cpp:22
void set_reference_voltage(float reference_voltage)
Definition: mcp3204.h:16
void dump_config() override
Definition: mcp3204.cpp:16
float get_setup_priority() const override
Definition: mcp3204.cpp:9
The SPIDevice is what components using the SPI will create.
Definition: spi.h:391
void setup() override
Definition: mcp3204.cpp:11
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7