inc/ad7147.h File Reference

This file contains macros, enums, and declarations required in AD7147 Touchcap Nuggets for Init, touch get, touch event get and Release functionalities. More...

This graph shows which files directly or indirectly include this file:


Data Structures

struct  tcapAD7147_t
 tcapAD7147_t More...

Defines

#define AD7147_REG_PWR_CONTROL   0x000
#define AD7147_REG_STAGE_CAL_EN   0x001
#define AD7147_REG_AMB_COMP_CTRL0   0x002
#define AD7147_REG_AMB_COMP_CTRL1   0x003
#define AD7147_REG_AMB_COMP_CTRL2   0x004
#define AD7147_REG_STAGE_LOW_INT_ENABLE   0x005
#define AD7147_REG_STAGE_HIGH_INT_ENABLE   0x006
#define AD7147_REG_STAGE_COMPLETE_INT_ENABLE   0x007
#define AD7147_REG_STAGE_LOW_INT_STATUS   0x008
#define AD7147_REG_STAGE_HIGH_INT_STATUS   0x009
#define AD7147_REG_STAGE_COMPLETE_INT_STATUS   0x00A
#define AD7147_REG_CDC_RESULT_S0   0x00B
#define AD7147_REG_CDC_RESULT_S1   0x00C
#define AD7147_REG_CDC_RESULT_S2   0x00D
#define AD7147_REG_CDC_RESULT_S3   0x00E
#define AD7147_REG_CDC_RESULT_S4   0x00F
#define AD7147_REG_CDC_RESULT_S5   0x010
#define AD7147_REG_CDC_RESULT_S6   0x011
#define AD7147_REG_CDC_RESULT_S7   0x012
#define AD7147_REG_CDC_RESULT_S8   0x013
#define AD7147_REG_CDC_RESULT_S9   0x014
#define AD7147_REG_CDC_RESULT_S10   0x015
#define AD7147_REG_CDC_RESULT_S11   0x016
#define AD7147_REG_DEV_ID   0x017
#define AD7147_REG_PROXIMITY_STATUS   0x042
#define AD7147_REG_STAGEx_CONNECTION1(x)   ((int)(0x080 + x * 8))
#define AD7147_REG_STAGEx_CONNECTION2(x)   ((int)(0x081 + x * 8))
#define AD7147_REG_STAGEx_AFE_OFFSET(x)   ((int)(0x082 + x * 8))
#define AD7147_REG_STAGEx_SENSITIVITY(x)   ((int)(0x083 + x * 8))
#define AD7147_REG_STAGEx_OFFSET_LOW(x)   ((int)(0x084 + x * 8))
#define AD7147_REG_STAGEx_OFFSET_HIGH(x)   ((int)(0x085 + x * 8))
#define AD7147_REG_STAGEx_OFFSET_HIGH_CLAMP(x)   ((int)(0x086 + x * 8))
#define AD7147_REG_STAGEx_OFFSET_LOW_CLAMP(x)   ((int)(0x087 + x * 8))
#define AD7147_SHIFT_POWER_MODE   0
#define AD7147_SHIFT_LP_CONV_DELAY   2
#define AD7147_SHIFT_SEQUENCE_STAGE_NUM   4
#define AD7147_SHIFT_DECIMATION   8
#define AD7147_SHIFT_SW_RESET   10
#define AD7147_SHIFT_NT_POL   11
#define AD7147_SHIFT_EXT_SOURCE   12
#define AD7147_SHIFT_CDC_BIAS   14
#define AD7147_SHIFT_STAGEx   x
#define AD7147_SHIFT_AVG_FP_SKIP   12
#define AD7147_SHIFT_AVG_LP_SKIP   14
#define AD7147_SHIFT_FF_SKIP_CNT   0
#define AD7147_SHIFT_FP_PROXIMITY_CNT   4
#define AD7147_SHIFT_LP_PROXIMITY_CNT   8
#define AD7147_SHIFT_PWR_DOWN_TIMEOUT   12
#define AD7147_SHIFT_FORCED_CAL   14
#define AD7147_SHIFT_CONV_RESET   15
#define AD7147_SHIFT_PROXIMITY_RECAL_LVL   0
#define AD7147_SHIFT_PROXIMITY_DETECTION_RATE   8
#define AD7147_SHIFT_SLOW_FILTER_UPDATE_LVL   14
#define AD7147_SHIFT_FP_PROXIMITY_RECAL
#define AD7147_SHIFT_LP_PROXIMITY_RECAL
#define AD7147_SHIFT_GPIO_SETUP   12
#define AD7147_SHIFT_GPIO_INPUT_CONFIG   14
#define AD7147_SHIFT_GPIO_INT   12
#define AD7147_SHIFT_CINx_CONNECTION_SETUP(x)   ((int)(x<7?x*2:(x-7)*2))
#define AD7147_SHIFT_SE_CONNECTION_SETUP   12
#define AD7147_SHIFT_NEG_AFE_OFFSET_DISABLE   14
#define AD7147_SHIFT_POS_AFE_OFFSET_DISABLE   15
#define AD7147_SHIFT_NEG_AFE_OFFSET   0
#define AD7147_SHIFT_NEG_AFE_OFFSET_SWAP   7
#define AD7147_SHIFT_POS_AFE_OFFSET   8
#define AD7147_SHIFT_POS_AFE_OFFSET_SWAP   15
#define AD7147_SHIFT_NEG_THRESHOLD_SENSITIVITY   0
#define AD7147_SHIFT_NEG_PEAK_DETECT   4
#define AD7147_SHIFT_POS_THRESHOLD_SENSITIVITY   8
#define AD7147_SHIFT_POS_PEAK_DETECT   12
#define TLL7UIQ35_TCAP_PB1   0x0001
#define TLL7UIQ35_TCAP_PB2   0x0002
#define TLL7UIQ35_TCAP_PB3   0x0004
#define TLL7UIQ35_TCAP_PB4   0x0008
#define TLL7UIQ35_TCAP_WHEEL_0   0x0010
#define TLL7UIQ35_TCAP_WHEEL_1   0x0020
#define TLL7UIQ35_TCAP_WHEEL_2   0x0040
#define TLL7UIQ35_TCAP_WHEEL_3   0x0080
#define TLL7UIQ35_TCAP_WHEEL_4   0x0100
#define TLL7UIQ35_TCAP_WHEEL_5   0x0200
#define TLL7UIQ35_TCAP_WHEEL_6   0x0400
#define TLL7UIQ35_TCAP_WHEEL_7   0x0800
#define TLL7UIQ35_TCAP_PB5   0x1000
#define TLL7UIQ35_TCAP_PB1_CIN   0
#define TLL7UIQ35_TCAP_PB2_CIN   1
#define TLL7UIQ35_TCAP_PB3_CIN   2
#define TLL7UIQ35_TCAP_PB4_CIN   3
#define TLL7UIQ35_TCAP_PB5_CIN   12
#define TLL7UIQ35_TCAP_WHEEL_0_CIN   4
#define TLL7UIQ35_TCAP_WHEEL_1_CIN   5
#define TLL7UIQ35_TCAP_WHEEL_2_CIN   6
#define TLL7UIQ35_TCAP_WHEEL_3_CIN   7
#define TLL7UIQ35_TCAP_WHEEL_4_CIN   8
#define TLL7UIQ35_TCAP_WHEEL_5_CIN   9
#define TLL7UIQ35_TCAP_WHEEL_6_CIN   10
#define TLL7UIQ35_TCAP_WHEEL_7_CIN   11
#define TLL7UIQ35_SHIFT_TCAP_PB1_CIN   0
#define TLL7UIQ35_SHIFT_TCAP_PB2_CIN   2
#define TLL7UIQ35_SHIFT_TCAP_PB3_CIN   4
#define TLL7UIQ35_SHIFT_TCAP_PB4_CIN   6
#define TLL7UIQ35_SHIFT_TCAP_PB5_CIN   10
#define TLL7UIQ35_SHIFT_TCAP_WHEEL_0_CIN   8
#define TLL7UIQ35_SHIFT_TCAP_WHEEL_1_CIN   10
#define TLL7UIQ35_SHIFT_TCAP_WHEEL_2_CIN   12
#define TLL7UIQ35_SHIFT_TCAP_WHEEL_3_CIN   0
#define TLL7UIQ35_SHIFT_TCAP_WHEEL_4_CIN   2
#define TLL7UIQ35_SHIFT_TCAP_WHEEL_5_CIN   4
#define TLL7UIQ35_SHIFT_TCAP_WHEEL_6_CIN   6
#define TLL7UIQ35_SHIFT_TCAP_WHEEL_7_CIN   8
#define AD7147_NUM_BANK2_REG   96
#define AD7147_NUM_BUTTONS   13
#define AD7147_BUTTON_NAME_MAX_LEN   20

