mTouch Library Configuration

mTouch

mTouch Cap Library Help
mTouch Library Configuration

 

The following mTouch Library settings should be defined in mTouchConfig.h file:

MTOUCH_USE_10_BITS_ADC,
MTOUCH_USE_12_BITS_ADC 

ADC type (see PIC Microcontroller datasheet). Select (uncomment) only one: 10bits or 12bits. 

MTOUCH_CTMU_HAS_CTMUCON2_REG,
MTOUCH_CTMU_HAS_NO_CTMUCON2_REG 

CTMU type (see PIC Microcontroller datasheet). Select (uncomment) only one: with CTMUCON2 register or without CTMUCON2 register. 

MTOUCH_USE_CTMU,
MTOUCH_USE_CVD 

Acquisition method. Select (uncomment) only one: CTMU or CVD. 

MTOUCH_DEBUG 

Debugging. Uncomment to enable debug functions. 

MTOUCH_SENSORS_NUMBER 

Number of sensors (analog inputs connected to sensors). The minimum number of sensors required for CVD acquisition method is 2. 

MTOUCH_BUTTONS_NUMBER 

Number of button controls. 

MTOUCH_MATRIXBUTTONS_NUMBER 

Number of matrix button controls. 

MTOUCH_2CHSLIDERS_NUMBER 

Number of 2 channels slider controls. 

MTOUCH_4CHSLIDERS_NUMBER 

Number of 4 channels slider controls. 

AVG_SLIDER_VALUE 

The slider value is filtered. When the slider value is updated, this factor determines what weight is given in the calculation. Can be set to 0(100% new value/no averaging), 1(50% of new value), 2(25% of new value), 3(12.5% of new value) and so on. 

MTOUCH_DEFAULT_CHARGE_DELAY 

Default CTMU charge delay settings. This value is used in MTouchSetSensor(...) when "chargeDelay" is set to -1. Use  MTouchDebugDelay(…) function to calculate CTMU charge delay value (to charge the sensor to about 75% of AVdd). If adjustment of this parameter gives a value less than 4 decrease CTMU current with MTOUCH_CTMU_CURRENT. 

MTOUCH_DEFAULT_THRESHOLD 

Default threshold for press event detection.  This value is used when "threshold" is set to -1 in MTouchSetSensor(...) call. The optimal threshold value is about 20% of sensor signal (delta) amplitude. The sensor signal amplitude can be determined using debug module. 

MTOUCH_DEFAULT_OVERSAMPLING 

Default number of acquisitions for one sample of the sensor. This value is used when "oversampling" is set to -1 in MTouchSetSensor(...) call. The oversampling factor should be selected to maximize the amplitude of the signal from sensor and to provide fast enough response time (see “Acquisition time for one sensor” chapter for the response time estimation). 

POWER_UP_SAMPLES 

 This is the number of total scans that should be taken for the sensor before it will be considered initialized. Allowable range is from 1 to 65535. 

DEBOUNCE_COUNT 

 Number of consecutive scans a sensor must be seen as pressed or released before an updated state is declared. Allowable range is from 1 to 255. 

MCONTROL_REPEAT_INITIAL_DELAY 

Initial delay for the control DECODE_PRESS_REPEAT decoding method. Defines how many times the control decoding must be done before the control starts repeating CONTROL_PRESS/CONTROL_RELEASE events.Allowable range is from 1 to 65535. 

MCONTROL_REPEAT_DELAY 

Delay between CONTROL_PRESS/CONTROL_RELEASE events for the control DECODE_PRESS_REPEAT decoding method.  Allowable range is from 1 to 65535. 

AVG_UPDATE 

When the average updates itself using a new sample, this value determines what weight is given to the new sample in the calculation of the new average. The new sample will have a weight of 1/AVG_UPDATE in the average calculation. Can be set to 2,4,8 or 16. 

AVG_RATE_RELEASED 

The update rate of the sensors' average values when sensor is released.  Allowable Range from 1 to 65535. 

AVG_RATE_PRESSED 

The update rate of the sensors' average values when sensor is pressed.  Allowable Range from 1 to 65535. 

MTOUCH_CTMU_CURRENT 

CTMU current settings. Bits 1-0 select the current source range (IRNG) and bits 7-2 select current trim value (ITRIM, signed).  The current must be selected such way to get CTMU charge delay more than 4 (see MTOUCH_DEFAULT_CHARGE_DELAY). 

 

 

Microchip mTouchCap Software Library 1.41 - [July 18, 2012]
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.