MSP430™CapTIvateSoftwareLibraryAPIGuide 1_70_00_03

Macros | Functions
CAPT_HAL

Low level CapTIvate configuration and peripheral hardware abstraction module. More...

## Macros
#define | CAPT_TIMER_SRC_ACLK (0x00)
#define | CAPT_TIMER_SRC_VLOCLK (0x01)
#define | CAPT_TIMER_CLKDIV__1 (0x00)
#define | CAPT_TIMER_CLKDIV__2 (0x01)
#define | CAPT_TIMER_CLKDIV__4 (0x02)
#define | CAPT_TIMER_CLKDIV__8 (0x03)
#define | CAPT_TIMER_CLKDIV__16 (0x04)
#define | CAPT_TIMER_CLKDIV__32 (0x05)
#define | CAPT_TIMER_CLKDIV__64 (0x06)
#define | CAPT_TIMER_CLKDIV__128 (0x07)
#define | CAPT_COUNTER__16 (0x00)
#define | CAPT_COUNTER__32 (0x01)
#define | CAPT_COUNTER__64 (0x02)
#define | CAPT_COUNTER__128 (0x03)
#define | CAPT_COUNTER__256 (0x04)
#define | CAPT_COUNTER__512 (0x05)
#define | CAPT_COUNTER__1024 (0x06)
#define | CAPT_COUNTER__2048 (0x07)
#define | CAPT_COUNTER__DISABLED (0x08)
#define | CAPT_OSC_FREQ_DEFAULT (0x00)
#define | CAPT_OSC_FREQ_16MHZ (0x00)
#define | CAPT_OSC_FREQ_14P7MHZ (0x01)
#define | CAPT_OSC_FREQ_13P1MHZ (0x02)
#define | CAPT_OSC_FREQ_11P2MHZ (0x03)
#define | CAPT_REFERENCE_CAP__SELF_1P0PF (0x00)
#define | CAPT_REFERENCE_CAP__SELF_1P1PF (0x04)
#define | CAPT_REFERENCE_CAP__SELF_1P5PF (0x05)
#define | CAPT_REFERENCE_CAP__SELF_5P0PF (0x02)
#define | CAPT_REFERENCE_CAP__SELF_5P1PF (0x06)
#define | CAPT_REFERENCE_CAP__SELF_5P5PF (0x07)
#define | CAPT_REFERENCE_CAP__MUTUAL_0P1PFM_1P0PF (0x00)
#define | CAPT_REFERENCE_CAP__MUTUAL_0P5PFM_1P0PF (0x01)
#define | CAPT_REFERENCE_CAP__MUTUAL_0P1PFM_5P0PF (0x02)
#define | CAPT_REFERENCE_CAP__MUTUAL_0P5PFM_5P0PF (0x03)
#define | CAPT_COARSEGAIN_0 (0x00)
#define | CAPT_COARSEGAIN_1 (0x01)
#define | CAPT_COARSEGAIN_2 (0x02)
#define | CAPT_COARSEGAIN_3 (0x03)
#define | CAPT_COARSEGAIN_4 (0x04)
#define | CAPT_COARSEGAIN_5 (0x05)
#define | CAPT_COARSEGAIN_6 (0x06)
#define | CAPT_COARSEGAIN_7 (0x07)
#define | CAPT_COARSEGAIN_MIN (CAPT_COARSEGAIN_0)
#define | CAPT_COARSEGAIN_MAX (CAPT_COARSEGAIN_7)
#define | CAPT_FINEGAIN_0 (0x00)
#define | CAPT_FINEGAIN_1 (0x01)
#define | CAPT_FINEGAIN_2 (0x02)
#define | CAPT_FINEGAIN_3 (0x03)
#define | CAPT_FINEGAIN_4 (0x04)
#define | CAPT_FINEGAIN_5 (0x05)
#define | CAPT_FINEGAIN_6 (0x06)
#define | CAPT_FINEGAIN_7 (0x07)
#define | CAPT_FINEGAIN_8 (0x08)
#define | CAPT_FINEGAIN_9 (0x09)
#define | CAPT_FINEGAIN_10 (0x0A)
#define | CAPT_FINEGAIN_11 (0x0B)
#define | CAPT_FINEGAIN_12 (0x0C)
#define | CAPT_FINEGAIN_13 (0x0D)
#define | CAPT_FINEGAIN_14 (0x0E)
#define | CAPT_FINEGAIN_15 (0x0F)
#define | CAPT_FINEGAIN_16 (0x10)
#define | CAPT_FINEGAIN_17 (0x11)
#define | CAPT_FINEGAIN_18 (0x12)
#define | CAPT_FINEGAIN_19 (0x13)
#define | CAPT_FINEGAIN_MIN (CAPT_FINEGAIN_0)
#define | CAPT_FINEGAIN_MAX (CAPT_FINEGAIN_19)
#define | CAPT_OFFSETTAP_MIN (0x00)
#define | CAPT_OFFSETTAP_MAX (0xFF)
#define | CAPT_OFFSETSCALE__VERYSMALL (0x0000)
#define | CAPT_OFFSETSCALE__SMALL (0x0100)
#define | CAPT_OFFSETSCALE__LARGE (0x0200)
#define | CAPT_OFFSETSCALE__VERYLARGE (0x0300)
#define | CAPT_OFFSETSCALE_MIN (CAPT_OFFSETSCALE__VERYSMALL)
#define | CAPT_OFFSETSCALE_MAX (CAPT_OFFSETSCALE__VERYLARGE)
#define | CAPT_END_OF_CONVERSION_INTERRUPT (0x0001)
#define | CAPT_DETECTION_INTERRUPT (0x0002)
#define | CAPT_TIMER_INTERRUPT (0x0004)
#define | CAPT_CONVERSION_COUNTER_INTERRUPT (0x0008)
#define | CAPT_MAX_COUNT_ERROR_INTERRUPT (0x0100)
#define | CAPT_IV_NO_INTERRUPT (0x0000)
#define | CAPT_IV_END_OF_CONVERSION (0x0002)
#define | CAPT_IV_DETECTION (0x0004)
#define | CAPT_IV_TIMER (0x0006)
#define | CAPT_IV_CONVERSION_COUNTER (0x0008)
#define | CAPT_IV_MAX_COUNT_ERROR (0x000A)

