static void panel_process_inputs()

in panel.c [1296:1340]


static void panel_process_inputs(void)
{
	struct logical_input *input;

	keypressed = 0;
	inputs_stable = 1;
	list_for_each_entry(input, &logical_inputs, list) {
		switch (input->state) {
		case INPUT_ST_LOW:
			if ((phys_curr & input->mask) != input->value)
				break;
			/* if all needed ones were already set previously,
			 * this means that this logical signal has been
			 * activated by the releasing of another combined
			 * signal, so we don't want to match.
			 * eg: AB -(release B)-> A -(release A)-> 0 :
			 *     don't match A.
			 */
			if ((phys_prev & input->mask) == input->value)
				break;
			input->rise_timer = 0;
			input->state = INPUT_ST_RISING;
			fallthrough;
		case INPUT_ST_RISING:
			if ((phys_curr & input->mask) != input->value) {
				input->state = INPUT_ST_LOW;
				break;
			}
			if (input->rise_timer < input->rise_time) {
				inputs_stable = 0;
				input->rise_timer++;
				break;
			}
			input->high_timer = 0;
			input->state = INPUT_ST_HIGH;
			fallthrough;
		case INPUT_ST_HIGH:
			if (input_state_high(input))
				break;
			fallthrough;
		case INPUT_ST_FALLING:
			input_state_falling(input);
		}
	}
}