|
Hello Pramod,
If you already have the project with 5 buttons and 1 slider, in order to expand the same to 10 buttons and 2 sliders - you can follow the below steps -
1. First check pin requirements for the design- 10 buttons with 2 sliders each having 10 segements requires 30+1 pins; Since you are using CY8C20434 device which has just 28 I/Os, you cannot use a 10 segment slider. Either choose a higher pin part device or use a lower segment count sliders - say two 5 segement sliders or one 5 segemnt and one 10 segment slider.
2. If you are done with the above, you can now proceed to setting the number of buttons/sliders. In the chip editor view, right click (either in chip editor or workspace explorer) on your CapSense UM and Select CSA wizard ( or CSA_EMC wizard if you are using CSA_EMC)
3. In wizard you can simply type the number of buttons you want in the Buttons field and Number of sliders you want in the sliders field (these options are in the Global settings tab) - Enter 10 against buttons and 2 against sliders for your case.
4. Now click on Slider S1 in the right side pane - it will get highlighted in red indicating it is selected.
5. Now click on the sensor settings tab, in this tab, against the Sensors count field enter the number of segments you want in this slider - say 5 segments. You can select the resolution and Diplex option as well - refer UM datasheet for complete details on these parameters (Right click on the UM and then click on Datasheet)
6. Now Follow step 4 & 5 for Slider S2
7. Once you are done, you need to assign pins for the sensors. You can do the same by either simply clicking-dragging-dropping the button or slider segment on to a pin in Chip pin assignment view (if you want to assign by chip pin wise) or Table pin assignment view (if you want to go by port pin wise)
8. Once you have assigned all the sensors to a pin and selected ExternalCap (P0[3] for CY3280 board) in the Global settings, click Ok to save/close the configuration wizard.
9. Now build your project by pressing F6 or Build -> Generate/Build
10. Now in the project, in the UpdateI2CBuffer API, you can access CSA_baSnsOnMask[0] and [1] for reading the button status. Note that CSA_baSnsOnMask[0] will have button status of Button 0 to Button 7 (from LSB to MSB) and CSA_baSnsOnMask[1] will have button status of Button 8 to Button 15. Since there are just 10 buttons in our design, the MSB 5 bits of this register is of no use. Accordingly you can modify the code to get the status of that particular button.
11. In the same function, where you are calling CSA_wGetCentroidPos(1) - you can call CSA_wGetCentroidPos(2) to read the status of Slider S2. You can do a similar processing for Slider S2 like done for Slider S1 to implement both Slider S1 and S2.
12. Remember if you are adding an extra variable to the I2C buffer, define the same in the structure defined in 'main.h'
Hope this helps.
If you need let me know, I can post some screenshots for clarity.
Regards,
MSUR
|