change name to inputs

This commit is contained in:
Mitchell Marino 2026-04-01 16:32:02 -05:00
parent c82c9adf32
commit 8bc5a982d1
5 changed files with 15 additions and 13 deletions

View File

@ -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();

View File

@ -1,5 +1,5 @@
set(SOURCES
"expander.cpp"
"inputs.cpp"
"i2c.cpp"
)

View File

@ -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;
}

View File

@ -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

View File

@ -1,5 +1,5 @@
#ifndef EXPANDER_H
#define EXPANDER_H
#ifndef INPUTS_H
#define INPUTS_H
#include "blk_box_drivers/i2c.h"
#include <freertos/FreeRTOS.h>
@ -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<Button> get_button_press();
@ -273,4 +273,4 @@ public:
// TODO: impl and add the hal and RFID stuff
};
#endif // EXPANDER_H
#endif // INPUTS_H