Sensorian  1.0
C API Reference Guide Library
CAP1203.h File Reference

CAP1203 driver header. More...

#include "i2c.h"

Go to the source code of this file.

Macros

#define CAP1203ADDR   0x28
 The I2C address of the CAP1203 capacitive touch controller. More...
 
#define MAIN_CTRL_REG   0x00
 
#define GEN_STATUS   0x02
 
#define SENSOR_INPUTS   0x03
 
#define NOISE_FLAG   0x0A
 
#define SENS1DELTACOUNT   0x10
 
#define SENS2DELTACOUNT   0x11
 
#define SENS3DELTACOUNT   0x12
 
#define SENSITIVITY   0x1F
 
#define CONFIG1   0x20
 
#define SENSINPUTEN   0x21
 
#define SENSINCONF1   0x22
 
#define SENSINCONF2   0x23
 
#define AVERAGE_SAMP_CONF   0x24
 
#define CAL_ACTIV   0x26
 
#define INT_ENABLE   0x27
 
#define REPEAT_RATE   0x28
 
#define MULTITOUCH   0x2A
 
#define MULTIPATCONF   0x2B
 
#define MULTIPATTERN   0x2D
 
#define BASECOUNT   0x2E
 
#define RECALCONFIG   0x2F
 
#define S1THRESHOLD   0x30
 
#define S2THRESHOLD   0x31
 
#define S3THRESHOLD   0x32
 
#define SENSTHRESHOLD   0x38
 
#define STANDBYCHAN   0x40
 
#define STANDBYCONF   0x41
 
#define STANDBY_SENS   0x42
 
#define STANDBY_THRE   0x43
 
#define CONFIG2   0x44
 
#define S1BASECOUNT   0x50
 
#define S2BASECOUNT   0x51
 
#define S3BASECOUNT   0x52
 
#define PWR_BUTTON   0x60
 
#define PWR_CONFIG   0x61
 
#define S1INPCAL   0xB1
 
#define S2INPCAL   0xB2
 
#define S3INPCAL   0xB3
 
#define S1CALLSB   0xB9
 
#define PRODUCT_ID   0xFD
 
#define MAN_ID   0xFE
 
#define REV   0xFF
 
#define STBY   0x20
 
#define SLEEP   0x08
 
#define INT   0x01
 
#define BC_OUT   0x40
 
#define ACAL_FAIL   0x20
 
#define PWR   0x10
 
#define MULT   0x04
 
#define MTP   0x02
 
#define TOUCH   0x01
 
#define CS3   0x04
 
#define CS2   0x02
 
#define CS1   0x01
 
#define DUR560MS
 
#define DUR840MS
 
#define DUR1120MS
 
#define DUR1400MS
 
#define DUR1680MS
 
#define DUR2240MS
 
#define DUR2800MS
 
#define DUR3360MS
 
#define DUR3920MS
 
#define DUR4480MS
 
#define DUR5600MS
 
#define DUR6720MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define REP_35MS
 
#define M_PRESS35MS
 
#define M_PRESS70MS
 
#define M_PRESS105MS
 
#define M_PRESS140MS
 
#define M_PRESS175MS
 
#define M_PRESS210MS
 
#define M_PRESS2455MS
 
#define M_PRESS280MS
 
#define M_PRESS315MS
 
#define M_PRESS350MS
 
#define M_PRESS385MS
 
#define M_PRESS420MS
 
#define M_PRESS455MS
 
#define M_PRESS490MS
 
#define M_PRESS560MS
 
#define MOST_SENSITIVE   0x00
 
#define DEFAULT   0x20
 
#define LEAST_SENSITIVE   0x70
 
#define TIMEOUT   0x80
 
#define DIS_DIG_NOISE   0x20
 
#define DIS_ANA_NOISE   0x10
 
#define MAX_DUR_EN   0x08
 
#define AVG   0x30
 
#define SAMP_TIME   0x80
 
#define CYCLE_TIME   0x01
 
#define MULTBLK_EN   0x80
 
#define MTP_EN   0x80
 
#define MTP_TH1   0x08
 
#define MTP_TH0   0x04
 
#define COMP_PTRN   0x02
 
#define MTP_ALERT   0x01
 
#define CS3_PTRN   0x04
 
#define CS2_PTRN   0x02
 
