|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include "cdc_hal/IKeypad.h"#include "cdc_hal/II2cBus.h"#include "cdc_hal/hw_config.h"#include "cdc_core/SystemLock.h"#include "cdc_log.h"#include "esp_attr.h"#include "esp_heap_caps.h"#include "driver/gpio.h"#include "freertos/FreeRTOS.h"#include "freertos/idf_additions.h"#include "freertos/task.h"#include "freertos/semphr.h"Go to the source code of this file.
Classes | |
| class | cdc::hal::TCA9535Keypad |
Namespaces | |
| namespace | cdc |
| namespace | cdc::hal |
Functions | |
| static constexpr uint16_t | cdc::hal::maskForBit (uint8_t bit) |
| Builds the active-low raw state for a single pressed key. | |
| static Key | cdc::hal::rawToKey (uint16_t raw) |
| Converts raw 16-bit keypad state to a Key enum value. | |
| static uint16_t | cdc::hal::keyToMask (Key key) |
| Converts a Key enum value to its expected raw 12-bit mask. | |
| IKeypad * | cdc::hal::getKeypadInstance () |
| Returns the singleton keypad service instance. | |
Variables | |
| static const char * | TAG = "Keypad" |
| static constexpr uint8_t | cdc::hal::REG_INPUT_0 = 0x00 |
| TCA9535 register-address constants. | |
| static constexpr uint8_t | cdc::hal::REG_INPUT_1 = 0x01 |
| static constexpr uint8_t | cdc::hal::REG_OUTPUT_0 = 0x02 |
| static constexpr uint8_t | cdc::hal::REG_OUTPUT_1 = 0x03 |
| static constexpr uint8_t | cdc::hal::REG_POLARITY_0 = 0x04 |
| static constexpr uint8_t | cdc::hal::REG_POLARITY_1 = 0x05 |
| static constexpr uint8_t | cdc::hal::REG_CONFIG_0 = 0x06 |
| static constexpr uint8_t | cdc::hal::REG_CONFIG_1 = 0x07 |
| static constexpr uint32_t | cdc::hal::TASK_STACK_SIZE = 6144 |
| Keypad task scheduling configuration. | |
| static constexpr UBaseType_t | cdc::hal::TASK_PRIORITY = 5 |
| static constexpr uint32_t | cdc::hal::POLL_TIMEOUT_MS = 50 |
| static constexpr uint32_t | cdc::hal::DEBOUNCE_MS = 10 |
| static constexpr uint32_t | cdc::hal::LONG_PRESS_THRESHOLD_MS = 800 |
| Default long-press detection threshold in milliseconds. Long enough to avoid accidental triggers, short enough to feel responsive. | |
| static constexpr size_t | cdc::hal::KEY_BUFFER_SIZE = 16 |
| Ring-buffer configuration for queued key events. | |
| static constexpr uint8_t | cdc::hal::KEY_BIT_0 = 0 |
| Bit positions of each physical key on the TCA9535 P0/P1 ports. Active-low: a pressed key drives its corresponding bit to 0. | |
| static constexpr uint8_t | cdc::hal::KEY_BIT_1 = 1 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_2 = 2 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_3 = 3 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_4 = 4 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_5 = 5 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_6 = 6 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_7 = 7 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_8 = 8 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_9 = 9 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_NO = 11 |
| static constexpr uint8_t | cdc::hal::KEY_BIT_YES = 10 |
| static constexpr uint16_t | cdc::hal::KEY_MASK_ALL = 0x0FFF |
| Mask of all 12 keypad bits (P0.0..P1.3). | |
| static constexpr uint16_t | cdc::hal::KEY_STATE_IDLE = KEY_MASK_ALL |
| Idle state: every key released, all 12 bits high. | |
| static constexpr uint16_t | cdc::hal::KEY_STATE_INVALID = 0xFFFF |
| Sentinel value returned when an I2C read fails or no key is mapped. | |
| static constexpr uint16_t | cdc::hal::PANIC_CHORD_BITS = (1u << KEY_BIT_NO) | (1u << KEY_BIT_YES) |
| Reserved rescue chord: N and Y held together (anti-block instant lock). | |
| static TCA9535Keypad | cdc::hal::g_keypad |
| Singleton keypad instance. | |
|
static |
TCA9535 I/O Expander - 12-Key Keypad HAL Implementation Interrupt-driven with FreeRTOS task and circular buffer
Definition at line 19 of file TCA9535Keypad.cpp.