private void onInput() {
		int prevmode = clockmode;

		// Read push button states
		if (b1 != b1p || b2 != b2p) {
			if (b1 && b2) {
				clkinput.alarmOn = !clkinput.alarmOn;
				chb_alarmon.setState(clkinput.alarmOn);
				chb_tshow.setState(true);
				clockmode = MODE_ATOGGLE;
			} else if (b1) {
				clkinput.choice = ClockInput.SET_TIME;
				chb_tset.setState(true);
				clockmode = MODE_TSET;
			} else if (b2) {
				clkinput.choice = ClockInput.SET_ALARM;
				chb_aset.setState(true);
				clockmode = MODE_ASET;
			} else {
				clkinput.choice = ClockInput.SHOW_TIME;
				chb_tshow.setState(true);
				clockmode = MODE_TSHOW;
			}
		}
		b1p = b1;
		b2p = b2;

		// Any button changed?
		if (clockmode == MODE_TSET) {
			TimeSet(prevmode);
		} else if (clockmode == MODE_ASET) {
			AlarmSet(prevmode);
		} else {
			cursor = 0;
		}

		clkcanvas.repaint();

		// Signal ClockInput
		clkinput.lastValueSet = inputval;
		clkinput.getSemaphoreInstance().give();
	}