## Functions
void | CAPT_init (void)
bool | CAPT_pollResetStatus (void)
bool | CAPT_pollCIPF (void)
void | CAPT_reset (void)
void | CAPT_setStabilization (void)
void | CAPT_releaseStabilization (void)
void | CAPT_enableRefCap (tElement *pElement, uint8_t capSize)
void | CAPT_disableRefCap (void)
void | CAPT_enableSensorIO (tSensor *pSensor)
void | CAPT_disableSensorIO (tSensor *pSensor)
void | CAPT_initSensorIO (tSensor *pSensor)
void | CAPT_forceSensorIO (tSenseTechnology rxBarTx, tSensor *pSensor)
void | CAPT_applySensorParams (tSensor *pSensor)
void | CAPT_enableSensorSyncEvent (void)
void | CAPT_disableSensorSyncEvent (void)
void | CAPT_bypassFSM (void)
void | CAPT_engageFSM (void)
void | CAPT_applySensorFreq (uint8_t freqSelect, tSensor *pSensor)
void | CAPT_setCycleIO (tSensor *pSensor, tCycle *pCycle)
void | CAPT_clearCycleIO (tSensor *pSensor, tCycle *pCycle)
void | CAPT_applyCycleComp (uint8_t freqOffset, tCycle *pCycle)
void | CAPT_applyCycleFSM (tCycle *pCycle)
void | CAPT_enableISR (uint16_t interruptEnable)
void | CAPT_disableISR (uint16_t interruptDisable)
void | CAPT_setCAPSTART (void)
void | CAPT_clearCAPSTART (void)
void | CAPT_saveCycleRawResults (uint8_t indexFreq, tSensor *pSensor, tCycle *pCycle)
void | CAPT_saveCycleResults (tSensor *pSensor, tCycle *pCycle)
void | CAPT_selectCCounterInterval (uint8_t counterSel)
void | CAPT_clearCCounter (void)
void | CAPT_startCCounter (void)
void | CAPT_stopCCounter (void)
void | CAPT_selectTimerSourceDivider (uint8_t sourceDiv)
void | CAPT_selectTimerSource (uint8_t source)
void | CAPT_enableTimerTrigMeasurement (void)
void | CAPT_disableTimerTrigMeasurement (void)
void | CAPT_clearTimer (void)
void | CAPT_startTimer (void)
void | CAPT_stopTimer (void)
uint16_t | CAPT_readTimerRegister (void)
uint16_t | CAPT_readTimerCompRegister (void)
void | CAPT_writeTimerCompRegister (uint16_t compRegister)
void | CAPT_powerOff (void)
void | CAPT_powerOn (void)
void | CAPT_setChannelActive (uint8_t ui8Block, uint8_t ui8Pin)
void | CAPT_setChannelEnable (uint8_t ui8Block, uint8_t ui8Pin)
void | CAPT_setChannelOffState (uint8_t ui8Block, uint8_t ui8Pin)
void | CAPT_setChannelOnState (uint8_t ui8Block, uint8_t ui8Pin)
void | CAPT_clearChannelActive (uint8_t ui8Block, uint8_t ui8Pin)
void | CAPT_clearChannelEnable (uint8_t ui8Block, uint8_t ui8Pin)
void | CAPT_clearChannelOffState (uint8_t ui8Block, uint8_t ui8Pin)
void | CAPT_clearChannelOnState (uint8_t ui8Block, uint8_t ui8Pin)
void | CAPT_writeCoarseGain (uint8_t ui8Block, uint8_t ui8Value)
uint8_t | CAPT_readCoarseGain (uint8_t ui8Block)
void | CAPT_writeFineGain (uint8_t ui8Block, uint8_t ui8Value)
uint8_t | CAPT_readFineGain (uint8_t ui8Block)
void | CAPT_writeOffsetTap (uint8_t ui8Block, uint16_t ui16Value)
uint16_t | CAPT_readOffsetTap (uint8_t ui8Block)
uint16_t | CAPT_readConversion (uint8_t ui8Block)
void | CAPT_setCAPLPMCFG (void)
void | CAPT_clearCAPLPMCFG (void)
uint16_t | CAPT_pollIFG (uint16_t ui16InterruptMask)
void | CAPT_clearIFG (uint16_t ui16InterruptMask)
uint16_t | CAPT_getInterruptVector (void)
void | CAPT_enableShieldIO (uint8_t ui8Block, uint8_t ui8Pin)
void | CAPT_disableShieldIO (uint8_t ui8Block, uint8_t ui8Pin)

