pulse_counter_ulp: Fix enum case

This commit is contained in:
brisk 2024-10-06 18:08:29 +10:30
parent ad3b75601e
commit 1feb0bf8cb
3 changed files with 7 additions and 7 deletions

View file

@ -14,11 +14,11 @@ static const char *const TAG = "pulse_counter_ulp";
namespace {
const char *to_string(CountMode count_mode) {
switch (count_mode) {
case CountMode::disable:
case CountMode::DISABLE:
return "disable";
case CountMode::increment:
case CountMode::INCREMENT:
return "increment";
case CountMode::decrement:
case CountMode::DECREMENT:
return "decrement";
}
return "UNKNOWN MODE";

View file

@ -11,7 +11,7 @@
namespace esphome {
namespace pulse_counter_ulp {
enum class CountMode { disable = 0, increment = 1, decrement = -1 };
enum class CountMode { DISABLE = 0, INCREMENT = 1, DECREMENT = -1 };
using clock = std::chrono::steady_clock;
using microseconds = std::chrono::duration<uint32_t, std::micro>;

View file

@ -19,9 +19,9 @@ from esphome.const import (
pulse_counter_ulp_ns = cg.esphome_ns.namespace("pulse_counter_ulp")
CountMode = pulse_counter_ulp_ns.enum("CountMode", is_class=True)
COUNT_MODES = {
"DISABLE": CountMode.disable,
"INCREMENT": CountMode.increment,
"DECREMENT": CountMode.decrement,
"DISABLE": CountMode.DISABLE,
"INCREMENT": CountMode.INCREMENT,
"DECREMENT": CountMode.DECREMENT,
}
COUNT_MODE_SCHEMA = cv.enum(COUNT_MODES, upper=True)