FlexBook / Mbed 2 deprecated FlexBook171204a

Dependencies:   SDFileSystem app epson mbed msp430 pl tests

Embed: (wiki syntax)

« Back to documentation index

AT42QT2120 Class Reference

AT42QT2120 Class Reference

Atmel AT42QT2120 encapsulation. More...

#include <at42qt2120.h>

Data Structures

struct  Status
 Touch sensor status. More...

Public Member Functions

 AT42QT2120 (I2C &i2c)
 Constructor.
bool Calibrate ()
 Calibrate any enabled touch sensors.
bool SetKeyControl (uint8_t key, bool guard, uint8_t group, bool gpo, bool enable)
 Set the key control bits.
void SetSliderOptions (SLIDERMODE_AT42QT2120 mode)
 Set the slider options.
bool ReadStatus (Status &status)
 Read the status of the touch sensor.
int Read (REG_AT42QT2120 reg)
 Read a register.
bool Write (REG_AT42QT2120 reg, uint8_t value)
 Write a register.

Detailed Description

Atmel AT42QT2120 encapsulation.

This chip is a 12 channel touch sensor.

Example usage:

    I2C i2c(p28, p27);
    AT42QT2120 at42qt2120(i2c);
    ...
    at42qt2120.Write(QT_RESET, 0);
 

The AT42QT2120 uses pins 28 and 27 (SDA and SCL) for communication and the write command resets the chip.

The chip address of the AT42QT2120 is fixed at 0x1c.

Note that this code example does not cover the setup of the chip configuration registers.

Definition at line 145 of file at42qt2120.h.


Constructor & Destructor Documentation

AT42QT2120 ( I2C &  i2c )

Constructor.

Parameters:
I2Cthe I2C to use for communication.

Definition at line 19 of file at42qt2120.cpp.


Member Function Documentation

bool Calibrate (  )

Calibrate any enabled touch sensors.

Returns:
True if calibration was successfull.

Definition at line 65 of file at42qt2120.cpp.

int Read ( REG_AT42QT2120  reg )

Read a register.

Parameters:
regThe register to read.
Returns:
The register value.

Definition at line 127 of file at42qt2120.cpp.

bool ReadStatus ( Status status )

Read the status of the touch sensor.

Parameters:
statusPointer to hold the status information.
Returns:
True if the transfer completes successfully.

Definition at line 40 of file at42qt2120.cpp.

bool SetKeyControl ( uint8_t  key,
bool  guard,
uint8_t  group,
bool  gpo,
bool  enable 
)

Set the key control bits.

See section 5.17 of the datasheet for more information. All keys are initially disabled in the constructor so this function must be called to configure the keys before use. After calling this function you should call Calibrate().

Parameters:
keyThe key to configure.
guardSet to true if this is a guard channel.
groupThe key group (AKS) number.
gpuSet to true for high output.
enableEnable this key. Unused keys should be disabled.

Definition at line 86 of file at42qt2120.cpp.

void SetSliderOptions ( SLIDERMODE_AT42QT2120  mode )

Set the slider options.

Parameters:
Setto SLIDER, WHEEL or NONE to set the required mode.

Definition at line 109 of file at42qt2120.cpp.

bool Write ( REG_AT42QT2120  reg,
uint8_t  value 
)

Write a register.

Parameters:
regThe register to write.
valueThe value to write to the register.
Returns:
True on success.

Definition at line 141 of file at42qt2120.cpp.