#define CS1_PTRN   0x01
 
#define PWR_EN   0x40
 
#define TIME280ms   0x00
 
#define TIME560ms   0x01
 
#define TIME1120ms   0x02
 
#define TIME2240ms   0x03
 

Enumerations

enum  touch_type {
  ONE =0x00, TWO =0x01, THREE =0x02, ONE =0x00,
  TWO =0x01, THREE =0x02
}
 
enum  button_type {
  B1 =0x01, B2 = 0x02, B3 = 0x03, B1 =0x01,
  B2 = 0x02, B3 = 0x03
}
 
enum  sensitivity_type { S1, S2, S1, S2 }
 

Functions

void CAP1203_Initialize (void)
 Basic configuration for the capacitive touch controller. Configures the sensor inactive mode and activates all three channels. More...
 
unsigned char CAP1203_ActiveMode (void)
 Configures the controller in active mode. More...
 
unsigned char CAP1203_StandbyMode (void)
 Configures the controller in standby mode. More...
 
unsigned char CAP1203_DeepSleep (void)
 Configures the controller in deep sleep mode. More...
 
unsigned char CAP1203_ResumeFromDeepSleep (void)
 Takes the controller out of deep sleep mode. More...
 
unsigned char CAP1203_ReadPressedButton (void)
 Return id indicating which button was pressed. More...
 
void CAP1203_EnableInterrupt (button_type pin)
 Enable interrupt, the ALERT pin goes high once an interrupt occurs. More...
 
void CAP1203_SetSensitivity (sensitivity_type sensitivity)
 Sets the sensitivity of each channel. More...
 
unsigned char CAP1203_CheckSensorStatus (void)
 Checks the sensor status. More...
 
unsigned char CAP1203_ClearInterrupt (void)
 Clears any impending interrupts. More...
 
unsigned int CAP1203_ReadID (void)
 Returns product chip and manufacturing ID. More...
 
void CAP1203_ConfigureMultiTouch (touch_type number, unsigned char chan)
 Enables the multi-touch capability of the controller. More...
 
unsigned char CAP1203_MultitouchEvent (void)
 Return true if a multitouch event was detected. More...
 
void CAP1203_SetPowerButton (button_type button)
 Configures the button as a power button. More...
 
unsigned char CAP1203_ReadPowerButton (void)
 Read the status of the power button. More...
 
unsigned char CAP1203_GetStatusReg (void)
 Reads the status register. More...
 
void CAP1203_Write (unsigned char reg, unsigned char data)
 Write data value to register address. More...
 
unsigned char CAP1203_Read (unsigned char reg)
 Reads data from register reg address. More...
 

Detailed Description

CAP1203 driver header.

Author
D.Qendri
Date
28 May 2015

Definition in file CAP1203.h.

Macro Definition Documentation

#define ACAL_FAIL   0x20

Definition at line 90 of file CAP1203.h.

#define AVERAGE_SAMP_CONF   0x24

Definition at line 51 of file CAP1203.h.

#define AVG   0x30

Definition at line 162 of file CAP1203.h.

#define BASECOUNT   0x2E

Definition at line 58 of file CAP1203.h.

#define BC_OUT   0x40

Definition at line 89 of file CAP1203.h.

#define CAL_ACTIV   0x26

Definition at line 52 of file CAP1203.h.

#define CAP1203ADDR   0x28

The I2C address of the CAP1203 capacitive touch controller.

Definition at line 36 of file CAP1203.h.

#define COMP_PTRN   0x02

Definition at line 175 of file CAP1203.h.

#define CONFIG1   0x20

Definition at line 47 of file CAP1203.h.

#define CONFIG2   0x44

Definition at line 69 of file CAP1203.h.

#define CS1   0x01

Definition at line 99 of file CAP1203.h.

#define CS1_PTRN   0x01

Definition at line 182 of file CAP1203.h.

#define CS2   0x02

Definition at line 98 of file CAP1203.h.

#define CS2_PTRN   0x02

Definition at line 181 of file CAP1203.h.

#define CS3   0x04

Definition at line 97 of file CAP1203.h.

#define CS3_PTRN   0x04

Definition at line 180 of file CAP1203.h.

#define CYCLE_TIME   0x01

Definition at line 164 of file CAP1203.h.