Enumerations

enum  tcapAD7147_powerMode { Pmode_full = 0, Pmode_low = 2, Pmode_shutdown = 1 }
enum  tcapAD7147_lowPowerConversionDelay { LPConvDelay_200ms = 0, LPConvDelay_400ms = 1, LPConvDelay_600ms = 2, LPConvDelay_800ms = 3 }
enum  tcapAD7147_decimation { Decimation_256 = 0, Decimation_128 = 1, Decimation_64 = 2 }
enum  tcapAD7147_CDCBais { CDBais_normal = 0, CDBais_20percent = 1, CDBais_35percent = 2, CDBais_50percent = 3 }
enum  tcapAD7147_averageFPSkip { FPSkip_3 = 0, FPSkip_7 = 1, FPSkip_15 = 2, FPSkip_31 = 3 }
enum  tcapAD7147_averageLPSkip { LPSkip_0 = 0, LPSkip_1 = 1, LPSkip_2 = 2, LPSkip_3 = 3 }
enum  tcapAD7147_CINConnectionSetup { CIN_notConnected = 0, CIN_positive = 2, CIN_negative = 1, CIN_BIAS = 3 }
enum  tcapAD7147_SEConnectionSetup { SE_doNotUse = 0, SE_positive = 1, SE_negative = 2, SE_differential = 3 }

