11.07.2015 Views

Atmel QTouch Library User Guide

Atmel QTouch Library User Guide

Atmel QTouch Library User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

channel 0channel 1channel 2channel 3channel 4channel 5channel 6channel 7<strong>QTouch</strong>/QMatrix Channel Acquisition Methodchannel_signals[]optional qt_filter_callback() functionpost-processingmodified channel_signals[]modified channel_signals[]qt_touch_status.sensor_states[]qt_touch_status_rotor_slider_values[]Figure 5-10 : Block diagram to represent usage of filter callback functionExample: Averaging the Last Four Signal Values1. Add a static variable in the main module:/* filter for channel signals */static uint16_t filter[QT_NUM_CHANNELS][4];2. Add a filter function prototype to the main module:/* example signal filtering function */static void filter_data_mean_4( void );3. When configuring the ATMEL <strong>QTouch</strong> library, set the callback function pointer:/* set callback function */qt_filter_callback = filter_data_mean_4;4. Add the filter function:void filter_data_mean_4( void ){uint8_t i;/** Shift previously stored channel signal data.* Store new channel signal data.* Set library channel signal data = mean of last 4 values.*/for( i = 0u; i < QT_NUM_CHANNELS; i++ ){filter[i][0] = filter[i][1];448207K-AT42-09/11

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!