#define DEFAULT   0x20

Definition at line 150 of file CAP1203.h.

#define DIS_ANA_NOISE   0x10

Definition at line 156 of file CAP1203.h.

#define DIS_DIG_NOISE   0x20

Definition at line 155 of file CAP1203.h.

#define DUR1120MS

Definition at line 105 of file CAP1203.h.

#define DUR1400MS

Definition at line 106 of file CAP1203.h.

#define DUR1680MS

Definition at line 107 of file CAP1203.h.

#define DUR2240MS

Definition at line 108 of file CAP1203.h.

#define DUR2800MS

Definition at line 109 of file CAP1203.h.

#define DUR3360MS

Definition at line 110 of file CAP1203.h.

#define DUR3920MS

Definition at line 111 of file CAP1203.h.

#define DUR4480MS

Definition at line 112 of file CAP1203.h.

#define DUR5600MS

Definition at line 113 of file CAP1203.h.

#define DUR560MS

Definition at line 103 of file CAP1203.h.

#define DUR6720MS

Definition at line 114 of file CAP1203.h.

#define DUR840MS

Definition at line 104 of file CAP1203.h.

#define GEN_STATUS   0x02

Definition at line 40 of file CAP1203.h.

#define INT   0x01

Definition at line 87 of file CAP1203.h.

#define INT_ENABLE   0x27

Definition at line 53 of file CAP1203.h.

#define LEAST_SENSITIVE   0x70

Definition at line 151 of file CAP1203.h.

#define M_PRESS105MS

Definition at line 132 of file CAP1203.h.

#define M_PRESS140MS

Definition at line 133 of file CAP1203.h.

#define M_PRESS175MS

Definition at line 134 of file CAP1203.h.

#define M_PRESS210MS

Definition at line 135 of file CAP1203.h.

#define M_PRESS2455MS

Definition at line 136 of file CAP1203.h.

#define M_PRESS280MS

Definition at line 137 of file CAP1203.h.

#define M_PRESS315MS

Definition at line 138 of file CAP1203.h.

#define M_PRESS350MS

Definition at line 139 of file CAP1203.h.

#define M_PRESS35MS

Definition at line 130 of file CAP1203.h.

#define M_PRESS385MS

Definition at line 140 of file CAP1203.h.

#define M_PRESS420MS

Definition at line 141 of file CAP1203.h.

#define M_PRESS455MS

Definition at line 142 of file CAP1203.h.

#define M_PRESS490MS

Definition at line 143 of file CAP1203.h.

#define M_PRESS560MS

Definition at line 144 of file CAP1203.h.

#define M_PRESS70MS

Definition at line 131 of file CAP1203.h.

#define MAIN_CTRL_REG   0x00

Definition at line 39 of file CAP1203.h.

#define MAN_ID   0xFE

Definition at line 81 of file CAP1203.h.

#define MAX_DUR_EN   0x08

Definition at line 157 of file CAP1203.h.

#define MOST_SENSITIVE   0x00

Definition at line 149 of file CAP1203.h.

#define MTP   0x02

Definition at line 93 of file CAP1203.h.

#define MTP_ALERT   0x01

Definition at line 176 of file CAP1203.h.

#define MTP_EN   0x80

Definition at line 172 of file CAP1203.h.

#define MTP_TH0   0x04

Definition at line 174 of file CAP1203.h.

#define MTP_TH1   0x08

Definition at line 173 of file CAP1203.h.

#define MULT   0x04

Definition at line 92 of file CAP1203.h.

#define MULTBLK_EN   0x80

Definition at line 167 of file CAP1203.h.

#define MULTIPATCONF   0x2B

Definition at line 56 of file CAP1203.h.

#define MULTIPATTERN   0x2D

Definition at line 57 of file CAP1203.h.

#define MULTITOUCH   0x2A

Definition at line 55 of file CAP1203.h.

#define NOISE_FLAG   0x0A

Definition at line 42 of file CAP1203.h.

#define PRODUCT_ID   0xFD

Definition at line 80 of file CAP1203.h.

#define PWR   0x10

Definition at line 91 of file CAP1203.h.

#define PWR_BUTTON   0x60

Definition at line 73 of file CAP1203.h.

#define PWR_CONFIG   0x61