Functions

int tcapAD7147_Init (tcapAD7147_t *state, unsigned char slaveAddress, enum tcapAD7147_powerMode powerMode)
 tcapAD7147_Init This functions initializes the device with default values provided.
int tcapAD7147_touchGet (tcapAD7147_t *state)
 tcapAD7147_touchGet This function reads (no wait) the values of the buttons and updates the state variable.
int tcapAD7147_touchEventGet (tcapAD7147_t *state)
 tcapAD7147_touchEventGet This function busy waits till there is a change in the state of the touch cap buttons and then reports back the values of the buttons and the buttons which has caused the change in state of the touch cap.
int tcapAD7147_release (tcapAD7147_t *state)
 tcapAD7147_Release This functions switches off the device.

Detailed Description

This file contains macros, enums, and declarations required in AD7147 Touchcap Nuggets for Init, touch get, touch event get and Release functionalities.

The functions are as follows:

User Exposed Functions:

tcapAD7147_Init tcapAD7147_touchGet tcapAD7147_touchEventGet tcapAD7147_Release

Data Structures:

tcapAD7147_t : state structure

Enums:

tcapAD7147_powerMode : Power modes for the device tcapAD7147_lowPowerConversionDelay : The Low power conversion delay tcapAD7147_decimation : The deciamtion tcapAD7147_CDCBais : CDC Bais percentage tcapAD7147_averageFPSkip : Average samples to skip in full power mode tcapAD7147_averageLPSkip : Average samples to skip in low power mode tcapAD7147_CINConnectionSetup : CIN connection setup tcapAD7147_SEConnectionSetup : Stage connection setup

Version:
1.2
Date:
20120404
Author:
Karthikeyan. G.A.
XqJv Copyright(c) 2010-2012 The Learning Labs,Inc. All Rights Reserved jVkB

Organization: The Learning Labs

Tested: Compiler bfin-elf-gcc; Output format Bare Metal Elf; Target TLL6527M V1.2

Revised: 20120405, Author: Karthikeyan. G.A.: Cleaned up, modified boiler plate

Revised: 20120404, Author: Karthikeyan. G.A., Notes: Added the support for the eventGet to report touch and release events.

Created: 20120317, Author: Karthikeyan. G.A., Notes: Created the Initial Version

References:

1. AD7147 CapTouch Programmable Controller for Single-Electrode Capacitance Sensors datasheet Rev. D


Define Documentation

#define AD7147_BUTTON_NAME_MAX_LEN   20

