www.ti.com
CapTIvate™ Touch Getting Started Manual
35
Copyright © 2021, Texas Instruments Incorporated
•
I2C peripheral configuration and interrupt usage:
Option two
★
:
•
User Guide
•
Communication Interface configuration: NONE
•
Clock configuration: BSP_configureMCU()
•
IO configuration: BSP_configureMCU()
•
I2C peripheral configuration and interrupt usage: The code under the REGISTER_I2C configuration includes I2C
peripheral configuration and interrupt usage. The user only needs to analyze the 3-byte transmit and receive
Buffer. The operation steps are as follows:
o
Step 1: Modify the CAPT_I2CRegisterReceiveHandler() function in
captivate->COMM->CAPT_Interface.c. This function will be called when the stop signal or restart
signal are generated after the I2C write operation is completed. As shown in Figure 5-16, delete other
codes and add custom frame processing functions.
Figure 5-16 CAPT_I2CRegisterReceiveHandler() function modification
o
Step 2: Write a custom frame processing function. As shown in Figure 5-17, MSP430 will read a byte
sent by the host, then modify the first byte of the data segment in the Buffer, and then wait for the
host to actively read the byte. It should be noted that I2C sending and receiving share a 32-byte
buffer, and the whole process will not reset it. In addition, the receiving/sending data segment in the
buffer will have an offset of 3 Bytes. Therefore, the fourth byte of the Buffer corresponds to the first
byte of the received/sent data.
Figure 5-17 Frame processing function
o
Step 3: Build the overall code as shown in Figure 5-18. The additional functions included are
:
▪
Panel_Init(): System custom initialization, register the sensor callback function.
▪
BTNEventHandler(): The processing function that defines the state of the sensor.