Definition at line 74 of file CAP1203.h.

#define PWR_EN   0x40

Definition at line 185 of file CAP1203.h.

#define RECALCONFIG   0x2F

Definition at line 59 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REP_35MS

Definition at line 128 of file CAP1203.h.

#define REPEAT_RATE   0x28

Definition at line 54 of file CAP1203.h.

#define REV   0xFF

Definition at line 82 of file CAP1203.h.

#define S1BASECOUNT   0x50

Definition at line 70 of file CAP1203.h.

#define S1CALLSB   0xB9

Definition at line 78 of file CAP1203.h.

#define S1INPCAL   0xB1

Definition at line 75 of file CAP1203.h.

#define S1THRESHOLD   0x30

Definition at line 60 of file CAP1203.h.

#define S2BASECOUNT   0x51

Definition at line 71 of file CAP1203.h.

#define S2INPCAL   0xB2

Definition at line 76 of file CAP1203.h.

#define S2THRESHOLD   0x31

Definition at line 61 of file CAP1203.h.

#define S3BASECOUNT   0x52

Definition at line 72 of file CAP1203.h.

#define S3INPCAL   0xB3

Definition at line 77 of file CAP1203.h.

#define S3THRESHOLD   0x32

Definition at line 62 of file CAP1203.h.

#define SAMP_TIME   0x80

Definition at line 163 of file CAP1203.h.

#define SENS1DELTACOUNT   0x10

Definition at line 43 of file CAP1203.h.

#define SENS2DELTACOUNT   0x11

Definition at line 44 of file CAP1203.h.

#define SENS3DELTACOUNT   0x12

Definition at line 45 of file CAP1203.h.

#define SENSINCONF1   0x22

Definition at line 49 of file CAP1203.h.

#define SENSINCONF2   0x23

Definition at line 50 of file CAP1203.h.

#define SENSINPUTEN   0x21

Definition at line 48 of file CAP1203.h.

#define SENSITIVITY   0x1F

Definition at line 46 of file CAP1203.h.

#define SENSOR_INPUTS   0x03

Definition at line 41 of file CAP1203.h.

#define SENSTHRESHOLD   0x38

Definition at line 63 of file CAP1203.h.

#define SLEEP   0x08

Definition at line 86 of file CAP1203.h.

#define STANDBY_SENS   0x42

Definition at line 67 of file CAP1203.h.

#define STANDBY_THRE   0x43

Definition at line 68 of file CAP1203.h.

#define STANDBYCHAN   0x40

Definition at line 65 of file CAP1203.h.

#define STANDBYCONF   0x41

Definition at line 66 of file CAP1203.h.

#define STBY   0x20

Definition at line 85 of file CAP1203.h.

#define TIME1120ms   0x02

Definition at line 188 of file CAP1203.h.

#define TIME2240ms   0x03

Definition at line 189 of file CAP1203.h.

#define TIME280ms   0x00

Definition at line 186 of file CAP1203.h.

#define TIME560ms   0x01

Definition at line 187 of file CAP1203.h.

#define TIMEOUT   0x80

Definition at line 154 of file CAP1203.h.

#define TOUCH   0x01

Definition at line 94 of file CAP1203.h.

Enumeration Type Documentation

Buttons pressed.

Enumerator
B1 

Button one.

B2 

Button two.

B3 

Button three.

B1 

Button one.

B2 

Button two.

B3 

Button three.

Definition at line 211 of file CAP1203.h.

Sensitivity options.

Enumerator
S1 

Option 1.

S2 

Option 2.

S1 

Option 1.

S2 

Option 2.

Definition at line 229 of file CAP1203.h.

enum touch_type

Channels that can be used

Enumerator
ONE 

Channel one

TWO 

Channel two

THREE 

Channel three

ONE 

Channel one

TWO 

Channel two

THREE 

Channel three

Definition at line 194 of file CAP1203.h.

Function Documentation

unsigned char CAP1203_Read ( unsigned char  reg)

Reads data from register reg address.

Parameters
regRegister to read from
Returns
Register value

Definition at line 267 of file CAP1203.c.

void CAP1203_Write ( unsigned char  reg,
unsigned char  data 
)

Write data value to register address.

Parameters
regRegister to write to.
dataValue to write to register

Definition at line 257 of file CAP1203.c.