## Detailed Description

Low level CapTIvate configuration and peripheral hardware abstraction module.

This module contains low-level APIs for accessing the CapTIvate™ IP. Some functions are a direct access of the CapTIvate™ registers while others take the definitions (see CAPT_Type.h) and place the appropriate values in the CapTIvate™ peripheral registers.

Version
  VERSION Released on RELEASE_DATE

## Macro Definition Documentation

## § CAPT_TIMER_SRC_ACLK

#define CAPT_TIMER_SRC_ACLK (0x00)

## § CAPT_TIMER_SRC_VLOCLK

#define CAPT_TIMER_SRC_VLOCLK (0x01)

## § CAPT_TIMER_CLKDIV__1

#define CAPT_TIMER_CLKDIV__1 (0x00)

## § CAPT_TIMER_CLKDIV__2

#define CAPT_TIMER_CLKDIV__2 (0x01)

## § CAPT_TIMER_CLKDIV__4

#define CAPT_TIMER_CLKDIV__4 (0x02)

## § CAPT_TIMER_CLKDIV__8

#define CAPT_TIMER_CLKDIV__8 (0x03)

## § CAPT_TIMER_CLKDIV__16

#define CAPT_TIMER_CLKDIV__16 (0x04)

## § CAPT_TIMER_CLKDIV__32

#define CAPT_TIMER_CLKDIV__32 (0x05)

## § CAPT_TIMER_CLKDIV__64

#define CAPT_TIMER_CLKDIV__64 (0x06)

## § CAPT_TIMER_CLKDIV__128

#define CAPT_TIMER_CLKDIV__128 (0x07)

## § CAPT_COUNTER__16

#define CAPT_COUNTER__16 (0x00)

## § CAPT_COUNTER__32

#define CAPT_COUNTER__32 (0x01)

## § CAPT_COUNTER__64

#define CAPT_COUNTER__64 (0x02)

## § CAPT_COUNTER__128

#define CAPT_COUNTER__128 (0x03)

## § CAPT_COUNTER__256

#define CAPT_COUNTER__256 (0x04)

## § CAPT_COUNTER__512

#define CAPT_COUNTER__512 (0x05)

## § CAPT_COUNTER__1024

#define CAPT_COUNTER__1024 (0x06)

## § CAPT_COUNTER__2048

#define CAPT_COUNTER__2048 (0x07)

## § CAPT_COUNTER__DISABLED

#define CAPT_COUNTER__DISABLED (0x08)

## § CAPT_OSC_FREQ_DEFAULT

#define CAPT_OSC_FREQ_DEFAULT (0x00)

## § CAPT_OSC_FREQ_16MHZ

#define CAPT_OSC_FREQ_16MHZ (0x00)

## § CAPT_OSC_FREQ_14P7MHZ

#define CAPT_OSC_FREQ_14P7MHZ (0x01)

## § CAPT_OSC_FREQ_13P1MHZ

#define CAPT_OSC_FREQ_13P1MHZ (0x02)

## § CAPT_OSC_FREQ_11P2MHZ

#define CAPT_OSC_FREQ_11P2MHZ (0x03)

## § CAPT_REFERENCE_CAP__SELF_1P0PF

#define CAPT_REFERENCE_CAP__SELF_1P0PF (0x00)

## § CAPT_REFERENCE_CAP__SELF_1P1PF

#define CAPT_REFERENCE_CAP__SELF_1P1PF (0x04)

## § CAPT_REFERENCE_CAP__SELF_1P5PF

#define CAPT_REFERENCE_CAP__SELF_1P5PF (0x05)

## § CAPT_REFERENCE_CAP__SELF_5P0PF

#define CAPT_REFERENCE_CAP__SELF_5P0PF (0x02)

## § CAPT_REFERENCE_CAP__SELF_5P1PF

#define CAPT_REFERENCE_CAP__SELF_5P1PF (0x06)

## § CAPT_REFERENCE_CAP__SELF_5P5PF

#define CAPT_REFERENCE_CAP__SELF_5P5PF (0x07)

## § CAPT_REFERENCE_CAP__MUTUAL_0P1PFM_1P0PF

#define CAPT_REFERENCE_CAP__MUTUAL_0P1PFM_1P0PF (0x00)

## § CAPT_REFERENCE_CAP__MUTUAL_0P5PFM_1P0PF

#define CAPT_REFERENCE_CAP__MUTUAL_0P5PFM_1P0PF (0x01)

## § CAPT_REFERENCE_CAP__MUTUAL_0P1PFM_5P0PF

#define CAPT_REFERENCE_CAP__MUTUAL_0P1PFM_5P0PF (0x02)

## § CAPT_REFERENCE_CAP__MUTUAL_0P5PFM_5P0PF

#define CAPT_REFERENCE_CAP__MUTUAL_0P5PFM_5P0PF (0x03)

## § CAPT_COARSEGAIN_0

#define CAPT_COARSEGAIN_0 (0x00)

## § CAPT_COARSEGAIN_1

#define CAPT_COARSEGAIN_1 (0x01)

## § CAPT_COARSEGAIN_2

#define CAPT_COARSEGAIN_2 (0x02)

## § CAPT_COARSEGAIN_3

