Touch pad interrupts

tomkcook
Posts: 5
Joined: Sun Jun 11, 2017 12:25 pm

Touch pad interrupts

Postby tomkcook » Mon Jun 12, 2017 8:36 am

I'm using the touch pad peripheral and successfully setting up interrupts with a threshold value determined by reading the touch counter at startup. I'm initialising the peripheral with the following code:

Code: Select all

void touch_handler(void*);
...
touch_pad_init();
uint16_t val, average = 0;
const uint16_t samples = 5;
for(int ii = 0; ii < samples; ++ii) {
  touch_pad_read(TOUCH_PAD_NUM7, &val);
  average += val;
}
average /= samples;
touch_pad_config(TOUCH_PAD_NUM7, average * 2 / 3);
touch_pad_isr_handler_register(touch_handler, NULL, 0, NULL);
Set up like this, I get repeated interrupts about every 15ms when the pad is touched. Is it possible to get an interrupt when the pad becomes untouched? And how would you distinguish between them?

Who is online

Users browsing this forum: Google [Bot] and 161 guests