#define AD7147_NUM_BANK2_REG   96

#define AD7147_NUM_BUTTONS   13

#define AD7147_REG_AMB_COMP_CTRL0   0x002

#define AD7147_REG_AMB_COMP_CTRL1   0x003

#define AD7147_REG_AMB_COMP_CTRL2   0x004

#define AD7147_REG_CDC_RESULT_S0   0x00B

#define AD7147_REG_CDC_RESULT_S1   0x00C

#define AD7147_REG_CDC_RESULT_S10   0x015

#define AD7147_REG_CDC_RESULT_S11   0x016

#define AD7147_REG_CDC_RESULT_S2   0x00D

#define AD7147_REG_CDC_RESULT_S3   0x00E

#define AD7147_REG_CDC_RESULT_S4   0x00F

#define AD7147_REG_CDC_RESULT_S5   0x010

#define AD7147_REG_CDC_RESULT_S6   0x011

#define AD7147_REG_CDC_RESULT_S7   0x012

#define AD7147_REG_CDC_RESULT_S8   0x013

#define AD7147_REG_CDC_RESULT_S9   0x014

#define AD7147_REG_DEV_ID   0x017

#define AD7147_REG_PROXIMITY_STATUS   0x042

#define AD7147_REG_PWR_CONTROL   0x000

#define AD7147_REG_STAGE_CAL_EN   0x001

#define AD7147_REG_STAGE_COMPLETE_INT_ENABLE   0x007

#define AD7147_REG_STAGE_COMPLETE_INT_STATUS   0x00A

#define AD7147_REG_STAGE_HIGH_INT_ENABLE   0x006

#define AD7147_REG_STAGE_HIGH_INT_STATUS   0x009

#define AD7147_REG_STAGE_LOW_INT_ENABLE   0x005

#define AD7147_REG_STAGE_LOW_INT_STATUS   0x008

#define AD7147_REG_STAGEx_AFE_OFFSET (  )     ((int)(0x082 + x * 8))

#define AD7147_REG_STAGEx_CONNECTION1 (  )     ((int)(0x080 + x * 8))

#define AD7147_REG_STAGEx_CONNECTION2 (  )     ((int)(0x081 + x * 8))

#define AD7147_REG_STAGEx_OFFSET_HIGH (  )     ((int)(0x085 + x * 8))

#define AD7147_REG_STAGEx_OFFSET_HIGH_CLAMP (  )     ((int)(0x086 + x * 8))

#define AD7147_REG_STAGEx_OFFSET_LOW (  )     ((int)(0x084 + x * 8))

#define AD7147_REG_STAGEx_OFFSET_LOW_CLAMP (  )     ((int)(0x087 + x * 8))

#define AD7147_REG_STAGEx_SENSITIVITY (  )     ((int)(0x083 + x * 8))

#define AD7147_SHIFT_AVG_FP_SKIP   12

#define AD7147_SHIFT_AVG_LP_SKIP   14

#define AD7147_SHIFT_CDC_BIAS   14

#define AD7147_SHIFT_CINx_CONNECTION_SETUP (  )     ((int)(x<7?x*2:(x-7)*2))

#define AD7147_SHIFT_CONV_RESET   15

#define AD7147_SHIFT_DECIMATION   8

#define AD7147_SHIFT_EXT_SOURCE   12

#define AD7147_SHIFT_FF_SKIP_CNT   0

#define AD7147_SHIFT_FORCED_CAL   14

#define AD7147_SHIFT_FP_PROXIMITY_CNT   4

#define AD7147_SHIFT_FP_PROXIMITY_RECAL

#define AD7147_SHIFT_GPIO_INPUT_CONFIG   14

#define AD7147_SHIFT_GPIO_INT   12

#define AD7147_SHIFT_GPIO_SETUP   12

#define AD7147_SHIFT_LP_CONV_DELAY   2

#define AD7147_SHIFT_LP_PROXIMITY_CNT   8

#define AD7147_SHIFT_LP_PROXIMITY_RECAL

#define AD7147_SHIFT_NEG_AFE_OFFSET   0

#define AD7147_SHIFT_NEG_AFE_OFFSET_DISABLE   14

#define AD7147_SHIFT_NEG_AFE_OFFSET_SWAP   7