#define CAPT_COARSEGAIN_3 (0x03)

## § CAPT_COARSEGAIN_4

#define CAPT_COARSEGAIN_4 (0x04)

## § CAPT_COARSEGAIN_5

#define CAPT_COARSEGAIN_5 (0x05)

## § CAPT_COARSEGAIN_6

#define CAPT_COARSEGAIN_6 (0x06)

## § CAPT_COARSEGAIN_7

#define CAPT_COARSEGAIN_7 (0x07)

## § CAPT_COARSEGAIN_MIN

#define CAPT_COARSEGAIN_MIN (CAPT_COARSEGAIN_0)

## § CAPT_COARSEGAIN_MAX

#define CAPT_COARSEGAIN_MAX (CAPT_COARSEGAIN_7)

## § CAPT_FINEGAIN_0

#define CAPT_FINEGAIN_0 (0x00)

## § CAPT_FINEGAIN_1

#define CAPT_FINEGAIN_1 (0x01)

## § CAPT_FINEGAIN_2

#define CAPT_FINEGAIN_2 (0x02)

## § CAPT_FINEGAIN_3

#define CAPT_FINEGAIN_3 (0x03)

## § CAPT_FINEGAIN_4

#define CAPT_FINEGAIN_4 (0x04)

## § CAPT_FINEGAIN_5

#define CAPT_FINEGAIN_5 (0x05)

## § CAPT_FINEGAIN_6

#define CAPT_FINEGAIN_6 (0x06)

## § CAPT_FINEGAIN_7

#define CAPT_FINEGAIN_7 (0x07)

## § CAPT_FINEGAIN_8

#define CAPT_FINEGAIN_8 (0x08)

## § CAPT_FINEGAIN_9

#define CAPT_FINEGAIN_9 (0x09)

## § CAPT_FINEGAIN_10

#define CAPT_FINEGAIN_10 (0x0A)

## § CAPT_FINEGAIN_11

#define CAPT_FINEGAIN_11 (0x0B)

## § CAPT_FINEGAIN_12

#define CAPT_FINEGAIN_12 (0x0C)

## § CAPT_FINEGAIN_13

#define CAPT_FINEGAIN_13 (0x0D)

## § CAPT_FINEGAIN_14

#define CAPT_FINEGAIN_14 (0x0E)

## § CAPT_FINEGAIN_15

#define CAPT_FINEGAIN_15 (0x0F)

## § CAPT_FINEGAIN_16

#define CAPT_FINEGAIN_16 (0x10)

## § CAPT_FINEGAIN_17

#define CAPT_FINEGAIN_17 (0x11)

## § CAPT_FINEGAIN_18

#define CAPT_FINEGAIN_18 (0x12)

## § CAPT_FINEGAIN_19

#define CAPT_FINEGAIN_19 (0x13)

## § CAPT_FINEGAIN_MIN

#define CAPT_FINEGAIN_MIN (CAPT_FINEGAIN_0)

## § CAPT_FINEGAIN_MAX

#define CAPT_FINEGAIN_MAX (CAPT_FINEGAIN_19)

## § CAPT_OFFSETTAP_MIN

#define CAPT_OFFSETTAP_MIN (0x00)

## § CAPT_OFFSETTAP_MAX

#define CAPT_OFFSETTAP_MAX (0xFF)

## § CAPT_OFFSETSCALE__VERYSMALL

#define CAPT_OFFSETSCALE__VERYSMALL (0x0000)

## § CAPT_OFFSETSCALE__SMALL

#define CAPT_OFFSETSCALE__SMALL (0x0100)

## § CAPT_OFFSETSCALE__LARGE

#define CAPT_OFFSETSCALE__LARGE (0x0200)

## § CAPT_OFFSETSCALE__VERYLARGE

#define CAPT_OFFSETSCALE__VERYLARGE (0x0300)

## § CAPT_OFFSETSCALE_MIN

#define CAPT_OFFSETSCALE_MIN (CAPT_OFFSETSCALE__VERYSMALL)

## § CAPT_OFFSETSCALE_MAX

#define CAPT_OFFSETSCALE_MAX (CAPT_OFFSETSCALE__VERYLARGE)

## § CAPT_END_OF_CONVERSION_INTERRUPT

#define CAPT_END_OF_CONVERSION_INTERRUPT (0x0001)

## § CAPT_DETECTION_INTERRUPT

#define CAPT_DETECTION_INTERRUPT (0x0002)

## § CAPT_TIMER_INTERRUPT

#define CAPT_TIMER_INTERRUPT (0x0004)

## § CAPT_CONVERSION_COUNTER_INTERRUPT

#define CAPT_CONVERSION_COUNTER_INTERRUPT (0x0008)

## § CAPT_MAX_COUNT_ERROR_INTERRUPT

#define CAPT_MAX_COUNT_ERROR_INTERRUPT (0x0100)

## § CAPT_IV_NO_INTERRUPT

#define CAPT_IV_NO_INTERRUPT (0x0000)

## § CAPT_IV_END_OF_CONVERSION

#define CAPT_IV_END_OF_CONVERSION (0x0002)

Referenced by CAPT_ISR().

## § CAPT_IV_DETECTION

#define CAPT_IV_DETECTION (0x0004)

Referenced by CAPT_ISR().

## § CAPT_IV_TIMER

#define CAPT_IV_TIMER (0x0006)

Referenced by CAPT_ISR().

