ESPHome  2024.10.2
ads1118.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include "esphome/core/hal.h"
6 
7 namespace esphome {
8 namespace ads1118 {
9 
19 };
20 
28 };
29 
30 class ADS1118 : public Component,
31  public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_TRAILING,
32  spi::DATA_RATE_1MHZ> {
33  public:
34  ADS1118() = default;
35  void setup() override;
36  void dump_config() override;
37  float get_setup_priority() const override { return setup_priority::DATA; }
39  float request_measurement(ADS1118Multiplexer multiplexer, ADS1118Gain gain, bool temperature_mode);
40 
41  protected:
42  uint16_t config_{0};
43 };
44 
45 } // namespace ads1118
46 } // namespace esphome
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
void setup() override
Definition: ads1118.cpp:10
AlsGain501 gain
The SPIDevice is what components using the SPI will create.
Definition: spi.h:391
float get_setup_priority() const override
Definition: ads1118.h:37
float request_measurement(ADS1118Multiplexer multiplexer, ADS1118Gain gain, bool temperature_mode)
Helper method to request a measurement from a sensor.
Definition: ads1118.cpp:53
void dump_config() override
Definition: ads1118.cpp:48
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7