AT42QTAN0040 ATMEL [ATMEL Corporation], AT42QTAN0040 Datasheet
AT42QTAN0040
Related parts for AT42QTAN0040
AT42QTAN0040 Summary of contents
Page 1
... Section 6 on page 8 for a listing of the GPIO3 GPO3 GPO2 GPO1 GPO0 CHANGE SCL SDA 8 Discrete Keys 5-Key Slider (keys 0 QT2160 Driving the AT42QT2160 QMatrix Sensor IC Application Note Vdd AT42QTAN0040 (keys 8 – 15) – 4) QMatrix Key Array 10702A–AT42–07/08 ...
Page 2
QT2160 Host Interface The QT2160 connects to a host controller by means uses a common two-wire connection between the host QT2160 and other I devices in the system. The bus protocol takes care of all addressing ...
Page 3
Interface Timing Figure 3-1 in its sense status by driving the CHANGE pin low. In this context, sense status includes bytes 2 through 6 of the address map. In response to the QT2160 driving CHANGE low, the host reads ...
Page 4
During initialization, the program establishes communication with the QT2160 and then sets it up for the required operating mode. In the main loop, the program monitors the CHANGE pin. If the CHANGE pin is low, the program reads the five ...
Page 5
I C-compatible Driver 2 5.1 I C-compatible Communication 2 I C-compatible communication is a major aspect of any program involving the QT2160. Some form of I Most current microprocessors include a hardware I be programmed to efficiently handle ...
Page 6
Table 5-1. Macro SetLoSDA FloatSDA SendSTART SendSTOP SendCLOCK 5.4 SendByte() The SendByte() function transmits a single byte onto the I supplied as an input parameter. SendByte() returns I2C_OK if the byte is acknowledged or I2C_FAIL if a NACK is returned. ...
Page 7
The WriteQtI2c() function writes one or more bytes to the QT2160 as specified in the datasheet. It accepts four input parameters: • SlaveAddress: The QT2160 I • WriteAddress: The address of the first QT2160 register to be written. • WriteLength: ...
Page 8
Source Code /*===================================================================================== Project: =====================================================================================*/ typedef unsigned char uint8_t; enum { /* QT2160 registers */ QT_CHIP_ID = 0, QT_KEY_STATUS_2, QT_RESET, QT_POS_DRIFT_COMP, QT_SLIDER_CONTROL, QT_KEY_BL = 54, QT_GPO_PWM, QT_COMM_CHG_KEYS_1, }; #define QT2160_ID #define QT_STATUS_SDET #define QT_STATUS_RES #define QT_GPIO_1 #define QT_GPIO_2 #define ...
Page 9
Function: main() =====================================================================================*/ void main ( void ) { /*------------------------------- Initialisation -------------------------------------*/ /* (1) Establish communication with the QT2160 touch-sensor */ /* wait for successful transfer at the QT2160's address - Read Chip-ID */ while ( !ReadQtI2c (QT2160_I2C_ADDRESS, QT_CHIP_ID, ...
Page 10
QT2160 LEDs */ WriteQtI2c ( QT2160_I2C_ADDRESS, QT_GPO_DRIVE, 1, &QtStatus[ Update the PWM level if the slider is touched */ if (QtStatus[0] & QT_STATUS_SDET) WriteQtI2c ( QT2160_I2C_ADDRESS, QT_PWM_LEVEL, 1, &QtStatus[3] ); ...
Page 11
Function: SendByte() Input: Byte to send Output: I2C_OK if device ACKs, I2C_FAIL if device NACKs ====================================================================================*/ uint8_t SendByte ( uint8_t TxByte ) { uint8_t i,b, Result = I2C_OK; for ( < 8; b++) { if ( ...
Page 12
SDA ) RxByte |= 1; SetLoSCL AckBit ) /* send ACK bit */ SetLoSDA else SetHiSDA SendCLOCK return RxByte; } /*===================================================================================== Function: WriteQtI2c() Executes multi-byte write to QT-device Input: SlaveAddress = Device address on the ...
Page 13
Function: ReadQtI2c() Executes multi-byte read from QT-device Input: SlaveAddress = Device address on the I2C bus ReadAddress = Register address ReadLength = Number of bytes to read ReadPtr = Pointer to byte array for read-data Output: I2C_OK if transfer ...
Page 14
Headquarters Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Disclaimer: The information in this document is provided in connection with Atmel and QRG Ltd. products. No license, express or implied, by estoppel ...