static void kick_measure(bool pull_x, bool pull_y, bool detect, int lradc_phys) { /* setup measurement: x- pull down and x+ pull up */ imx233_lradc_setup_touch(pull_x, pull_y, pull_x, pull_y, detect); imx233_lradc_enable_touch_detect_irq(false); imx233_lradc_enable_channel_irq(touch_chan, true); /* measure channel, no accumulation */ imx233_lradc_setup_channel(touch_chan, false, false, 0, lradc_phys); /* use a delay */ imx233_lradc_setup_delay(touch_delay, 1 << touch_chan, 0, 0, 8); imx233_lradc_kick_delay(touch_delay); }
void lradc_setup_channels_for_polling() { unsigned char i; int trigger_bitmap = 0; imx233_lradc_init(); for (i=0; i<MAX_USER_LRADC; i++) { imx233_lradc_setup_channel(i, 1, 0, 0, i); imx233_lradc_enable_channel_irq(i, false); imx233_lradc_clear_channel_irq(i); trigger_bitmap |= 1<<i; } imx233_lradc_setup_delay(LRADC_DELAY_INDEX, trigger_bitmap, 1<<LRADC_DELAY_INDEX, 0, 100); imx233_lradc_kick_delay(LRADC_DELAY_INDEX); }
static void enter_state(enum touch_state_t state) { touch_state = state; switch(state) { case TOUCH_STATE_WAIT: imx233_lradc_setup_touch(false, false, false, false, true); imx233_lradc_enable_channel_irq(touch_chan, false); imx233_lradc_enable_touch_detect_irq(true); break; case TOUCH_STATE_MEASURE_X: kick_measure(true, false, false, HW_LRADC_CHANNEL_YPLUS); break; case TOUCH_STATE_MEASURE_Y: kick_measure(false, true, false, HW_LRADC_CHANNEL_XPLUS); break; case TOUCH_STATE_VERIFY: kick_measure(false, false, true, HW_LRADC_CHANNEL_YPLUS); break; } }