You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Kaleidoscope/matrix_state.cpp

37 lines
733 B

#include "matrix_state.h"
// switch debouncing and status
boolean key_was_pressed (byte keyState) {
if ( keyState & B00001000 || keyState & B00000100) {
return true;
} else {
return false;
}
}
boolean key_is_pressed (byte keyState) {
if ( keyState & B00000001 && keyState & B00000010 ) {
return true;
} else {
return false;
}
}
boolean key_toggled_on(byte keyState) {
if (key_is_pressed(keyState) && ! key_was_pressed(keyState)) {
return true;
} else {
return false;
}
}
boolean key_toggled_off(byte keyState) {
if (key_was_pressed(keyState) && ! key_is_pressed(keyState)) {
return true;
} else {
return false;
}
}