#ifndef INPUTS_H #define INPUTS_H #include "blk_box_drivers/i2c.h" #include #include #include #include #define EXPANDER_I2C_ADDR (0x7E) #define EXPANDER_I2C_SPEED (400000) // the actual transaction takes ~0.3ms, but for some reason a timout of ~10 or lower causes issues. #define EXPANDER_TIMEOUT_MS (100) #define EXPANDER_WHOAMI_VALUE (0x85) // queue sizes #define EXPANDER_EVENT_QUEUE_SIZE 4 #define EXPANDER_KEYPAD_QUEUE_SIZE 16 void init_expander(); /// The four buttons on the bottom half. enum class Button: uint8_t { B1 = 0, B2 = 1, B3 = 2, B4 = 3, GREEN = 0, RED = 1, YELLOW = 2, BLUE = 3, }; constexpr uint8_t raw_value(Button v) { return static_cast(v); } constexpr Button button_from_raw(uint8_t raw) { return static_cast