ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
adc128s102.cpp
Go to the documentation of this file.
1#include "adc128s102.h"
2#include "esphome/core/log.h"
4
6
7ESPHOME_LOG_TAG(TAG, "adc128s102");
8
10
11void ADC128S102::setup() { this->spi_setup(); }
12
14 ESP_LOGCONFIG(TAG, "ADC128S102:");
15 LOG_PIN(" CS Pin:", this->cs_);
16}
17
18uint16_t ADC128S102::read_data(uint8_t channel) {
19 uint8_t control = channel << 3;
20
21 this->enable();
22 uint8_t adc_primary_byte = this->transfer_byte(control);
23 uint8_t adc_secondary_byte = this->transfer_byte(0x00);
24 this->disable();
25
26 uint16_t digital_value = encode_uint16(adc_primary_byte, adc_secondary_byte);
27
28 return digital_value;
29}
30
31} // namespace esphome::adc128s102
float get_setup_priority() const override
Definition adc128s102.cpp:9
uint16_t read_data(uint8_t channel)
ESPHOME_LOG_TAG(TAG, "adc128s102")
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.h:43
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
Definition helpers.h:1043