## § CAPT_IV_CONVERSION_COUNTER

#define CAPT_IV_CONVERSION_COUNTER (0x0008)

Referenced by CAPT_ISR().

## § CAPT_IV_MAX_COUNT_ERROR

#define CAPT_IV_MAX_COUNT_ERROR (0x000A)

Referenced by CAPT_ISR().

## Function Documentation

## § CAPT_init()

void CAPT_init | ( | void |  | ) |

CAPT_init is not a ROM function. This function initializes global parameters of the CapTIvate peripheral that are independent of mode and application. This function should always be called once to initialize the peripheral after a reset.Initialize global settings for an application.

Parameters
  none

Returns
  none

Referenced by CAPT_initUI().

## § CAPT_pollResetStatus()

bool CAPT_pollResetStatus | ( | void |  | ) |

Poll Reset Status Flag of the CapTIvate peripheral; 0, reset is not complete. This function is intended to be used after the CAPT_reset() function to determine that the peripheral is ready.

Parameters
  none

Returns
  Reset State

## § CAPT_pollCIPF()

bool CAPT_pollCIPF | ( | void |  | ) |

Poll Conversion in progress flag (CIPF); 0, no conversion in progress. The CIPF is not directly correlated to the conversion start: following a conversion start there is a period during which the CIPF is 0 before transitioning to a 1 when the actual convesion takes place.

Parameters
  none

Returns
  CIPF state

## § CAPT_reset()

void CAPT_reset | ( | void |  | ) |

Reset the CapTIvate peripheral.

Parameters
  none

Returns
  none

## § CAPT_setStabilization()

void CAPT_setStabilization | ( | void |  | ) |

Set Stabilization control bit. This bit is used whenever a conversion is predicated on a user controlled stabilization time. The stabilization control must be set before the conversion is started.

Parameters
  none

Returns
  none

## § CAPT_releaseStabilization()

void CAPT_releaseStabilization | ( | void |  | ) |

Clear Stabilization control bit. This bit is used whenever a conversion is predicated on a user controlled stabilization time. Although the IO will be active, clearing the stabilization control bit will start the actual measurement.

Parameters
  none

Returns
  none

## § CAPT_enableRefCap()

void CAPT_enableRefCap | ( | tElement * | pElement,
|  | uint8_t | capSize
| ) |  |

Enable a Reference cap for a specific block. The element definition, tElement.ui8RxBlock, is used to determine which block the reference capacitor is applied to. The reference capacitor size is defined in the following table: Size Self Value Mutual Value 0 1.0pF 0.1pF 1 1.0pF 0.5pF 2 5.0pF 0.1pF 3 5.0pF 0.5pF 4 1.1pF 0.1pF 5 1.5pF 0.1pF 6 5.1pF 0.1pF 7 5.5pF 0.1pF

Parameters

  pElement | = pointer to element
  capSize | = size of cap

Returns
  none

## § CAPT_disableRefCap()

void CAPT_disableRefCap | ( | void |  | ) |

Disable and Remove the Reference Capacitor from the measurement circuit.

Parameters
  none

Returns
  none

## § CAPT_enableSensorIO()

void CAPT_enableSensorIO | ( | tSensor * | pSensor | ) |

Enable all IO associated with a sensor. When a CapTIvate IO is enabled it is in the analog mode and the digital function is disabled. Before enabling the IO it is recommended to set the appropriate IO state as defined in the tSensor.bIdleState, with the CAPT_initSensorIO function.

Parameters

  pSensor | = pointer to sensor

Returns
  none

## § CAPT_disableSensorIO()

void CAPT_disableSensorIO | ( | tSensor * | pSensor | ) |

Disable all IO associated with a sensor.

Parameters

  pSensor | = pointer to sensor

Returns
  none

## § CAPT_initSensorIO()

void CAPT_initSensorIO | ( | tSensor * | pSensor | ) |

This function configures the active (Rx or Tx) and inactive (High-z or GND) states of the captivate channels, for a given sensor, as well as initialize the IO to the inactive state.

Parameters

  pSensor | = pointer to sensor

Returns
  none

## § CAPT_forceSensorIO()

void CAPT_forceSensorIO | ( | tSenseTechnology | rxBarTx,
|  | tSensor * | pSensor
| ) |  |

Set all Sensor IO to Tx or Rx based upon parameter passed. Also make these active.

Parameters

  rxBarTx | = Set to Rx if eSelf (0) or Tx if eProjected (1)
  pSensor | = pointer to sensor

Returns
  none

## § CAPT_applySensorParams()

void CAPT_applySensorParams | ( | tSensor * | pSensor | ) |

Initialize Sensor specific settings that will remain constant for all cycles within the Sensor. Parameters Applied: tSensor.SensingMethod tSensor.DirectionOfInterest tSensor.ui16NegativeTouchThreshold tSensor.ui16ProxThreshold tSensor.bModEnable tSensor.ui8BiasControl tSensor.bCsDischarge tSensor.bLPMControl tSensor.ui8InputSyncControl tSensor.bTimerSyncControl tSensor.ui8ChargeLength tSensor.ui8TransferLength tSensor.ui16ErrorThreshold tSensor.ui8CntBeta tSensor.ui8LTABeta tSensor.bSensorHalt tSensor.bPTSensorHalt tSensor.bSensorTouch tSensor.bSensorProx

