• Main Page
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

mTouch_config.h

Go to the documentation of this file.
00001 /*************************************************************************
00002  *  © 2012 Microchip Technology Inc.                                       
00003  *  
00004  *  Project Name:    mTouch Framework v2.1
00005  *  FileName:        mTouch_config.h
00006  *  Dependencies:    mTouch_optionsForConfig.h  
00007  *                              :: Defines labels for easier configuration
00008  *                   mTouch_config_slider.h     
00009  *                              :: Configuration for sliders
00010  *                   mTouch_config_modes.h
00011  *                              :: Configuration for scanning modes
00012  *                   mTouch_config_cvdAdvanced.h
00013  *                              :: Advanced CVD acquisition options
00014  *  Processor:       See documentation for supported PIC® microcontrollers 
00015  *  Compiler:        HI-TECH Ver. 9.81 or later
00016  *  IDE:             MPLAB® IDE v8.50 (or later) or MPLAB® X                        
00017  *  Hardware:         
00018  *  Company:         
00019  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00020  *  Description:     mTouch Framework Configuration File
00021  *                   - The values in this and the other mTouch_config_...
00022  *                     header files determine how the framework will
00023  *                     generate the application.
00024  *                   - See documentation for better explanations of all
00025  *                     configuration options.
00026  *************************************************************************/
00027 /***********************************************************************
00028  * MICROCHIP SOFTWARE NOTICE AND DISCLAIMER: You may use this software, and 
00029  * any derivatives created by any person or entity by or on your behalf, 
00030  * exclusively with Microchip's products in accordance with applicable
00031  * software license terms and conditions, a copy of which is provided for
00032  * your referencein accompanying documentation. Microchip and its licensors 
00033  * retain all ownership and intellectual property rights in the 
00034  * accompanying software and in all derivatives hereto. 
00035  * 
00036  * This software and any accompanying information is for suggestion only. 
00037  * It does not modify Microchip's standard warranty for its products. You 
00038  * agree that you are solely responsible for testing the software and 
00039  * determining its suitability. Microchip has no obligation to modify, 
00040  * test, certify, or support the software. 
00041  * 
00042  * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER 
00043  * EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED 
00044  * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A 
00045  * PARTICULAR PURPOSE APPLY TO THIS SOFTWARE, ITS INTERACTION WITH 
00046  * MICROCHIP'S PRODUCTS, COMBINATION WITH ANY OTHER PRODUCTS, OR USE IN ANY 
00047  * APPLICATION. 
00048  * 
00049  * IN NO EVENT, WILL MICROCHIP BE LIABLE, WHETHER IN CONTRACT, WARRANTY, 
00050  * TORT (INCLUDING NEGLIGENCE OR BREACH OF STATUTORY DUTY), STRICT 
00051  * LIABILITY, INDEMNITY, CONTRIBUTION, OR OTHERWISE, FOR ANY INDIRECT, 
00052  * SPECIAL, PUNITIVE, EXEMPLARY, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, 
00053  * FOR COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, 
00054  * HOWSOEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY 
00055  * OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWABLE BY LAW, 
00056  * MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS 
00057  * SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID 
00058  * DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. 
00059  * 
00060  * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF 
00061  * THESE TERMS. 
00062  *************************************************************************/
00067 #ifndef __MTOUCH_CONFIG_H
00068 #define __MTOUCH_CONFIG_H
00069 
00070 #include "mTouch_optionsForConfig.h"
00071 #include "mTouch_config_slider.h"
00072 #include "mTouch_config_modes.h"
00073 #include "mTouch_config_cvdAdvanced.h"
00074 
00075 //****************************************************************************************************
00076 //  ____            _                   ____       _               
00077 // / ___| _   _ ___| |_ ___ _ __ ___   / ___|  ___| |_ _   _ _ __  
00078 // \___ \| | | / __| __/ _ \ '_ ` _ \  \___ \ / _ \ __| | | | '_ \ 
00079 //  ___) | |_| \__ \ ||  __/ | | | | |  ___) |  __/ |_| |_| | |_) |
00080 // |____/ \__, |___/\__\___|_| |_| |_| |____/ \___|\__|\__,_| .__/ 
00081 //        |___/                                             |_|        
00082 //
00083 //****************************************************************************************************
00084     #define _XTAL_FREQ                      32000000 // <-- Oscillator frequency of your MCU in Hz   
00085 
00086     // Framework-Application Integration Type
00087     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00088     //  Option Label                    :: Option Behavior
00089     //.................................................................................................
00090     //  MTOUCH_CONTROLS_ISR             :: The framework defines and controls 100% of the ISR.
00091     //  MTOUCH_CALLED_FROM_ISR          :: The application's ISR function is responsible for calling mTouch_Scan().
00092     //  MTOUCH_CALLED_FROM_MAINLOOP     :: The mainloop mTouch API will automatically call the scan function.    
00093     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00094     
00095     #define MTOUCH_INTEGRATION_TYPE         MTOUCH_CALLED_FROM_ISR
00096 
00097     
00098         // If MTOUCH_INTEGRATION_TYPE is defined as either MTOUCH_CONTROLS_ISR or MTOUCH_CALLED_FROM_ISR,
00099         // this option will determine which timer is used to clock the mTouch scan routine.
00100         #define MTOUCH_ISR_TIMER            0       // NOTE: You are responsible for initializing
00101                                                     //       the timer with any desired pre- or
00102                                                     //       post-scaling options including any
00103                                                     //       period registers (PR2/4/6). 
00104                                                     // 8-bit Timers Only. Not compatible with TMR1/3/5.
00105     
00106     
00107     // mTouch Scan Method Functionality
00108     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00109     //  Option Label                    :: Option Behavior
00110     //.................................................................................................
00111     //  MTOUCH_SCANS_ONE_SENSOR         :: One mTouch function call will result in one sensor being scanned once.
00112     //  MTOUCH_SCANS_ALL_SENSORS        :: One mTouch function call will result in all sensors being scanned once.
00113     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00114 
00115     #define MTOUCH_SCAN_FUNCTIONALITY       MTOUCH_SCANS_ONE_SENSOR
00116 
00117     
00118     
00119     // mTouch Scan Method Functionality
00120     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00121     //  Option Label                    :: Option Behavior
00122     //.................................................................................................
00123     //  MTOUCH_ALWAYS_CONTROLS_ADC      :: ADC is considered under the control of the framework at all times.
00124     //  MTOUCH_RELEASES_ADC_AFTER_SCAN  :: ADC is released and available for use between scans.
00125     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00126     
00127     #define MTOUCH_ADC_CONTROL              MTOUCH_ALWAYS_CONTROLS_ADC
00128                                                     
00129 
00130                                                     //:::::::::::::::::::::::::::::::::::::::::::::::::
00131                                                     // System Version Control
00132                                                     //
00133                                                     //  These values are used only when communicating
00134                                                     //  with the mTouch PC software to relay
00135                                                     //  information about the current version of
00136                                                     //  firmware being used.
00137                                                     //
00138     #define MTOUCH_BOARD_ID                 0x00    //  Which board is this? 
00139                                                     //      Used in 'V2' mTouch GUI to identify the board.
00140                                                     //      No effect on framework behavior.
00141     #define MTOUCH_HARDWARE_VERSION         0x01    //  Which hardware revision?
00142                                                     //      Displayed in 'V2' mTouch GUI. 
00143                                                     //      No effect on framework behavior.
00144     #define MTOUCH_FRAMEWORK_VERSION        0x20    //  Which version of the mTouch framework is this?
00145                                                     //      Displayed in 'V2' mTouch GUI. 
00146                                                     //      No effect on framework behavior.
00147     #define MTOUCH_SOFTWARE_VERSION         0x01    //  Which version of user-application code is this?
00148                                                     //      Displayed in 'V2' mTouch GUI. 
00149                                                     //      No effect on framework behavior.
00150                                                     //:::::::::::::::::::::::::::::::::::::::::::::::::
00151                                                     
00152     // mTouch EEPROM Configuration Value Storage
00153     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00154     //#define MTOUCH_EEPROM_ENABLED                 // <-- If defined, mTouch configuration values
00155                                                     //     will be stored in and read from EEPROM.
00156                                                     //     This allows for real-time updates to values
00157                                                     //     such as debounce max values, and thresholds.
00158                                                     //     The mComm module can be used to read/write
00159                                                     //     these values. See mComm_config.h.
00160                                                     
00161         #define MTOUCH_EEPROM_START_ADR     0x02    // <-- If EEPROM is enabled, this value determines
00162                                                     //     where the starting address of the mTouch
00163                                                     //     storage block will be located.
00164                                                     //      Valid Values: Must be 0x02 or higher.
00165                                                     //  
00166                                                     //     DO NOT CHOOSE 0x00:
00167                                                     //      Brown-out resets may result in unwanted 
00168                                                     //      EEPROM writes to address 0x00 - so this 
00169                                                     //      address should always be skipped.
00170                                                     //
00171                                                     //     DO NOT CHOOSE 0x01:
00172                                                     //      An initialization byte is placed at location
00173                                                     //      0x01 to determine if the EEPROM has been
00174                                                     //      initialized. By checking this byte, we can
00175                                                     //      initialize the configuration values on the
00176                                                     //      first power up, and leave them alone for all
00177                                                     //      future power ups.
00178                                                     //
00179                                                     //     NOTE: MTOUCH_EEPROM_END_ADR will be defined
00180                                                     //           automatically to let you know the
00181                                                     //           address of the final mTouch value.
00182                                                     
00183         #define MTOUCH_EEPROM_INIT_VALUE    0xBD    // <-- If EEPROM is enabled, the first time the 
00184                                                     //     EEPROM is initialized, it will load this
00185                                                     //     value into the starting address location.
00186                                                     //     On power-up after that, the device will
00187                                                     //     see that this value is already loaded into
00188                                                     //     EEPROM and will not re-initialize. This
00189                                                     //     allows the device to maintain its
00190                                                     //     configuration through power cycles.
00191                                                     //
00192                                                     //     NOTE: When programming the device, the
00193                                                     //           first 8 bytes of EEPROM will be
00194                                                     //           cleared (0xFF) to reset the mTouch
00195                                                     //           EEPROM initialization byte and force
00196                                                     //           a rewrite of the EEPROM values.
00197                                                     //      On normal device power up, the init value
00198                                                     //           is not erased.
00199                                                     
00200         #define MTOUCH_EEPROM_STORED_IN_RAM         // <-- If EEPROM is enabled and this value is
00201                                                     //     defined, the mTouch configuration options
00202                                                     //     will be stored in a RAM array - not in EEPROM.
00203                                                     //     This can be used to support two-way
00204                                                     //     communications on PICs with no EEPROM or
00205                                                     //     as a way to reset to factory settings when
00206                                                     //     the processor is powered off.
00207         
00208         
00209 //****************************************************************************************************
00210 //  ____                              ____       _               
00211 // / ___|  ___ _ __  ___  ___  _ __  / ___|  ___| |_ _   _ _ __  
00212 // \___ \ / _ \ '_ \/ __|/ _ \| '__| \___ \ / _ \ __| | | | '_ \ 
00213 //  ___) |  __/ | | \__ \ (_) | |     ___) |  __/ |_| |_| | |_) |
00214 // |____/ \___|_| |_|___/\___/|_|    |____/ \___|\__|\__,_| .__/ 
00215 //                                                        |_|    
00216 //
00217 //****************************************************************************************************
00218                                                     
00219     #define MTOUCH_NUMBER_SENSORS       7           // <-- Total number of mTouch sensors that will
00220                                                     //     be scanned. This includes all matrix,
00221                                                     //     proximity, button, or slider traces.
00222 
00223     // Analog Pin Configuration
00224     #define MTOUCH_SENSOR0              AN12         
00225     #define MTOUCH_SENSOR1              AN10         /// @cond    
00226     #define MTOUCH_SENSOR2              AN8    
00227     #define MTOUCH_SENSOR3              AN9   
00228     #define MTOUCH_SENSOR4              AN11
00229     #define MTOUCH_SENSOR5              AN13
00230     #define MTOUCH_SENSOR6              AN4
00231     #define MTOUCH_SENSOR7              AN7
00232     #define MTOUCH_SENSOR8              AN8 
00233     #define MTOUCH_SENSOR9              AN9
00234     #define MTOUCH_SENSOR10             AN10    
00235     #define MTOUCH_SENSOR11             AN11    
00236     #define MTOUCH_SENSOR12             AN12    
00237     #define MTOUCH_SENSOR13             AN13   
00238       
00239     #define MTOUCH_SENSOR14             AN4    
00240     #define MTOUCH_SENSOR15             AN5   
00241     #define MTOUCH_SENSOR16             AN6   
00242     #define MTOUCH_SENSOR17             AN7   
00243     #define MTOUCH_SENSOR18             AN8   
00244     #define MTOUCH_SENSOR19             AN9   
00245     #define MTOUCH_SENSOR20             AN10   
00246     #define MTOUCH_SENSOR21             AN11   
00247     #define MTOUCH_SENSOR22             AN12   
00248     #define MTOUCH_SENSOR23             AN13   
00249     #define MTOUCH_SENSOR24             AN4        // TIP:
00250     #define MTOUCH_SENSOR25             AN5        // Extra sensor definitions can be ignored - they will
00251     #define MTOUCH_SENSOR26             AN6        // only be implemented if MTOUCH_NUMBER_SENSORS defines that
00252     #define MTOUCH_SENSOR27             AN7        // they are enabled.
00253     #define MTOUCH_SENSOR28             AN8        
00254     #define MTOUCH_SENSOR29             AN9        
00255 
00256 
00257 
00258    
00259    
00260    
00261     // Press Threshold Configuration
00262     #define THRESHOLD_PRESS_SENSOR0     500         
00263     #define THRESHOLD_PRESS_SENSOR1     500         /// @cond
00264     #define THRESHOLD_PRESS_SENSOR2     500         // <-- Required difference between the sensor's baseline
00265     #define THRESHOLD_PRESS_SENSOR3     500         //     value and the current reading to trigger a press    
00266     #define THRESHOLD_PRESS_SENSOR4     500         //     Allowable Range :: [ 1 to 65535 ]
00267     #define THRESHOLD_PRESS_SENSOR5     500        
00268     #define THRESHOLD_PRESS_SENSOR6     500  
00269     #define THRESHOLD_PRESS_SENSOR7     500  
00270     #define THRESHOLD_PRESS_SENSOR8     500  
00271     #define THRESHOLD_PRESS_SENSOR9     500  
00272     #define THRESHOLD_PRESS_SENSOR10    500
00273     #define THRESHOLD_PRESS_SENSOR11    500
00274     #define THRESHOLD_PRESS_SENSOR12    500
00275     #define THRESHOLD_PRESS_SENSOR13    500
00276     
00277     #define THRESHOLD_PRESS_SENSOR14    200
00278     #define THRESHOLD_PRESS_SENSOR15    200
00279     #define THRESHOLD_PRESS_SENSOR16    200
00280     #define THRESHOLD_PRESS_SENSOR17    200
00281     #define THRESHOLD_PRESS_SENSOR18    200
00282     #define THRESHOLD_PRESS_SENSOR19    200
00283     #define THRESHOLD_PRESS_SENSOR20    200
00284     #define THRESHOLD_PRESS_SENSOR21    200      
00285     #define THRESHOLD_PRESS_SENSOR22    200         // TIP:
00286     #define THRESHOLD_PRESS_SENSOR23    200         // Extra threshold definitions for sensors that are not
00287     #define THRESHOLD_PRESS_SENSOR24    200         // implemented can be ignored.
00288     #define THRESHOLD_PRESS_SENSOR25    200  
00289     #define THRESHOLD_PRESS_SENSOR26    200  
00290     #define THRESHOLD_PRESS_SENSOR27    200  
00291     #define THRESHOLD_PRESS_SENSOR28    200  
00292     #define THRESHOLD_PRESS_SENSOR29    200         
00293 
00294 
00295 
00296 
00297     #define MTOUCH_RELEASE_THRESH_FACTOR    0.5     // <-- Defines the hysteresis between press and release
00298                                                     //     In other words, '0.4' would result in a release
00299                                                     //     threshold equal to 40% of the press threshold.
00300                                                     //     
00301                                                     //     Example: With a finger on the sensor, the reading
00302                                                     //      settles to a value (1000). When a finger is added, 
00303                                                     //      we see the reading increase (1200). The press 
00304                                                     //      threshold is then set to determine how much shift
00305                                                     //      we want to see before we get a press. In this case
00306                                                     //      we see a shift of 200. So we can set the threshold
00307                                                     //      to 160. The release threshold is a percentage of
00308                                                     //      the press threshold. If set to 0.4, it will be
00309                                                     //      40% of the 160 press threshold, or '64' counts.
00310                                                     //      So the sensor will remain pressed until the reading
00311                                                     //      returns to a value of 1064 or less.
00312                                                     //
00313                                                     //     Allowable Range :: [ 0.30 to 1.00 ]
00314  
00315 
00316 
00317 //****************************************************************************************************
00318 //  _____ _ _ _            _             
00319 // |  ___(_) | |_ ___ _ __(_)_ __   __ _ 
00320 // | |_  | | | __/ _ \ '__| | '_ \ / _` |
00321 // |  _| | | | ||  __/ |  | | | | | (_| |
00322 // |_|   |_|_|\__\___|_|  |_|_| |_|\__, |
00323 //                                 |___/ 
00324 //
00325 //****************************************************************************************************
00326 
00327     #define MTOUCH_SAMPLES_PER_SCAN     30          // <-- Number of times each sensor will be scanned 
00328                                                     //     before asserting the mTouch_state.dataReady 
00329                                                     //     bit. See the mTouch Framework's documentation 
00330                                                     //     for help achieving a specific response time.
00331                                                     //     Allowed Range :: [ 1 to 65535 ]
00332                                                 
00333     #define MTOUCH_BASELINE_WEIGHT      3           // <-- Determines the weight given to the reading
00334     // The configuration option formerly known as   //     in the calculation of a new baseline average.
00335     //  MTOUCH_AVG_UPDATE                           //     The reading will have a weight of 
00336                                                     //     1/(2^MTOUCH_BASELINE_WEIGHT) in the baseline 
00337                                                     //     calculation. 
00338                                                     //     Example: If this value is '3', the baseline 
00339                                                     //              calculation would be:
00340                                                     //        baseline = (1/8)*reading + (7/8)*baseline
00341                                                     //     Example: If this value is '2', the baseline 
00342                                                     //              calculation would be:
00343                                                     //        baseline = (1/4)*reading + (3/4)*baseline
00344                                                     //     Allowed Values :: [ 1 to 4 ]
00345 
00346     #define MTOUCH_BASELINE_RATE        10          // <-- Determines how often the baseline average will
00347     // The configuration option formerly known as   //     be updated. A new calculation will occur every
00348     //  MTOUCH_AVG_RATE                             //     N'th mTouch decode service call, where 'N' is 
00349                                                     //     this value. (Fastest = 1)
00350                                                     //     Allowed Range :: [ 1 to 65535 ]
00351 
00352     #define MTOUCH_DECIMATION_MAX_STEP  10          // <-- Maximum change allowed during one CVD sample
00353     
00354     #define MTOUCH_JITTER_BITS          6           // <-- Determines the number of bits to use to implement
00355                                                     //     a randomized delay between mTouch scans.
00356                                                     //     Allowed Range :: [ 0 to 8 ], 0 = off.
00357 
00358     #define MTOUCH_SCALING              1           // <-- Defines the degree of post-scaling that is 
00359                                                     //     implemented on the acquisition's accumulation
00360                                                     //     register before being stored as the result.
00361                                                     //     The scaling factor should be set so that it is
00362                                                     //     not possible for the result register to overflow 
00363                                                     //     (Max result output value is 65535.)
00364                                                     //     Set this equal to the number of times to 
00365                                                     //     right-shift the value.
00366                                                     //     Allowed Range :: [ 0 to 8 ]
00367                                                     //       0 - No scaling is performed.
00368                                                     //           1:1 ratio between accumulator and result
00369                                                     //
00370                                                     //       4 - Accumulator is divided by 16.
00371                                                     //           16:1 ratio between accumulator and result
00372                                                     //
00373                                                     //       8 - Accumulator is divided by 256.
00374                                                     //           256:1 ratio between accumulator and result
00375                                                     //
00376                                                 
00377                                             
00378                                                 
00379                                                 
00380 //****************************************************************************************************
00381 //  ____                     _ _             
00382 // |  _ \  ___  ___ ___   __| (_)_ __   __ _ 
00383 // | | | |/ _ \/ __/ _ \ / _` | | '_ \ / _` |
00384 // | |_| |  __/ (_| (_) | (_| | | | | | (_| |
00385 // |____/ \___|\___\___/ \__,_|_|_| |_|\__, |
00386 //                                     |___/ 
00387 //****************************************************************************************************
00388     
00389 
00390     #define MTOUCH_POWER_UP_SAMPLES     30          // <-- Determines the number of initialization samples
00391                                                     //     taken at power up. Each sensor will be decoded
00392                                                     //     this number of times.
00393                                                     //     Allowable Range :: [ 1 to 65535 ]
00394 
00395     #define     MTOUCH_BUTTON_TIMEOUT       300         // <-- Number of consecutive 'pressed' decode decisions
00396                                                     //     before the sensor's state is reset. 
00397                                                     //     See the note, below, for more information about
00398                                                     //     how the baseline's behavior changes when a timeout
00399                                                     //     condition occurs.
00400                                                     //     
00401                                                     //     Allowable Range :: [ 0 to 65535 ], '0' is off.
00402                                                 
00403     #define     MTOUCH_DEBOUNCE_RELEASE     0           // <-- Number of consecutive scans a button must be seen
00404                                                     //     as released before a 'released state' is declared
00405                                                     //     Allowable Range :: [ 0 to 65535 ], '0' is off.
00406  
00407     #define     MTOUCH_DEBOUNCE_PRESS           0           // <-- Number of consecutive scans a button must be seen 
00408                                                     //     as pressed before a 'pressed state' is declared
00409                                                     //     Allowable Range :: [ 0 to 65535 ], '0' is off.
00410                                                 
00411     //#define MTOUCH_TOGGLE_ENABLED                 // <-- If enabled, a toggle latch bit will be implemented for
00412                                                     //     each active sensor. You can access the current toggle
00413                                                     //     state using mTouch_GetToggleState(i).
00414                                                     
00415     //#define MTOUCH_ERROR_DETECTION_ENABLED        // <-- If enabled, implements the mTouch_errorDetect()
00416                                                     //     function which can be called by the application to
00417                                                     //     verify that all enabled sensor lines are floating and
00418                                                     //     are not being held high or low. If one is found to be
00419                                                     //     in this condition, the mTouch_state.error flag is set.
00420 
00421                                                     
00422     // NOTE: The MTOUCH_NEGATIVE_CAPACITANCE option has been removed. The baseline now automatically changes its
00423     //       behavior after a timeout has occured to solve the issue this option was addressing. On-press, the
00424     //       baseline remains at the unpressed value of the sensor. After a button timeout has occurred, the 
00425     //       baseline is reset to the current value of the sensor (the pressed value). This triggers a special
00426     //       flag (mTouch_stateVars.active.sensor[i].timeout) which causes the baseline to look for the next
00427     //       large (> 1/2 * Press Threshold) negative shift. When this shift occurs, the baseline will quickly
00428     //       update itself until the difference between the reading and the baseline is less than the release
00429     //       threshold. This allows the average to maintain steady filtering while still providing fast recovery
00430     //       in case of a timeout condition.
00431                                                     
00432                                                     
00433     // mTouch Matrix and Most-Pressed Algorithm Options
00434     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00435     
00436     #define MTOUCH_MOST_PRESSED_THRESHOLD   10      // <-- MUST BE DEFINED FOR BOTH MATRIX AND MOST-PRESSED-ONLY
00437                                                     //     This option determines how much more pressed the
00438                                                     //     most-pressed sensor must be above all other sensors
00439                                                     //     in order to allow activation. 
00440                                                     //     This must also be defined if there is a matrix being
00441                                                     //     implemented. The matrix will automatically run a most-
00442                                                     //     pressed algorithm on the rows and columns separately.
00443                                                     //     It needs this value to determine if the row/column is
00444                                                     //     sufficiently more-pressed than another.
00445     
00446     //#define MTOUCH_MATRIX_ENABLED                 // <-- If enabled, the framework will implement a matrix.
00447                                                     //     The sensors implementing the rows must all be grouped
00448                                                     //     together by index. The same is true for the columns.
00449                                                     //     To have both matrix and non-matrix sensors, the matrix
00450                                                     //     sensors must be grouped together and either at the start
00451                                                     //     or end of all the sensors.
00452                                                     //
00453         #define MTOUCH_MATRIX_ROW_START         0   // <-- The sensor index of the first row
00454         #define MTOUCH_MATRIX_ROW_END           1   // <-- The sensor index of the last row
00455                                                     //
00456         #define MTOUCH_MATRIX_COLUMN_START      2   // <-- The sensor index of the first column
00457         #define MTOUCH_MATRIX_COLUMN_END        3   // <-- The sensor index of the last column
00458                                                     //
00459                                                     //      
00460                                                     //     Examples:    VALID       VALID       INVALID     INVALID   
00461                                                     //
00462                                                     //     Sensor0    / ROW0        Normal      Normal    / ROW0
00463                                                     //     Sensor1    | ROW1        Normal    / ROW0      \ ROW1
00464                                                     //     Sensor2    | COL0      / COL0      | ROW1        Normal
00465                                                     //     Sensor3    | COL1      | COL1      | COL0        Normal
00466                                                     //     Sensor4    \ COL2      | COL2      | COL1      / COL0
00467                                                     //     Sensor5      Normal    | ROW0      \ COL2      | COL1
00468                                                     //     Sensor6      Normal    \ ROW1        Normal    \ COL2
00469                                                     //     --------------------------------------------------------
00470                                                     //     ROW_START      0           5         Matrix      Matrix
00471                                                     //     ROW_END        1           6         sensors     sensors
00472                                                     //     COL_START      2           2         not at      not
00473                                                     //     COL_END        4           4         beginning   grouped
00474                                                     //                                          or end
00475     
00476     
00477     //#define MTOUCH_MOST_PRESSED_ONLY                // <-- If enabled, only one non-matrix, active sensor will be 
00478                                                     //     able to be in the pressed state at any given time. 
00479                                                     //     In order for a sensor to enter the pressed state with
00480                                                     //     this option enabled, it must:
00481                                                     //      1. Be pressed enough to cross the sensor's press
00482                                                     //         threshold value. (ex: THRESHOLD_PRESS_SENSOR0)
00483                                                     //      2. Be more pressed than the second-most-pressed sensor
00484                                                     //         by at least MTOUCH_MOST_PRESSED_THRESHOLD.
00485                                                     //
00486                                                     //     NOTE: Matrix sensors are separated from 'normal' sensors
00487                                                     //           and are not compared with each other. Matrix
00488                                                     //           sensors are automatically split into their 'row'
00489                                                     //           and 'column' groups to find the most pressed.
00490                                                     
00491     
00492 
00493 //****************************************************************************************************
00494 //  ____                _           _ _         
00495 // |  _ \ _ __ _____  _(_)_ __ ___ (_) |_ _   _ 
00496 // | |_) | '__/ _ \ \/ / | '_ ` _ \| | __| | | |
00497 // |  __/| | | (_) >  <| | | | | | | | |_| |_| |
00498 // |_|   |_|  \___/_/\_\_|_| |_| |_|_|\__|\__, |
00499 //                                        |___/ 
00500 //****************************************************************************************************
00501     
00502     //
00503     // NOTE: To enable a proximity sensor, you must perform two steps:
00504     //      
00505     //      1. Define MTOUCH_NUMBER_PROXIMITY with the number of proximity sensors in total.
00506     //         This is used to determine how large to make the arrays.
00507     //
00508     //      2. There must be one MTOUCH_SENSOR#_IS_PROX definition per enabled proximity sensor.
00509     //         The value of the definition must be it's "proximity-id" value.
00510     //         "Proximity-ID" is used as an index to the proximity variables. In total, the IDs
00511     //         should start at 0 and end with MTOUCH_NUMBER_PROXIMITY-1. The order is arbitrary.
00512     //
00513     //          Example:
00514     //
00515     //              #define MTOUCH_NUMBER_PROXIMITY     2
00516     //
00517     //              #define MTOUCH_SENSOR5_IS_PROX      0
00518     //              #define MTOUCH_SENSOR2_IS_PROX      1
00519     //
00520     
00521     
00522     #define MTOUCH_NUMBER_PROXIMITY     0               // Defines how many proximity sensors are activated
00523 
00524     #define MTOUCH_SENSOR3_IS_PROX      0               // MTOUCH_SENSOR3 is a proximity sensor with index 0
00525     #define MTOUCH_SENSOR1_IS_PROX      1               // MTOUCH_SENSOR1 is a proximity sensor with index 1
00526     
00527     // mTouch Proximity Filtering Options
00528     //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00529         #define MTOUCH_PROX_BUFFER_SIZE         5   // <-- This determines the size of the buffer used
00530                                                     //     in the proximity filter.
00531                                                     //     
00532                                                     //     Options -
00533                                                     //      5   :: Least filtering, fastest response time
00534                                                     //      9   ::
00535                                                     //      15  :: Most filtering, longest response time
00536                                                     
00537         #define MTOUCH_PROX_REMOVE_EXTREME      1   // <-- The N largest and N smallest values in the
00538                                                     //     buffer will be removed. The remaining values
00539                                                     //     will then be averaged to achieve a mean result.
00540                                                     //
00541                                                     //     This value is 'N'. It must be less than half
00542                                                     //     the buffer size.
00543 
00544     
00545         #define MTOUCH_PROX_USE_32BIT_ACCUM         // <-- If defined, the accumulator used during the
00546                                                     //     decoding process of the proximity sensor will
00547                                                     //     be implemented as a 32-bit value. This solves
00548                                                     //     overflow problems - at the cost of additional
00549                                                     //     temporary RAM requirements.
00550     
00551 
00552 //****************************************************************************************************
00553 //  ____  _ _     _                                 _  __        ___               _     
00554 // / ___|| (_) __| | ___ _ __ ___    __ _ _ __   __| | \ \      / / |__   ___  ___| |___ 
00555 // \___ \| | |/ _` |/ _ \ '__/ __|  / _` | '_ \ / _` |  \ \ /\ / /| '_ \ / _ \/ _ \ / __|
00556 //  ___) | | | (_| |  __/ |  \__ \ | (_| | | | | (_| |   \ V  V / | | | |  __/  __/ \__ \
00557 // |____/|_|_|\__,_|\___|_|  |___/  \__,_|_| |_|\__,_|    \_/\_/  |_| |_|\___|\___|_|___/
00558 //                                  
00559 //****************************************************************************************************
00560 
00561 // See 'mTouch_config_slider.h'
00562 
00563 
00564     
00565 //****************************************************************************************************
00566 //   ____                                      _           _   _                 
00567 //  / ___|___  _ __ ___  _ __ ___  _   _ _ __ (_) ___ __ _| |_(_) ___  _ __  ___ 
00568 // | |   / _ \| '_ ` _ \| '_ ` _ \| | | | '_ \| |/ __/ _` | __| |/ _ \| '_ \/ __|
00569 // | |__| (_) | | | | | | | | | | | |_| | | | | | (_| (_| | |_| | (_) | | | \__ \
00570 //  \____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|_|\___\__,_|\__|_|\___/|_| |_|___/
00571 //
00572 //****************************************************************************************************
00573 
00574 //--------------------------------------------------------------------------------------
00575 // #define APFCON_INITIALIZED       // For processors with an APFCON register(s), this 
00576 //                                  // #define can be uncommented to stop the mTouch 
00577 //                                  // Framework from producing a "remember to set 
00578 //                                  // APFCON" warning.
00579 //                                  //
00580 //                                  // RULE OF PROGRAMMING #4: Register bits initialize, 
00581 //                                  //      by law, to the value you don't want. Always 
00582 //                                  //      explicitly initialize.
00583 //--------------------------------------------------------------------------------------
00584 
00585 // See 'mComm_config.h'
00586 
00587 
00588 
00589 //****************************************************************************************************
00590 //     _                   _     _ _   _             
00591 //    / \   ___ __ _ _   _(_)___(_) |_(_) ___  _ __    _
00592 //   / _ \ / __/ _` | | | | / __| | __| |/ _ \| '_ \  (_)
00593 //  / ___ \ (_| (_| | |_| | \__ \ | |_| | (_) | | | |  _
00594 // /_/   \_\___\__, |\__,_|_|___/_|\__|_|\___/|_| |_| (_)
00595 //                |_|  
00596 //   ______     ______    ____                     ____            _             _     
00597 //  / ___\ \   / /  _ \  / ___|  ___ __ _ _ __    / ___|___  _ __ | |_ _ __ ___ | |___ 
00598 // | |    \ \ / /| | | | \___ \ / __/ _` | '_ \  | |   / _ \| '_ \| __| '__/ _ \| / __|
00599 // | |___  \ V / | |_| |  ___) | (_| (_| | | | | | |__| (_) | | | | |_| | | (_) | \__ \
00600 //  \____|  \_/  |____/  |____/ \___\__,_|_| |_|  \____\___/|_| |_|\__|_|  \___/|_|___/
00601 //
00602 //****************************************************************************************************
00603 
00604 // See 'mTouch_config_cvdAdvanced.h'
00605     
00606        
00607 #endif

mTouch Framework v2.1 documentation by  Click here to visit our website at www.microchip.com