mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
pulse_counter_ulp: Fix enum case
This commit is contained in:
parent
ad3b75601e
commit
1feb0bf8cb
3 changed files with 7 additions and 7 deletions
|
@ -14,11 +14,11 @@ static const char *const TAG = "pulse_counter_ulp";
|
||||||
namespace {
|
namespace {
|
||||||
const char *to_string(CountMode count_mode) {
|
const char *to_string(CountMode count_mode) {
|
||||||
switch (count_mode) {
|
switch (count_mode) {
|
||||||
case CountMode::disable:
|
case CountMode::DISABLE:
|
||||||
return "disable";
|
return "disable";
|
||||||
case CountMode::increment:
|
case CountMode::INCREMENT:
|
||||||
return "increment";
|
return "increment";
|
||||||
case CountMode::decrement:
|
case CountMode::DECREMENT:
|
||||||
return "decrement";
|
return "decrement";
|
||||||
}
|
}
|
||||||
return "UNKNOWN MODE";
|
return "UNKNOWN MODE";
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace pulse_counter_ulp {
|
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 clock = std::chrono::steady_clock;
|
||||||
using microseconds = std::chrono::duration<uint32_t, std::micro>;
|
using microseconds = std::chrono::duration<uint32_t, std::micro>;
|
||||||
|
|
|
@ -19,9 +19,9 @@ from esphome.const import (
|
||||||
pulse_counter_ulp_ns = cg.esphome_ns.namespace("pulse_counter_ulp")
|
pulse_counter_ulp_ns = cg.esphome_ns.namespace("pulse_counter_ulp")
|
||||||
CountMode = pulse_counter_ulp_ns.enum("CountMode", is_class=True)
|
CountMode = pulse_counter_ulp_ns.enum("CountMode", is_class=True)
|
||||||
COUNT_MODES = {
|
COUNT_MODES = {
|
||||||
"DISABLE": CountMode.disable,
|
"DISABLE": CountMode.DISABLE,
|
||||||
"INCREMENT": CountMode.increment,
|
"INCREMENT": CountMode.INCREMENT,
|
||||||
"DECREMENT": CountMode.decrement,
|
"DECREMENT": CountMode.DECREMENT,
|
||||||
}
|
}
|
||||||
|
|
||||||
COUNT_MODE_SCHEMA = cv.enum(COUNT_MODES, upper=True)
|
COUNT_MODE_SCHEMA = cv.enum(COUNT_MODES, upper=True)
|
||||||
|
|
Loading…
Reference in a new issue