Data Structures | Defines | Enumerations | Functions | Variables

mTouch.h File Reference

Required include! The main framework header file used by all framework files. More...

#include <p18cxxx.h>
#include "mTouch_config.h"
#include "mTouch_processConfiguration.h"
#include "mTouch_modes.h"
#include "mComm.h"
Include dependency graph for mTouch.h:

Go to the source code of this file.

Data Structures

struct  mTouch_SensorVariables
 Contains all variables used in active mode which can/will be reinitialized after each mode switch. More...
union  mTouch_StateVariables
 Contains sensor and state variables. More...
union  mTouch_AcquisitionData
 Structure used to implement both a 12-bit and a 20-bit variable inside a single 32-bit array. More...
struct  mTouch_State
 Collection of single-bit flags used by the mTouch Framework. More...

Defines

#define MTOUCH_CURRENTSCAN_VALUE   mTouch_currentScan
#define mTouch_GetButtonState(i)
 Get the current state of the given active-mode sensor.
#define mTouch_GetAverage(i)
 Get the current average value of the given active-mode sensor.
#define mTouch_GetSensor(i)
 Get the current reading value of the given active-mode sensor.
#define mTouch_EnableScanning()
 Enables mTouch scanning.
#define mTouch_DisableScanning()
 Disables mTouch scanning.
#define mTouch_Service()
 Performs mTouch decoding, communications output, and mode switching.
#define mTouch_isDataReady()
 Sometimes function call, sometimes bit-check. Required mTouch API call.
#define mTouch_checkInterrupt()
 Implements the ISR flag checks to see if the mTouch timer caused the interrupt.

Enumerations

enum  mTouch_enum_ButtonState { MTOUCH_INITIALIZING, MTOUCH_RELEASED, MTOUCH_PRESSED }

Functions

void mTouch_Init (void)
 Main initialization routine for all mTouch framework modules including the built-in communication module, if enabled.
void mTouch_Decode (void)
 Updates the state of each active-mode sensor using the latest acquisition value.
void mTouch_ChangeMode (void)
void mTouch_Scan (void)
 Implements the framework's active-mode acquisition routine. Sometimes implemented as an ISR, sometimes as a normal function.

Variables

mTouch_State mTouch_state
 Tracks the state of the mTouch algorithm.
mTouch_StateVariables mTouch_stateVars
 Stores all state-temporary variables to be reinitialized each mode change.
uint16_t mTouch_sensorData [MTOUCH_NUMBER_SENSORS]
 Latch register storing the latest mTouch acquisition results.
mTouch_AcquisitionData mTouch_acqData [MTOUCH_NUMBER_SENSORS]
 Internal mTouch acquisition variable structure.
uint16_t mTouch_average [MTOUCH_NUMBER_SENSORS]
 Array to track the unpressed value of each sensor.
const uint16_t mTouch_pressThreshold [MTOUCH_NUMBER_SENSORS]
 Constant array containing the press threshold for each sensor.
const uint16_t mTouch_releaseThreshold [MTOUCH_NUMBER_SENSORS]
 Constant array containing the release threshold for each sensor.
uint8_t mTouch_currentScan

Detailed Description

Required include! The main framework header file used by all framework files.

Definition in file mTouch.h.


Define Documentation

#define mTouch_checkInterrupt (  )

Implements the ISR flag checks to see if the mTouch timer caused the interrupt.

Definition at line 608 of file mTouch.h.

#define MTOUCH_CURRENTSCAN_VALUE   mTouch_currentScan

Definition at line 359 of file mTouch.h.

#define mTouch_DisableScanning (  )

Disables mTouch scanning.

Definition at line 562 of file mTouch.h.

#define mTouch_EnableScanning (  )

Enables mTouch scanning.

Definition at line 561 of file mTouch.h.

#define mTouch_GetAverage (   i )

Get the current average value of the given active-mode sensor.

Parameters:
iindex of the sensor

Definition at line 471 of file mTouch.h.

#define mTouch_GetButtonState (   i )

Get the current state of the given active-mode sensor.

Parameters:
iindex of the sensor Example usage:

   if (mTouch_GetButtonState(0) < MTOUCH_PRESSED) { 
       LED0 = LED_OFF; 
   } else { 
       LED0 = LED_ON; 
   }

Definition at line 462 of file mTouch.h.

#define mTouch_GetSensor (   i )

Get the current reading value of the given active-mode sensor.

Parameters:
iindex of the sensor

Definition at line 480 of file mTouch.h.

#define mTouch_isDataReady (  )

Sometimes function call, sometimes bit-check. Required mTouch API call.

The mTouch_isDataReady() macro will return '1' when:

  • mTouch is being scanned from the ISR and new data is ready to process.
  • mTouch is being called from the mainloop and new data is ready to process.

This macro call is sometimes implemented as a bit-check on a variable. If mTouch is not being called from the ISR, this macro is implemented as a function call to the scan routine.

Returns:
1 when new data is ready for processing, 0 otherwise.

Definition at line 598 of file mTouch.h.

#define mTouch_Service (  )

Performs mTouch decoding, communications output, and mode switching.

The data ready flag is cleared and the mTouch decode routine is called.

Definition at line 576 of file mTouch.h.


Enumeration Type Documentation

Enumeration of the valid mTouch active-mode sensor states

Enumerator:
MTOUCH_INITIALIZING 

Sensor is still initializing.

MTOUCH_RELEASED 

Sensor is currently released.

MTOUCH_PRESSED 

Sensor is currently pressed.

Definition at line 378 of file mTouch.h.


Function Documentation

void mTouch_ChangeMode ( void   )

Definition at line 508 of file mTouch_acquistion.c.

Here is the caller graph for this function:

void mTouch_Init ( void   )

Main initialization routine for all mTouch framework modules including the built-in communication module, if enabled.

Framework Initialization Notes

1. Loop through all enabled, active sensors and initialize their variables.

2. Loop through all enabled sliders and initialize the slider's output value.

3. Initialize mode variables and flags

4. Initialize non-array system variables

5. Initialize the DACOUT pin when it is used as a guard ring.

6. Initialize the ADC module for mTouch operation.

7. Initialization complete - enable active-mode mTouch scanning.



Definition at line 258 of file mTouch.c.

Here is the call graph for this function:


Variable Documentation

mTouch_AcquisitionData mTouch_acqData[MTOUCH_NUMBER_SENSORS]

Internal mTouch acquisition variable structure.

Definition at line 72 of file mTouch_acquistion.c.

uint16_t mTouch_average[MTOUCH_NUMBER_SENSORS]

Array to track the unpressed value of each sensor.

Definition at line 86 of file mTouch.c.

Definition at line 83 of file mTouch_acquistion.c.

const uint16_t mTouch_pressThreshold[MTOUCH_NUMBER_SENSORS]

Constant array containing the press threshold for each sensor.

Definition at line 184 of file mTouch.c.

const uint16_t mTouch_releaseThreshold[MTOUCH_NUMBER_SENSORS]

Constant array containing the release threshold for each sensor.

Definition at line 185 of file mTouch.c.

uint16_t mTouch_sensorData[MTOUCH_NUMBER_SENSORS]

Latch register storing the latest mTouch acquisition results.

Definition at line 74 of file mTouch_acquistion.c.

Tracks the state of the mTouch algorithm.

Definition at line 84 of file mTouch.c.

Stores all state-temporary variables to be reinitialized each mode change.

Definition at line 85 of file mTouch.c.