ESPHome  2024.11.1
uln2003.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/hal.h"
6 
7 namespace esphome {
8 namespace uln2003 {
9 
14 };
15 
16 class ULN2003 : public stepper::Stepper, public Component {
17  public:
18  void set_pin_a(GPIOPin *pin_a) { pin_a_ = pin_a; }
19  void set_pin_b(GPIOPin *pin_b) { pin_b_ = pin_b; }
20  void set_pin_c(GPIOPin *pin_c) { pin_c_ = pin_c; }
21  void set_pin_d(GPIOPin *pin_d) { pin_d_ = pin_d; }
22 
23  void setup() override;
24  void loop() override;
25  void dump_config() override;
26  float get_setup_priority() const override { return setup_priority::HARDWARE; }
27  void set_sleep_when_done(bool sleep_when_done) { this->sleep_when_done_ = sleep_when_done; }
28  void set_step_mode(ULN2003StepMode step_mode) { this->step_mode_ = step_mode; }
29 
30  protected:
31  void write_step_(int32_t step);
32 
33  bool sleep_when_done_{false};
40  int32_t current_uln_pos_{0};
41 };
42 
43 } // namespace uln2003
44 } // namespace esphome
void set_sleep_when_done(bool sleep_when_done)
Definition: uln2003.h:27
Helper class to request loop() to be called as fast as possible.
Definition: helpers.h:613
void loop() override
Definition: uln2003.cpp:16
ULN2003StepMode step_mode_
Definition: uln2003.h:38
void set_pin_c(GPIOPin *pin_c)
Definition: uln2003.h:20
void set_pin_d(GPIOPin *pin_d)
Definition: uln2003.h:21
void dump_config() override
Definition: uln2003.cpp:36
void write_step_(int32_t step)
Definition: uln2003.cpp:57
float get_setup_priority() const override
Definition: uln2003.h:26
void setup() override
Definition: uln2003.cpp:9
void set_pin_b(GPIOPin *pin_b)
Definition: uln2003.h:19
void set_pin_a(GPIOPin *pin_a)
Definition: uln2003.h:18
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition: component.cpp:18
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_step_mode(ULN2003StepMode step_mode)
Definition: uln2003.h:28
HighFrequencyLoopRequester high_freq_
Definition: uln2003.h:39