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

no-image

AT42QTAN0040

Manufacturer Part Number
AT42QTAN0040
Description
Driving the AT42QT2160 QMatrix Sensor IC
Manufacturer
ATMEL [ATMEL Corporation]
Datasheet
5.4
5.5
5.6
6
SendByte()
GetByte()
WriteQtI2c()
Driving the AT42QT2160
Table 5-1.
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.
The GetByte() function receives a single byte and terminates it with either ACK or NACK. NACK
should be specified for the last byte of an I
received byte.
The flowchart for the WriteQtI2c() function is shown in
Figure 5-1.
Macro
SetLoSDA
FloatSDA
SendSTART
SendSTOP
SendCLOCK
Code Macros for the I
Flowchart for the WriteQtI2c() Function
Send (Next Data byte)
Send (Slave-address
Send (Write-Address)
Description
Drives the SDA pin low. There is no need to wait for the pin to achieve
the low state.
This simply floats the SDA pin so that the QT2160 can drive SDA
during data-reads or ACK cycles.
Outputs the START condition
Outputs the STOP condition
Pulses the SCL pin high-low
Decrement Length
Send I2C START
WriteQtI2c()
Length = 0?
+ WRITE)
Result?
Result?
2
C-compatible Bus Functions (Continued)
OK
OK
No
2
Fail
Fail
C-compatible read transfer. GetByte() returns the
Yes
Figure
Send I2C STOP
Send I2C STOP
Return Result
5-1.
2
C-compatible bus. The byte is
10702A–AT42–07/08

Related parts for AT42QTAN0040