Kaleidoscope
Macros
keyswitch_state.h File Reference
#include <Arduino.h>
Include dependency graph for keyswitch_state.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define INJECTED   B10000000
 
#define IS_PRESSED   B00000010
 
#define WAS_PRESSED   B00000001
 
#define keyWasPressed(keyState)   ((keyState) & WAS_PRESSED)
 
#define keyIsPressed(keyState)   ((keyState) & IS_PRESSED)
 
#define keyToggledOn(keyState)   (keyIsPressed(keyState) && ! keyWasPressed(keyState))
 
#define keyToggledOff(keyState)   (keyWasPressed(keyState) && ! keyIsPressed(keyState))
 
#define key_was_pressed(keyState)   ((keyState) & WAS_PRESSED)
 
#define key_is_pressed(keyState)   ((keyState) & IS_PRESSED)
 
#define key_toggled_on(keyState)   (key_is_pressed(keyState) && ! key_was_pressed(keyState))
 
#define key_toggled_off(keyState)   (key_was_pressed(keyState) && ! key_is_pressed(keyState))
 

Macro Definition Documentation

◆ INJECTED

#define INJECTED   B10000000

◆ IS_PRESSED

#define IS_PRESSED   B00000010

◆ key_is_pressed

#define key_is_pressed (   keyState)    ((keyState) & IS_PRESSED)

◆ key_toggled_off

#define key_toggled_off (   keyState)    (key_was_pressed(keyState) && ! key_is_pressed(keyState))

◆ key_toggled_on

#define key_toggled_on (   keyState)    (key_is_pressed(keyState) && ! key_was_pressed(keyState))

◆ key_was_pressed

#define key_was_pressed (   keyState)    ((keyState) & WAS_PRESSED)

◆ keyIsPressed

#define keyIsPressed (   keyState)    ((keyState) & IS_PRESSED)

◆ keyToggledOff

#define keyToggledOff (   keyState)    (keyWasPressed(keyState) && ! keyIsPressed(keyState))

◆ keyToggledOn

#define keyToggledOn (   keyState)    (keyIsPressed(keyState) && ! keyWasPressed(keyState))

◆ keyWasPressed

#define keyWasPressed (   keyState)    ((keyState) & WAS_PRESSED)

◆ WAS_PRESSED

#define WAS_PRESSED   B00000001