Universal_Button
Generic multi-button handler with debounce, short/long/double events, optional latching, exact press duration, non-consuming event peek, pluggable readers, enum-friendly API, helpers, and custom time-source injection.
Установка
Последняя опубликованная версия- Скачайте архив — реестр отдает его уже проверенным.
- В Arduino IDE выберите «Скетч → Подключить библиотеку → Добавить .ZIP библиотеку».
- Укажите скачанный файл — библиотека появится в списке доступных.
SHA-256:b185a65915be29acf808623529f53f05cd7565c80ebe3b0894c99a16f6460555Universal_Button-1.7.0-b185a659.zipОписание
Header-only Arduino library for handling multiple buttons with robust debounce; short/long/double classification; optional latching (toggle/set/reset driven by Short/Long/Double events); exact getLastPressDuration(); non-consuming peekPressType(); per-button overrides (timing—including double_click_ms—polarity, enable, latch config); reader callbacks for GPIO and expanders (e.g., MCP23017); and helpers (pressedMask/snapshot/forEach/sizeStatic, plus indexFromKey/indexFromKeyIn utilities). Runtime setters include setReadFn/setReadPinFn, setGlobalTiming (alias setTiming), setPerConfig, enable, setActiveLow, and setTimeFn for custom timing sources (for example FreeRTOS tick-derived milliseconds). Includes latch control APIs (setLatched/clearAllLatched/clearLatchedMask), optional strict mapping via UB_REQUIRE_BUTTON_LIST, and examples covering GPIO, local enum mapping, port-expander readers, cached reads, and latching.