AT42QTAN0040 ATMEL [ATMEL Corporation], AT42QTAN0040 Datasheet - Page 7

no-image

AT42QTAN0040

Manufacturer Part Number
AT42QTAN0040
Description
Driving the AT42QT2160 QMatrix Sensor IC
Manufacturer
ATMEL [ATMEL Corporation]
Datasheet
5.7
10702A–AT42–07/08
ReadQtI2c()
The WriteQtI2c() function writes one or more bytes to the QT2160 as specified in the datasheet.
It accepts four input parameters:
The function returns I2C_OK if the entire write transfer is acknowledged (ACK), or I2C_FAIL if a
NACK is returned.
The flowchart for ReadQtI2c() is shown in
Figure 5-2.
The ReadQtI2c() function reads one or more bytes to the QT2160 as specified in the datasheet.
It accepts four input parameters:
The function returns I2C_OK if the entire read transfer is completed correctly.
Note that the WriteQtI2c() function is called to set the address-pointer within the QT2160.
• SlaveAddress: The QT2160 I
• WriteAddress: The address of the first QT2160 register to be written.
• WriteLength: The number of bytes to be written.
• WritePtr: A pointer to the first byte to be written. The pointer should point to a byte array.
• SlaveAddress: The QT2160 I
• ReadAddress: The address of the first QT2160 register to be read.
• ReadLength: The number of bytes to be read.
• ReadPtr: A pointer to a byte-array where the read data should be saved.
Flowchart for the ReadQtI2c() Function
Fail
Read (Next Data byte)
Write Address-pointer
Send (Slave-address
Decrement Length
2
using WriteQtI2c()
2
Send I2C START
Send I2C STOP
C-compatible address as selected at pins I2CA1 and I2CA0.
C-compatible address as selected at pins I2CA1 and I2CA0.
ReadQtI2c()
Return Result
Length = 0?
+ READ)
Result?
Result?
OK
OK
Yes
Figure
Fail
No
Driving the AT42QT2160
5-2.
Send I2C STOP
7

Related parts for AT42QTAN0040