mTouch API Hooks

Required Initialization Call

This function must be called at power up in order to correctly configure the mTouch framework.


void mTouchCVD_Init (void)
 Initializes the mTouch CVD firmware.

Required Main Loop Service Call

These two hooks are required so that the framework can update the sensor's status.

Example code is provided in the detailed descriptions for both hooks.


#define mTouchCVD_Service()
 Services a new set of results from the acquisition module.
#define mTouchCVD_isDataReady()
 Returns a non-zero value when a new set of readings is ready for processing.

Determining Sensor Status

These hooks are used to determine the current state of the framework's sensors. For more information, see the individual function/variable description.

Example code is provided in the detailed description for CVD_GetButtonState().


#define CVD_GetButtonState(i)
 Returns the state of the requested sensor.

Detailed Description

The mTouch Framework API takes the hassle out of creating a capacitive sensing application. For information on how to use the API in your application, see:


Define Documentation

#define CVD_GetButtonState (   i )

Returns the state of the requested sensor.

Abstraction macro for the current button state.

Example usage:

 if (CVD_GetButtonState(0) < CVD_PRESSED) 
 { 
   LED0 = LED_ON; 
 } else { 
   LED0 = LED_OFF; 
 }
Parameters:
ithe index of the sensor to check the state of

Definition at line 119 of file mTouchCVD.h.

#define mTouchCVD_isDataReady (  )

Returns a non-zero value when a new set of readings is ready for processing.

Abstraction macro for checking if new data is ready for processing.

Example usage:

 while(1)
 {
   if (mTouchCVD_isDataReady())   // Is new information ready?
   {
      mTouchCVD_Service();        // Decode the newly captured data and transmit new data updates.
   }
 }
Returns:
[char] a non-zero value when a new set of readings is ready for processing

Definition at line 121 of file mTouchCVD.h.

#define mTouchCVD_Service (  )

Services a new set of results from the acquisition module.

Abstraction macro for servicing new mTouch data.

This macro clears the mTouchCVD_dataReady variable and calls the CVD_DECODE() function.

Example usage:

 while(1)
 {
   if (mTouchCVD_isDataReady())   // Is new information ready?
   {
      mTouchCVD_Service();        // Decode the newly captured data and transmit new data updates.
   }
 }

Definition at line 120 of file mTouchCVD.h.


Function Documentation

void mTouchCVD_Init ( void   )

Initializes the mTouch CVD firmware.

This routine is the main initialization routine for all mTouch CVD modules including the built-in communication module, if enabled.

Algorithm Implementation Notes

1. Loop through all sensors and initialize array variables

2. Initialize non-array system variables

3. Initialize the ADC module for correct scanning operation

4. Initialize the framework's filtering module

5. Initialize the framework's communication module, if enabled by configuration options

6. Initialization complete: Enable Interrupts



Affected Special Function Registers

  • ADCON1 or ANSEL (based on PIC) - sets ADC clock



Definition at line 132 of file mTouchCVD.c.

Here is the call graph for this function: