ESPHome 2026.5.0b1
Loading...
Searching...
No Matches
adc128s102.cpp
Go to the documentation of this file.
1#include "adc128s102.h"
2#include "esphome/core/log.h"
3
5
6static const char *const TAG = "adc128s102";
7
9
10void ADC128S102::setup() { this->spi_setup(); }
11
13 ESP_LOGCONFIG(TAG, "ADC128S102:");
14 LOG_PIN(" CS Pin:", this->cs_);
15}
16
17uint16_t ADC128S102::read_data(uint8_t channel) {
18 uint8_t control = channel << 3;
19
20 this->enable();
21 uint8_t adc_primary_byte = this->transfer_byte(control);
22 uint8_t adc_secondary_byte = this->transfer_byte(0x00);
23 this->disable();
24
25 uint16_t digital_value = adc_primary_byte << 8 | adc_secondary_byte;
26
27 return digital_value;
28}
29
30} // namespace esphome::adc128s102
float get_setup_priority() const override
Definition adc128s102.cpp:8
uint16_t read_data(uint8_t channel)
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.h:41