Parameters

  pSensor | = pointer to sensor

Returns
  none

## § CAPT_enableSensorSyncEvent()

void CAPT_enableSensorSyncEvent | ( | void |  | ) |

Enable Sync event. When enabled the start of conversion is gated by the edge of the SYNC pin.

Parameters
  none

Returns
  none

## § CAPT_disableSensorSyncEvent()

void CAPT_disableSensorSyncEvent | ( | void |  | ) |

Disable Sync event.

Parameters
  none

Returns
  none

## § CAPT_bypassFSM()

void CAPT_bypassFSM | ( | void |  | ) |

Bypass FSM. Bypassing the FSM only the maximum count and end of conversion IFGs are updated.

Parameters
  none

Returns
  none.

## § CAPT_engageFSM()

void CAPT_engageFSM | ( | void |  | ) |

Engage FSM. The Finite State Machine (FSM), performs several post measurement filters for the LTA, and measurement filter count as well as well as detection logic.

Parameters
  none

Returns
  none

## § CAPT_applySensorFreq()

void CAPT_applySensorFreq | ( | uint8_t | freqSelect,
|  | tSensor * | pSensor
| ) |  |

Apply the Sensor frequency divider and for the requested frequency select. This frequency is consistent for all elements within the cycle. freqSelect Frequency 0 16Mhz 1 14.7Mhz 2 13.1Mhz 3 11.2Mhz

Parameters

  freqSelect | = frequency
  pSensor | = pointer to sensor

Returns
  none

## § CAPT_setCycleIO()

void CAPT_setCycleIO | ( | tSensor * | pSensor,
|  | tCycle * | pCycle
| ) |  |

Initialize cycle IO parameters. Set to active the channels required for the cycle measurement. The peripheral will manage the IO state transitioning the active channels between the defined active state (Rx or Tx) when actively measuring capacitance and the inactive state (GND or High-Z) when the measurement is complete. All channels that are not active but enabled will remain in their inactive state.

Parameters

  pSensor | = pointer to sensor
  pCycle | = pointer to cycle

Returns
  none

## § CAPT_clearCycleIO()

void CAPT_clearCycleIO | ( | tSensor * | pSensor,
|  | tCycle * | pCycle
| ) |  |

Clear cycle IO parameters. Clear active channels.

Parameters

  pSensor | = pointer to sensor
  pCycle | = pointer to cycle

Returns
  none

## § CAPT_applyCycleComp()

void CAPT_applyCycleComp | ( | uint8_t | freqOffset,
|  | tCycle * | pCycle
| ) |  |

Initialize cycle level parameters. These parameters are consistent for all elements within the cycle.

Parameters

  freqOffset | = offset to indicate which frequency is being measured
  pCycle | = pointer to cycle

Returns
  none

## § CAPT_applyCycleFSM()

void CAPT_applyCycleFSM | ( | tCycle * | pCycle | ) |

Apply cycle level parameters. These parameters are consistent for all elements within the cycle.

Parameters

  pCycle | = pointer to cycle

Returns
  none

## § CAPT_enableISR()

void CAPT_enableISR | ( | uint16_t | interruptEnable | ) |

Enable ISR. The interrupts are defined as follows: BIT0 End of Conversion interrupt enable BIT1 CapTIvate detection interrupt enable BIT2 CapTIvate Timer interrupt enable BIT3 CapTIvate Conversion Counter interrupt enable BIT8 CapTIvate maximum count error interrupt enable

Parameters

  interruptEnable | = Interrupt(s) to enable

Returns
  none

## § CAPT_disableISR()

void CAPT_disableISR | ( | uint16_t | interruptDisable | ) |

Disable ISR. The interrupts are defined as follows: BIT0 End of Conversion interrupt disable BIT1 CapTIvate detection interrupt disable BIT2 CapTIvate Timer interrupt disable BIT3 CapTIvate Conversion Counter interrupt disable BIT8 CapTIvate maximum count error interrupt disable

Parameters

  interruptDisable | = Interrupt(s) to disable

Returns
  none

## § CAPT_setCAPSTART()

void CAPT_setCAPSTART | ( | void |  | ) |

Set the cycle conversion bit. If the CAPPWR bit is set (call CAPT_powerOn), then setting the cycle conversion bit will start the conversion process - the actual conversion (indicated by CAPT_pollCIPF returning a '1') will take place after the stabilization time. If the SYNC enable is set, either via the sensor configuration and CAPT_applySensor API or the CAPT_enableSensorSyncEvent API, then the conversion will be gate by the SYNC event (rising/falling edge) on the SYNC pin.

Parameters
  none

Returns
  none

## § CAPT_clearCAPSTART()

void CAPT_clearCAPSTART | ( | void |  | ) |

Clear the cycle conversion bit. When the conversion is in progress, calling CAPT_clearCAPSTART will stop the conversion.

Parameters
  none

Returns
  none

## § CAPT_saveCycleRawResults()

void CAPT_saveCycleRawResults | ( | uint8_t | indexFreq,
|  | tSensor * | pSensor,
|  | tCycle * | pCycle
| ) |  |

Save the current status of the peripheral into the data structures of Raw measurement information is stored in: pCycle->pElement[n]->pRawCount[indexFreq], where n is 0 to pCycle.ui8NumberofElements If there is a maximum count error, then the bit pSensor->bMaxCountError is set and the value in pCycle->pElement[n]->pRawCount[indexFreq] is cleared.

