Cypress CE66058 Manuel - Page 8

Parcourez en ligne ou téléchargez le pdf Manuel pour {nom_de_la_catégorie} Cypress CE66058. Cypress CE66058 14 pages. Dynamically switch csd bleed resistor

Cypress CE66058 Manuel
On reset, all the hardware settings from the device configuration are loaded into the device and main.c is executed.
Next, the firmware performs the following operations:
1.
Defines a structure, MyI2C_Regs, to store the button number, raw count, difference count, baseline, and status of the
CapSense button corresponding to the given button number.
2.
Enables a global interrupt and starts the CSD User Module. The finger thresholds for buttons are set, and the baselines
are initialized (with the respective feedback resistors connected).
3.
Starts the EzI2Cs User Module and sets MyI2C_Regs as the I
4.
Performs the following operations in an infinite loop:
Scans buttons 0–3 with feedback resistor Rb1 and button 4 with feedback resistor Rb2. MyI2C_Regs is updated with
the raw count, difference count, baseline, and status of the requested CapSense button.
The I2C master can request the CapSense data of a particular button by writing the button number into the first byte of
the I2C buffer of the EzI2Cs slave.
Changing the Feedback Resistor
In the example project, buttons 0–3 use a bleed resistor connected to P3[1], while button 4 uses the bleed resistor connected
to P1[5]. Before scanning, a function is called to modify the routing of the comparator output that drives the new bleed resistor.
This is achieved by modifying these registers: PRTxDMx, PRTxGS, and CMP_GO_EN.
Following is a brief description of the functionality of these registers:
PRTxDMx: These registers set the configuration of the output; the bleed resistor must be put in the open drain low mode.
The pin that has to be disconnected from Rb must be made High Z. To switch between these modes, you need to change
only the PRTxDM0 mode. You do not have to alter the DM1 and DM2 registers. The port number for the corresponding
pin is x.
PRTxGS: This register connects the pin of the resistor to the proper internal global bus. The port number for the
corresponding pin is x.
CMP_GO_EN: This register sets the comparator output to the global bus.
Note For more information about these registers, refer to the device TRM available at www.cypress.com/?rID=34621.
The values shown in
Table 5
The code snippet used in this project to connect Rb to P5[5] is:
CMP_GO_EN |= 0x80
PRT5DM0 |= 0x20
PRT5GS |= 0x20
www.cypress.com
must be ORed with these registers to enable a pin for Rb operation.
Table 5. Values to Be ORed
Pin
PRTxDM0
0x02
P1[1]
P3[1]
0x02
P1[5]
0x20
P3[5]
0x20
P5[1]
0x02
P5[5]
0x20
Document No. 001-66058 Rev.*E
Dynamically Switch CSD Bleed Resistor
2
C buffer.
PRTxGS
CMP_GO_EN
0x02
0x02
0x20
0x20
0x02
0x20
0x40
0x40
0x80
0x80
0x40
0x80
8