#define AD7147_SHIFT_NEG_PEAK_DETECT   4

#define AD7147_SHIFT_NEG_THRESHOLD_SENSITIVITY   0

#define AD7147_SHIFT_NT_POL   11

#define AD7147_SHIFT_POS_AFE_OFFSET   8

#define AD7147_SHIFT_POS_AFE_OFFSET_DISABLE   15

#define AD7147_SHIFT_POS_AFE_OFFSET_SWAP   15

#define AD7147_SHIFT_POS_PEAK_DETECT   12

#define AD7147_SHIFT_POS_THRESHOLD_SENSITIVITY   8

#define AD7147_SHIFT_POWER_MODE   0

#define AD7147_SHIFT_PROXIMITY_DETECTION_RATE   8

#define AD7147_SHIFT_PROXIMITY_RECAL_LVL   0

#define AD7147_SHIFT_PWR_DOWN_TIMEOUT   12

#define AD7147_SHIFT_SE_CONNECTION_SETUP   12

#define AD7147_SHIFT_SEQUENCE_STAGE_NUM   4

#define AD7147_SHIFT_SLOW_FILTER_UPDATE_LVL   14

#define AD7147_SHIFT_STAGEx   x

#define AD7147_SHIFT_SW_RESET   10

#define TLL7UIQ35_SHIFT_TCAP_PB1_CIN   0

#define TLL7UIQ35_SHIFT_TCAP_PB2_CIN   2

#define TLL7UIQ35_SHIFT_TCAP_PB3_CIN   4

#define TLL7UIQ35_SHIFT_TCAP_PB4_CIN   6

#define TLL7UIQ35_SHIFT_TCAP_PB5_CIN   10

#define TLL7UIQ35_SHIFT_TCAP_WHEEL_0_CIN   8

#define TLL7UIQ35_SHIFT_TCAP_WHEEL_1_CIN   10

#define TLL7UIQ35_SHIFT_TCAP_WHEEL_2_CIN   12

#define TLL7UIQ35_SHIFT_TCAP_WHEEL_3_CIN   0

#define TLL7UIQ35_SHIFT_TCAP_WHEEL_4_CIN   2

#define TLL7UIQ35_SHIFT_TCAP_WHEEL_5_CIN   4

#define TLL7UIQ35_SHIFT_TCAP_WHEEL_6_CIN   6

#define TLL7UIQ35_SHIFT_TCAP_WHEEL_7_CIN   8

#define TLL7UIQ35_TCAP_PB1   0x0001

#define TLL7UIQ35_TCAP_PB1_CIN   0

#define TLL7UIQ35_TCAP_PB2   0x0002

#define TLL7UIQ35_TCAP_PB2_CIN   1

#define TLL7UIQ35_TCAP_PB3   0x0004

#define TLL7UIQ35_TCAP_PB3_CIN   2

#define TLL7UIQ35_TCAP_PB4   0x0008

#define TLL7UIQ35_TCAP_PB4_CIN   3

#define TLL7UIQ35_TCAP_PB5   0x1000

#define TLL7UIQ35_TCAP_PB5_CIN   12

#define TLL7UIQ35_TCAP_WHEEL_0   0x0010

#define TLL7UIQ35_TCAP_WHEEL_0_CIN   4

#define TLL7UIQ35_TCAP_WHEEL_1   0x0020

#define TLL7UIQ35_TCAP_WHEEL_1_CIN   5

#define TLL7UIQ35_TCAP_WHEEL_2   0x0040

#define TLL7UIQ35_TCAP_WHEEL_2_CIN   6

#define TLL7UIQ35_TCAP_WHEEL_3   0x0080

#define TLL7UIQ35_TCAP_WHEEL_3_CIN   7

#define TLL7UIQ35_TCAP_WHEEL_4   0x0100

#define TLL7UIQ35_TCAP_WHEEL_4_CIN   8

#define TLL7UIQ35_TCAP_WHEEL_5   0x0200

#define TLL7UIQ35_TCAP_WHEEL_5_CIN   9

#define TLL7UIQ35_TCAP_WHEEL_6   0x0400

#define TLL7UIQ35_TCAP_WHEEL_6_CIN   10

#define TLL7UIQ35_TCAP_WHEEL_7   0x0800

