Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem app epson mbed msp430 pl tests
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:
-
I2C the 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:
-
reg The 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:
-
status Pointer 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:
-
key The key to configure. guard Set to true if this is a guard channel. group The key group (AKS) number. gpu Set to true for high output. enable Enable 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:
-
Set to 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:
-
reg The register to write. value The value to write to the register.
- Returns:
- True on success.
Definition at line 141 of file at42qt2120.cpp.
Generated on Tue Jul 12 2022 21:14:35 by
