The project includes CapSense configuration implementing two buttons and a five-element slider, FreeRTOS configuration on Cortex-M4 and FreeRTOS task implementation for CapSense and LED interface. In addition, the project defines and implements the CapSense exit/entry callbacks through the “cyapicallbacks.h” file. The CapSense task initializes the CapSense block, scans the widgets periodically, processes the widgets after each scan and notifies the LED task to display the output.The LED task controls the RGB LED. The slider value controls the intensity and the buttons control ON/OFF states of the LEDs. The CapSense entry/exit callbacks provide the CapSense task resume/wakeup functionality on CapSense scan completion.
Operation-1. Plug the CY8CKIT-062-BLE kit board into your computer’s USB port.
2. Build the project and program it into the PSoC 6 MCU device. Choose Debug > Program. For more information on device programming, see PSoC Creator Help. Flash for both CPUs is programmed in a single program operation. Also, see the Pioneer Kit guide for details on how to program firmware into the device.
3. Power the Pioneer Board through the USB connector J10.
4. Application firmware creates two tasks, ‘Task_Touch’ and ‘Task_RGB’ respectively.
5. ‘Task_Touch’ scans the Capsense widgets (The 5-element CapSense CSD slider (self-capacitance), and two CapSense CSX buttons (mutual-capacitance)) with SmartSense™auto-tuning.
6. This example project makes use of CapSense Entry/Exit callback functions. CapSense_EntryCallback()is used at the beginning of the CapSense interrupt handler to perform additional application-specific actions while the CapSense exit callback function CapSense_ExitCallback()is used at the end of the CapSense interrupt handler to perform additional application-specific actions.
7. In order to make use of the CapSense Entry/Exitcallback functions we have to define two macros CapSense_ENTRY_CALLBACK and CapSense_EXIT_CALLBACK associated with CapSense Entry and ExitCallback functions respectively through the ‘cyapicallbacks.h’ file.
8. The‘Task_Touch’ initializes the CapSense block, scans the widgets periodically, processes the widgets after each scan and sends the CapSense widgets new scanned data to ‘Task_RGB’ through the FreeRTOS Queue Structure. The ‘Touch_Task’ suspends periodically on waiting for the scan completion notification from the CapSense_ExitCallBack()function.
9. The‘Task_RGB’ performs some LED actions based on the received CapSense widgets data from the ‘Task_Touch’. Based on the Slider widget’s value the ‘Task_RGB’controls the intensity of RED LED on CY8CKIT-062-BLE PSoC 6 BLE Pioneer Kit. Sliding left will decrease the intensity of RED LED while sliding Right will increase. CapSense Button0 and Button1 toggles the GREEN and BLUE LEDs respectively on CY8CKIT-062-BLE PSoC 6 BLE Pioneer Kit.
Note: The initial/untouched Slider andButton values are 0xFF and 0x00 respectively.
Viewing Debug Messages-
This code example allows you to view debug messages from various tasks and functions using a serial port terminal emulator such as TeraTerm or HyperTerminal as below Figure shows.
Firmware Flow:
Comments
Please log in or sign up to comment.