ESPHome  2024.10.2
a4988.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/hal.h"
6 
7 namespace esphome {
8 namespace a4988 {
9 
10 class A4988 : public stepper::Stepper, public Component {
11  public:
12  void set_step_pin(GPIOPin *step_pin) { step_pin_ = step_pin; }
13  void set_dir_pin(GPIOPin *dir_pin) { dir_pin_ = dir_pin; }
14  void set_sleep_pin(GPIOPin *sleep_pin) { this->sleep_pin_ = sleep_pin; }
15  void setup() override;
16  void dump_config() override;
17  void loop() override;
18  float get_setup_priority() const override { return setup_priority::HARDWARE; }
19 
20  protected:
23  GPIOPin *sleep_pin_{nullptr};
26 };
27 
28 } // namespace a4988
29 } // namespace esphome
GPIOPin * step_pin_
Definition: a4988.h:21
GPIOPin * sleep_pin_
Definition: a4988.h:23
void set_dir_pin(GPIOPin *dir_pin)
Definition: a4988.h:13
float get_setup_priority() const override
Definition: a4988.h:18
Helper class to request loop() to be called as fast as possible.
Definition: helpers.h:609
void setup() override
Definition: a4988.cpp:9
GPIOPin * dir_pin_
Definition: a4988.h:22
void set_sleep_pin(GPIOPin *sleep_pin)
Definition: a4988.h:14
HighFrequencyLoopRequester high_freq_
Definition: a4988.h:25
void loop() override
Definition: a4988.cpp:28
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition: component.cpp:18
void dump_config() override
Definition: a4988.cpp:21
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool sleep_pin_state_
Definition: a4988.h:24
void set_step_pin(GPIOPin *step_pin)
Definition: a4988.h:12