#define TLL7UIQ35_TCAP_WHEEL_7_CIN   11


Enumeration Type Documentation

enum tcapAD7147_averageFPSkip

Enumeration of the average samples to skip in Full Power mode.

Enumerator:
FPSkip_3 
FPSkip_7 
FPSkip_15 
FPSkip_31 

enum tcapAD7147_averageLPSkip

Enumeration of the average samples to skip in low Power mode

Enumerator:
LPSkip_0 
LPSkip_1 
LPSkip_2 
LPSkip_3 

enum tcapAD7147_CDCBais

Enumeration of the CDC Bais percentage.

Enumerator:
CDBais_normal 
CDBais_20percent 
CDBais_35percent 
CDBais_50percent 

enum tcapAD7147_CINConnectionSetup

Enumeration of the CIN Connection setup.

Enumerator:
CIN_notConnected 
CIN_positive 
CIN_negative 
CIN_BIAS 

enum tcapAD7147_decimation

Enumeration of the decimation that can be one.

Enumerator:
Decimation_256 
Decimation_128 
Decimation_64 

enum tcapAD7147_lowPowerConversionDelay

Enumeration of the low power cnversion delay available for the device.

Enumerator:
LPConvDelay_200ms 
LPConvDelay_400ms 
LPConvDelay_600ms 
LPConvDelay_800ms 

enum tcapAD7147_powerMode

Enumeration of the power mode of AD7147 device.

Enumerator:
Pmode_full 
Pmode_low 
Pmode_shutdown 

enum tcapAD7147_SEConnectionSetup

Enumeration of the different types of Stage connection setup available.

Enumerator:
SE_doNotUse 
SE_positive 
SE_negative 
SE_differential 


Function Documentation

int tcapAD7147_Init ( tcapAD7147_t state,
unsigned char  slaveAddress,
enum tcapAD7147_powerMode  powerMode 
)

tcapAD7147_Init This functions initializes the device with default values provided.

Other registers are written with default setting. The registers are set as a bulk if their addresses are continuous.

Pre-conditions: Nothing

Post-Conditions: The device will be powered up following the power up sequence. The device is initialised with values such that all PB1 to PB4 is mapped to Stage 0 to Stage 3 of the device and wheel 0 through wheel 7 is mapped to Stage 4 through Stage 11 and PB5 is mapped to Stage 0. PB1 and PB5 are mapped to Stage0 such that a PB5 is conncected to negative and PB1 is connected to positive of Stage 0. Thus except PB5 all others will trigger a High interrupt while PB5 will trigger a Low interrupt.

Parameters:
state tcapAD7147_t The state variable of the device
slaveAddress unsigned char The slave address of AD7147 device.
powerMode enum tcapAD7147_powerMode The power mode in which the AD7147 has to be put to. Normal or low power.
Returns:
0 on success -1 on failure
Parameters:
slaveAddress  stores the state of AD7147 device
powerMode  slave address of the AD7147 device The power mode to be set for the AD7147 chip

int tcapAD7147_release ( tcapAD7147_t state  ) 

tcapAD7147_Release This functions switches off the device.

Pre-conditions: The device should have been initialised using the init function

Post-Conditions: The device will be powered off and no longer will respond to the interrupt

Parameters:
state tcapAD7147_t The state variable of the device
Returns:
0 on success -1 on failure

int tcapAD7147_touchEventGet ( tcapAD7147_t state  ) 

tcapAD7147_touchEventGet This function busy waits till there is a change in the state of the touch cap buttons and then reports back the values of the buttons and the buttons which has caused the change in state of the touch cap.

Pre-conditions: The device should have been initialised using the init function

Post-Conditions: The button change status and values are updated in the state variable

Parameters:
state tcapAD7147_t The state variable of the device
Returns:
0 on success -1 on failure

int tcapAD7147_touchGet ( tcapAD7147_t state  ) 

tcapAD7147_touchGet This function reads (no wait) the values of the buttons and updates the state variable.

Pre-conditions: The device should have been initialised using the init function

Post-Conditions: The button values are updated in the state variable

Parameters:
state tcapAD7147_t The state variable of the device
Returns:
0 on success -1 on failure


Generated on 3 Mar 2014 for PAL bare-c Library by  doxygen 1.4.7