Sygaldry
Loading...
Searching...
No Matches
sygsp-button.hpp
1#pragma once
2/*
3Copyright 2023 Travis J. West, https://traviswest.ca, Input Devices and Music
4Interaction Laboratory (IDMIL), Centre for Interdisciplinary Research in Music
5Media and Technology (CIRMMT), McGill University, Montréal, Canada, and Univ.
6Lille, Inria, CNRS, Centrale Lille, UMR 9189 CRIStAL, F-59000 Lille, France
7
8SPDX-License-Identifier: MIT
9*/
10
11#include "sygah-consteval.hpp"
12#include "sygah-endpoints.hpp"
13
14namespace sygaldry { namespace sygsp {
19
21
35enum class ButtonActive : char {Low = 0, High = 1};
36
37
40{
41 struct inputs_t {
42 toggle<"button state", "1 indicates button active, 0 inactive"> button_state;
43 } inputs;
44
45 struct outputs_t {
46 // we assume this is persistent across ticks
47 toggle<"debounced state", "updates only when the button state has changed since the last tick"> debounced_state;
48
49 bng<"any edge", "bangs on any change to debounced state"> any_edge;
50 bng<"rising edge", "bangs when the button is activated"> rising_edge;
51 bng<"falling edge", "bangs when the button is deactivated"> falling_edge;
52 } outputs;
53
54 void operator()();
55};
56
59} }
ButtonActive
Enumeration for button activity to button logical state mapping.
Definition sygsp-button.hpp:35
A semantically value-less endpoint that signals an event.
Definition sygah-endpoints.hpp:481
Definition sygsp-button.hpp:41
Component modelling gestures performed with a single bi-state push button.
Definition sygsp-button.hpp:40
A two-state integer endpoint with persistent value semantics.
Definition sygah-endpoints.hpp:289