Callbacks allow the user to execute Custom code called from the CapSense middleware when an event occurs.
CapSense supports two callbacks.
# | Callback Name | Associated Register | Callback Function Prototype | Description |
---|---|---|---|---|
1 | Start Sample | ptrSSCallback | cy_capsense_callback_t | This is called before each sensor scan triggering. Such a callback can be used to implement user-specific use cases like changing scan parameters depending on whether a sensor is going to be scanned. |
2 | End Of Scan | ptrEOSCallback | cy_capsense_callback_t | This is called after sensor scan completion and there is no other sensor in the queue to be scanned. |
3 | Tuner Send Callback | ptrTunerSendCallback | cy_capsense_tuner_send_callback_t | This is called by the Cy_CapSense_RunTuner() function to establish synchronus communication with the Tuner tool. |
4 | Tuner Receive Callback | ptrTunerReceiveCallback | cy_capsense_tuner_receive_callback_t | This is called by the Cy_CapSense_RunTuner() function to establish synchronus communication with the Tuner tool. |
All callbacks can be registered by direct assignment of the function pointers to the corresponding CapSense Data Structure field as follows: context->ptrCommonContext-><Associated Register> = &CallbackFunction;
Callbacks 2 and 3 can be registered / unregistered using the Cy_CapSense_RegisterCallback() and Cy_CapSense_UnRegisterCallback() function.