diff --git a/blk_box.cpp b/blk_box.cpp index bc7de64..c681332 100644 --- a/blk_box.cpp +++ b/blk_box.cpp @@ -1,7 +1,7 @@ #include "blk_box.h" #include "blk_box_drivers/i2c.h" -#include "blk_box_drivers/expander.hpp" +#include "blk_box_drivers/inputs.hpp" void init_blk_box(BlkBoxInitConfig cfg) { init_main_i2c(); diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index 0fca01c..955d6b7 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -1,5 +1,5 @@ set(SOURCES - "expander.cpp" + "inputs.cpp" "i2c.cpp" ) diff --git a/drivers/expander.cpp b/drivers/inputs.cpp similarity index 98% rename from drivers/expander.cpp rename to drivers/inputs.cpp index 67646db..0af9550 100644 --- a/drivers/expander.cpp +++ b/drivers/inputs.cpp @@ -1,4 +1,4 @@ -#include "blk_box_drivers/expander.hpp" +#include "blk_box_drivers/inputs.hpp" #include "pins.h" #include "blk_box_drivers/i2c.h" @@ -9,7 +9,7 @@ #include "esp_log.h" #include "esp_err.h" -static const char *TAG = "EXPANDER"; +static const char *TAG = "INPUTS"; static TaskHandle_t expander_task_handle = NULL; @@ -37,7 +37,7 @@ class ExpanderPeripheral { // or even make this class hidden public: SemaphoreHandle_t state_mutex; - ExpanderState state; + InputsState state; // channels QueueHandle_t button_press_events; @@ -323,9 +323,9 @@ void InputsController::clear_all_events() { xQueueReset(expander_peripheral_singleton.keypad_release_events); } -ExpanderState InputsController::get_input_state() { +InputsState InputsController::get_input_state() { xSemaphoreTake(expander_peripheral_singleton.state_mutex, portMAX_DELAY); - ExpanderState state_copy = expander_peripheral_singleton.state; + InputsState state_copy = expander_peripheral_singleton.state; xSemaphoreGive(expander_peripheral_singleton.state_mutex); return state_copy; } diff --git a/idf_component.yml b/idf_component.yml index 652bff0..2c6790e 100644 --- a/idf_component.yml +++ b/idf_component.yml @@ -14,3 +14,5 @@ dependencies: # # `public` flag doesn't have an effect dependencies of the `main` component. # # All dependencies of `main` are public by default. # public: true + espressif/led_strip: ^3.0.3 + \ No newline at end of file diff --git a/include/blk_box_drivers/expander.hpp b/include/blk_box_drivers/inputs.hpp similarity index 96% rename from include/blk_box_drivers/expander.hpp rename to include/blk_box_drivers/inputs.hpp index b76aaad..bbb760e 100644 --- a/include/blk_box_drivers/expander.hpp +++ b/include/blk_box_drivers/inputs.hpp @@ -1,5 +1,5 @@ -#ifndef EXPANDER_H -#define EXPANDER_H +#ifndef INPUTS_H +#define INPUTS_H #include "blk_box_drivers/i2c.h" #include @@ -207,7 +207,7 @@ static_assert(sizeof(ButtonOrSwitch) == 1); /// @brief The state of the bottom half of the box. -struct ExpanderState { +struct InputsState { /// The touch state of the switches in the lower 4 bits. /// The touch pad state in bit 4. uint8_t touch_state; @@ -233,14 +233,14 @@ struct ExpanderState { /// The RFID card that was presented last. uint32_t rfid_state; - ExpanderState() : touch_state(0), button_state(0), switch_state(0), keypad_state(0), hal_sense(0), close_hal_sense(0), hal(0), close_hal(0), rfid_state(0) {} + InputsState() : touch_state(0), button_state(0), switch_state(0), keypad_state(0), hal_sense(0), close_hal_sense(0), hal(0), close_hal(0), rfid_state(0) {} }; class InputsController { public: static void clear_all_events(); - static ExpanderState get_input_state(); + static InputsState get_input_state(); static bool has_button_press(); static std::optional