Parameters

  indexFreq | = save results for selected frequency.
  pSensor | = pointer to sensor.
  pCycle | = pointer to cycle.

Returns
  none

## § CAPT_saveCycleResults()

void CAPT_saveCycleResults | ( | tSensor * | pSensor,
|  | tCycle * | pCycle
| ) |  |

Save filter results, pElements[n]->LTA and pElements[n]->filterCount, and status bits, pElements[n]->bDetect and pElements[n]->bNegativeTouch, in addition to what is saved in CAPT_saveCycleRawResults from the peripheral.

Parameters

  pSensor | = pointer to sensor.
  pCycle | = pointer to cycle.

Returns
  none

## § CAPT_selectCCounterInterval()

void CAPT_selectCCounterInterval | ( | uint8_t | counterSel | ) |

Select the CapTIvate™ counter interval. The input represents the number of conversions until a counter overflow event, CAPCNTRIFG. counterSel Number of Conversions 0 16 1 32 2 64 3 128 4 256 5 512 6 1024 7 2048

Parameters

  counterSel | = counter selection

Returns
  none

## § CAPT_clearCCounter()

void CAPT_clearCCounter | ( | void |  | ) |

Clear the CapTIvate™ counter interval.

Parameters
  none

Returns
  none

## § CAPT_startCCounter()

void CAPT_startCCounter | ( | void |  | ) |

Start (enable) the CapTIvate™ counter interval.

Parameters
  none

Returns
  none

## § CAPT_stopCCounter()

void CAPT_stopCCounter | ( | void |  | ) |

Stop (disable) the CapTIvate™ counter interval.

Parameters
  none

Returns
  none

## § CAPT_selectTimerSourceDivider()

void CAPT_selectTimerSourceDivider | ( | uint8_t | sourceDiv | ) |

Select the input divider to the CapTIvate™ timer.

Parameters

  sourceDiv | = time source divider

Returns
  none

## § CAPT_selectTimerSource()

void CAPT_selectTimerSource | ( | uint8_t | source | ) |

Select the input source to the CapTIvate™ timer.

Parameters

  source | = timer source selection

Returns
  none

## § CAPT_enableTimerTrigMeasurement()

void CAPT_enableTimerTrigMeasurement | ( | void |  | ) |

Enable measurements to be triggered from CapTIvate™ timer. Set CAPTCCTRL0:CAPTCONV

Parameters
  none

Returns
  none

## § CAPT_disableTimerTrigMeasurement()

void CAPT_disableTimerTrigMeasurement | ( | void |  | ) |

Disable measurements to be triggered from CapTIvate™ timer. Clear CAPTCCTRL0:CAPTCONV

Parameters
  none

Returns
  none

## § CAPT_clearTimer()

void CAPT_clearTimer | ( | void |  | ) |

Clear the CapTIvate™ timer.

Parameters
  none

Returns
  none

## § CAPT_startTimer()

void CAPT_startTimer | ( | void |  | ) |

Start (enable) the CapTIvate™ timer.

Parameters
  none

Returns
  none

## § CAPT_stopTimer()

void CAPT_stopTimer | ( | void |  | ) |

Stop (disable) the CapTIvate™ timer.

Parameters
  none

Returns
  none

## § CAPT_readTimerRegister()

uint16_t CAPT_readTimerRegister | ( | void |  | ) |

Stop (disable) the CapTIvate™ timer.

Parameters
  none

Returns
  timer contents

## § CAPT_readTimerCompRegister()

uint16_t CAPT_readTimerCompRegister | ( | void |  | ) |

Read value from timer compare register.

Parameters
  none

Returns
  Compare Register Value

## § CAPT_writeTimerCompRegister()

void CAPT_writeTimerCompRegister | ( | uint16_t | compRegister | ) |

Write value into timer compare register.

Parameters

  compRegister | = Compare Register Value

Returns
  none

## § CAPT_powerOff()

void CAPT_powerOff | ( | void |  | ) |

Turn off the CapTIvate™ IP.

Parameters
  none

Returns
  Compare Register Value

## § CAPT_powerOn()

void CAPT_powerOn | ( | void |  | ) |

Turn on the CapTIvate™ IP.

Parameters
  none

Returns
  Compare Register Value

## § CAPT_setChannelActive()

void CAPT_setChannelActive | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Activate specific IO channel, CAPx.y, ui8Block-> x, ui8Pin->y. When a conversion is started then this IO will enter either a Tx or Rx mode of operation.

Parameters

  ui8Block | = select block
  ui8Pin | = select pin

Returns
  none

## § CAPT_setChannelEnable()

void CAPT_setChannelEnable | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Enable a specific IO channel, CAPx.y, ui8Block-> x, ui8Pin->y.

Parameters

  ui8Block | = select block
  ui8Pin | = select pin

Returns
  none

## § CAPT_setChannelOffState()

void CAPT_setChannelOffState | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Set off state for specific IO channel, CAPx.y, ui8Block-> x, ui8Pin->y. This puts the IO into the Ground state when enabled and not active.

Parameters

  ui8Block | = select block
  ui8Pin | = select pin

Returns
  none

## § CAPT_setChannelOnState()

