예제 #1
0
void ButtonIO::update() {
    int value = digitalRead(_pin);
    int i = 0;
    for (; i < 3; i++) {
        Action &action = _actions[i];

        // Is set
        if (action.pin > -1) {
            
            switch(action.type) {
                case TypePressed:
                    handle_pressed(action, value);
                    break;
                case TypeHold:
                    handle_hold(action, value);
                    break;
                case TypeBetween:
                    handle_between(action, value);
                    break;
            }
            
            action.lastState = value;
        }
    }
}
void
MppButtonMap :: setSelection(int id)
{
	if (id == currSelection)
		return;

	handle_pressed(id);
	handle_released(id);
}