mirror of
https://github.com/esphome/esphome.git
synced 2026-01-26 06:22:08 -07:00
Compare commits
2 Commits
libretiny_
...
uln2003_lo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d06d1229e4 | ||
|
|
97babdcc94 |
@@ -1 +1 @@
|
||||
d565b0589e35e692b5f2fc0c14723a99595b4828a3a3ef96c442e86a23176c00
|
||||
15dc295268b2dcf75942f42759b3ddec64eba89f75525698eb39c95a7f4b14ce
|
||||
|
||||
@@ -191,17 +191,10 @@ def _notify_old_style(config):
|
||||
|
||||
|
||||
# The dev and latest branches will be at *least* this version, which is what matters.
|
||||
# Use GitHub releases directly to avoid PlatformIO moderation delays.
|
||||
ARDUINO_VERSIONS = {
|
||||
"dev": (cv.Version(1, 11, 0), "https://github.com/libretiny-eu/libretiny.git"),
|
||||
"latest": (
|
||||
cv.Version(1, 11, 0),
|
||||
"https://github.com/libretiny-eu/libretiny.git#v1.11.0",
|
||||
),
|
||||
"recommended": (
|
||||
cv.Version(1, 11, 0),
|
||||
"https://github.com/libretiny-eu/libretiny.git#v1.11.0",
|
||||
),
|
||||
"dev": (cv.Version(1, 9, 2), "https://github.com/libretiny-eu/libretiny.git"),
|
||||
"latest": (cv.Version(1, 9, 2), "libretiny"),
|
||||
"recommended": (cv.Version(1, 9, 2), None),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
#include "uln2003.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace uln2003 {
|
||||
namespace esphome::uln2003 {
|
||||
|
||||
static const char *const TAG = "uln2003.stepper";
|
||||
|
||||
static const LogString *step_mode_to_log_string(ULN2003StepMode mode) {
|
||||
switch (mode) {
|
||||
case ULN2003_STEP_MODE_FULL_STEP:
|
||||
return LOG_STR("FULL STEP");
|
||||
case ULN2003_STEP_MODE_HALF_STEP:
|
||||
return LOG_STR("HALF STEP");
|
||||
case ULN2003_STEP_MODE_WAVE_DRIVE:
|
||||
return LOG_STR("WAVE DRIVE");
|
||||
default:
|
||||
return LOG_STR("UNKNOWN");
|
||||
}
|
||||
}
|
||||
|
||||
void ULN2003::setup() {
|
||||
this->pin_a_->setup();
|
||||
this->pin_b_->setup();
|
||||
@@ -42,22 +54,7 @@ void ULN2003::dump_config() {
|
||||
LOG_PIN(" Pin B: ", this->pin_b_);
|
||||
LOG_PIN(" Pin C: ", this->pin_c_);
|
||||
LOG_PIN(" Pin D: ", this->pin_d_);
|
||||
const char *step_mode_s;
|
||||
switch (this->step_mode_) {
|
||||
case ULN2003_STEP_MODE_FULL_STEP:
|
||||
step_mode_s = "FULL STEP";
|
||||
break;
|
||||
case ULN2003_STEP_MODE_HALF_STEP:
|
||||
step_mode_s = "HALF STEP";
|
||||
break;
|
||||
case ULN2003_STEP_MODE_WAVE_DRIVE:
|
||||
step_mode_s = "WAVE DRIVE";
|
||||
break;
|
||||
default:
|
||||
step_mode_s = "UNKNOWN";
|
||||
break;
|
||||
}
|
||||
ESP_LOGCONFIG(TAG, " Step Mode: %s", step_mode_s);
|
||||
ESP_LOGCONFIG(TAG, " Step Mode: %s", LOG_STR_ARG(step_mode_to_log_string(this->step_mode_)));
|
||||
}
|
||||
void ULN2003::write_step_(int32_t step) {
|
||||
int32_t n = this->step_mode_ == ULN2003_STEP_MODE_HALF_STEP ? 8 : 4;
|
||||
@@ -90,5 +87,4 @@ void ULN2003::write_step_(int32_t step) {
|
||||
this->pin_d_->digital_write((res >> 3) & 1);
|
||||
}
|
||||
|
||||
} // namespace uln2003
|
||||
} // namespace esphome
|
||||
} // namespace esphome::uln2003
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
#include "esphome/core/hal.h"
|
||||
#include "esphome/components/stepper/stepper.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace uln2003 {
|
||||
namespace esphome::uln2003 {
|
||||
|
||||
enum ULN2003StepMode {
|
||||
ULN2003_STEP_MODE_FULL_STEP,
|
||||
@@ -40,5 +39,4 @@ class ULN2003 : public stepper::Stepper, public Component {
|
||||
int32_t current_uln_pos_{0};
|
||||
};
|
||||
|
||||
} // namespace uln2003
|
||||
} // namespace esphome
|
||||
} // namespace esphome::uln2003
|
||||
|
||||
@@ -212,7 +212,7 @@ build_unflags =
|
||||
; This are common settings for the LibreTiny (all variants) using Arduino.
|
||||
[common:libretiny-arduino]
|
||||
extends = common:arduino
|
||||
platform = https://github.com/libretiny-eu/libretiny.git#v1.11.0
|
||||
platform = libretiny@1.9.2
|
||||
framework = arduino
|
||||
lib_compat_mode = soft
|
||||
lib_deps =
|
||||
|
||||
Reference in New Issue
Block a user