void CAPT_setChannelOnState | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Set on state for specific IO channel, CAPx.y, ui8Block-> x, ui8Pin->y. This puts the IO into the Rx mode. The mode, mutual or self, is defined by the sensor parameter tSensor.SensingMethod and applied by API CAPT_apply_SensorParams. The default setting for the block is self mode.

Parameters

  ui8Block | = select block
  ui8Pin | = select pin

Returns
  none

## § CAPT_clearChannelActive()

void CAPT_clearChannelActive | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Activate a specific IO channel, CAPx.y, ui8Block-> x, ui8Pin->y.

Parameters

  ui8Block | = select block
  ui8Pin | = select pin

Returns
  none

## § CAPT_clearChannelEnable()

void CAPT_clearChannelEnable | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Enable a specific IO channel, CAPx.y, ui8Block-> x, ui8Pin->y.

Parameters

  ui8Block | = select block
  ui8Pin | = select pin

Returns
  none

## § CAPT_clearChannelOffState()

void CAPT_clearChannelOffState | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Clear off state for specific IO channel, CAPx.y, ui8Block-> x, ui8Pin->y.

Parameters

  ui8Block | = select block
  ui8Pin | = select pin

Returns
  none

## § CAPT_clearChannelOnState()

void CAPT_clearChannelOnState | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Set on state for specific IO channel, CAPx.y, ui8Block-> x, ui8Pin->y.

Parameters

  ui8Block | = select block
  ui8Pin | = select pin

Returns
  none

## § CAPT_writeCoarseGain()

void CAPT_writeCoarseGain | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Value
| ) |  |

Write Coarse Gain value to Block Compensation.

Parameters

  ui8Block | = select block
  ui8Value | = value

Returns
  none

## § CAPT_readCoarseGain()

uint8_t CAPT_readCoarseGain | ( | uint8_t | ui8Block | ) |

Read Coarse Gain value from Block Compensation.

Parameters

  ui8Block | = select block

Returns
  8-bit coarse gain value

## § CAPT_writeFineGain()

void CAPT_writeFineGain | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Value
| ) |  |

Write Fine Gain value to Block Compensation.

Parameters

  ui8Block | = select block
  ui8Value | = value

Returns
  none

## § CAPT_readFineGain()

uint8_t CAPT_readFineGain | ( | uint8_t | ui8Block | ) |

Read Fine Gain value from Block Compensation.

Parameters

  ui8Block | = select block

Returns
  8-bit fine gain value

## § CAPT_writeOffsetTap()

void CAPT_writeOffsetTap | ( | uint8_t | ui8Block,
|  | uint16_t | ui16Value
| ) |  |

Write Offset Tap value to Block Compensation.

Parameters

  ui8Block | = select block
  ui16Value | = offsetvalue

Returns
  none

## § CAPT_readOffsetTap()

uint16_t CAPT_readOffsetTap | ( | uint8_t | ui8Block | ) |

Read Offset Tap value from Block Compensation.

Parameters

  ui8Block | = select block

Returns
  16-bit offset tap value

## § CAPT_readConversion()

uint16_t CAPT_readConversion | ( | uint8_t | ui8Block | ) |

Read Conversion value from Block.

Parameters

  ui8Block | = select block

Returns
  16-bit conversion value

## § CAPT_setCAPLPMCFG()

void CAPT_setCAPLPMCFG | ( | void |  | ) |

Set CAPLPMCFG.

Parameters
  none

Returns
  none

## § CAPT_clearCAPLPMCFG()

void CAPT_clearCAPLPMCFG | ( | void |  | ) |

Clear CAPLPMCFG.

Parameters
  none

Returns
  none

## § CAPT_pollIFG()

uint16_t CAPT_pollIFG | ( | uint16_t | ui16InterruptMask | ) |

Poll a CapTIvate™ peripheral interrupt flag.

Parameters

  ui16InterruptMask | is a bit mask of the interrupts to test.

Returns
  interrupt flags that are set

## § CAPT_clearIFG()

void CAPT_clearIFG | ( | uint16_t | ui16InterruptMask | ) |

Clear a Captivate peripheral interrupt flag. The bit mask is defined as: BIT0 -> End Of Conversion IFG BIT1 -> Detection IFG BIT2 -> CapTIvate Timer IFG (number of clock cycles) BIT3 -> CapTIvate Counter IFG (number of conversion cycles)

BIT8 -> Maximum Count Error IFG

Parameters

  ui16InterruptMask | is a bit mask of the interrupt flags to clear.

Returns
  none.

## § CAPT_getInterruptVector()

uint16_t CAPT_getInterruptVector | ( | void |  | ) |

Retreive the CapTIvate™ peripheral interrupt vector register

Parameters

  none. |

Returns
  current value of the CapTIvate™ IV register.

Referenced by CAPT_ISR().

## § CAPT_enableShieldIO()

void CAPT_enableShieldIO | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Enable a CapTIvate IO to be a shield.

Parameters

  ui8Block | is the CapTIvate block that the shield resides on.
  ui8Pin | is the pin on the block that the shield is connected to.

Returns
  None.

## § CAPT_disableShieldIO()

void CAPT_disableShieldIO | ( | uint8_t | ui8Block,
|  | uint8_t | ui8Pin
| ) |  |

Disable a CapTIvate shield IO.

Parameters

  ui8Block | is the CapTIvate block that the shield resides on.
  ui8Pin | is the pin on the block that the shield is connected to.

Returns
  None.

© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale