8 #include <esp32-hal-dac.h> 14 #ifdef USE_ESP32_VARIANT_ESP32S2 15 static constexpr uint8_t DAC0_PIN = 17;
17 static constexpr uint8_t DAC0_PIN = 25;
20 static const char *
const TAG =
"esp32_dac";
23 ESP_LOGCONFIG(TAG,
"Setting up ESP32 DAC Output...");
28 const dac_channel_t channel = this->
pin_->
get_pin() == DAC0_PIN ? DAC_CHAN_0 : DAC_CHAN_1;
29 const dac_oneshot_config_t oneshot_cfg{channel};
30 dac_oneshot_new_channel(&oneshot_cfg, &this->
dac_handle_);
41 ESP_LOGCONFIG(TAG,
"ESP32 DAC:");
42 LOG_PIN(
" Pin: ", this->
pin_);
43 LOG_FLOAT_OUTPUT(
this);
53 dac_oneshot_output_voltage(this->
dac_handle_, state);
void setup() override
Initialize pin.
virtual void turn_off()
Disable this binary output.
virtual uint8_t get_pin() const =0
void on_safe_shutdown() override
dac_oneshot_handle_t dac_handle_
Implementation of SPI Controller mode.
void write_state(float state) override
void dump_config() override
virtual bool is_inverted() const =0