ESPHome
2024.11.1
esphome
esphome
components
ads1118
ads1118.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/components/spi/spi.h
"
4
#include "
esphome/core/component.h
"
5
#include "
esphome/core/hal.h
"
6
7
namespace
esphome
{
8
namespace
ads1118 {
9
10
enum
ADS1118Multiplexer
{
11
ADS1118_MULTIPLEXER_P0_N1
= 0b000,
12
ADS1118_MULTIPLEXER_P0_N3
= 0b001,
13
ADS1118_MULTIPLEXER_P1_N3
= 0b010,
14
ADS1118_MULTIPLEXER_P2_N3
= 0b011,
15
ADS1118_MULTIPLEXER_P0_NG
= 0b100,
16
ADS1118_MULTIPLEXER_P1_NG
= 0b101,
17
ADS1118_MULTIPLEXER_P2_NG
= 0b110,
18
ADS1118_MULTIPLEXER_P3_NG
= 0b111,
19
};
20
21
enum
ADS1118Gain
{
22
ADS1118_GAIN_6P144
= 0b000,
23
ADS1118_GAIN_4P096
= 0b001,
24
ADS1118_GAIN_2P048
= 0b010,
25
ADS1118_GAIN_1P024
= 0b011,
26
ADS1118_GAIN_0P512
= 0b100,
27
ADS1118_GAIN_0P256
= 0b101,
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
esphome::ads1118::ADS1118_MULTIPLEXER_P0_N1
Definition:
ads1118.h:11
esphome::setup_priority::DATA
const float DATA
For components that import data from directly connected sensors like DHT.
Definition:
component.cpp:19
esphome::ads1118::ADS1118::setup
void setup() override
Definition:
ads1118.cpp:10
esphome::ads1118::ADS1118_GAIN_4P096
Definition:
ads1118.h:23
esphome::ads1118::ADS1118_GAIN_2P048
Definition:
ads1118.h:24
esphome::ads1118::ADS1118_MULTIPLEXER_P0_NG
Definition:
ads1118.h:15
esphome::ads1118::ADS1118_GAIN_0P512
Definition:
ads1118.h:26
hal.h
esphome::Component
Definition:
component.h:68
esphome::ads1118::ADS1118Gain
ADS1118Gain
Definition:
ads1118.h:21
gain
AlsGain501 gain
Definition:
ltr_definitions_501.h:128
esphome::ads1118::ADS1118_MULTIPLEXER_P1_N3
Definition:
ads1118.h:13
esphome::ads1118::ADS1118_MULTIPLEXER_P3_NG
Definition:
ads1118.h:18
spi.h
esphome::spi::SPIDevice
The SPIDevice is what components using the SPI will create.
Definition:
spi.h:391
esphome::ads1118::ADS1118_MULTIPLEXER_P0_N3
Definition:
ads1118.h:12
esphome::ads1118::ADS1118_MULTIPLEXER_P2_N3
Definition:
ads1118.h:14
esphome::ads1118::ADS1118::config_
uint16_t config_
Definition:
ads1118.h:42
esphome::ads1118::ADS1118::get_setup_priority
float get_setup_priority() const override
Definition:
ads1118.h:37
esphome::ads1118::ADS1118::ADS1118
ADS1118()=default
esphome::ads1118::ADS1118_GAIN_1P024
Definition:
ads1118.h:25
esphome::ads1118::ADS1118_MULTIPLEXER_P1_NG
Definition:
ads1118.h:16
esphome::ads1118::ADS1118_GAIN_6P144
Definition:
ads1118.h:22
esphome::ads1118::ADS1118::request_measurement
float request_measurement(ADS1118Multiplexer multiplexer, ADS1118Gain gain, bool temperature_mode)
Helper method to request a measurement from a sensor.
Definition:
ads1118.cpp:53
esphome::ads1118::ADS1118::dump_config
void dump_config() override
Definition:
ads1118.cpp:48
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
component.h
esphome::ads1118::ADS1118Multiplexer
ADS1118Multiplexer
Definition:
ads1118.h:10
esphome::ads1118::ADS1118_GAIN_0P256
Definition:
ads1118.h:27
esphome::ads1118::ADS1118_MULTIPLEXER_P2_NG
Definition:
ads1118.h:17
esphome::ads1118::ADS1118
Definition:
ads1118.h:30
Generated by
1.8.13