Hello,
I have created a trackpad using the PSoc 4 MCU that will be utilized as a BLE Mouse to control a cursor on a computer screen. I would also like to collect information on the position of the finger on the trackpad. Up until now, I have used the Launch tuner to log this position data, however, I would ideally like this to be done on a computer software. How can change the provided BLE HID Mouse code by Cypress to read information related to the position of the finger on the trackpad rather than the displacement?
Thank you,
Hi,
Can you please tell us the code example are you referring to for your present application (if any)?
You can use the following API in CapSense component datasheet
uint32 CapSense_GetXYCoordinates (uint32 widgetId) which returns the X and Y co-ordinates.
You can create a custom service and custom characteristic which can stores these X and Y co-ordinates and send these values using notifications.
Kindly let me know if the above information helps or if you need other/more information.
Thanks
Ganesh
Hi,
Additional to previous response, we recommend you to go through the following code example if you are developing a Trackpad remote with BLE.
Thanks and regards
Ganesh
Hello,
Thank you for the documentation. I am not looking to develop a remote trackpad--just a trackpad. I would like to use the dongle/CySmart to view and log the x/y positional data from the trackpad via Bluetooth. Is this the best documentation to follow/modify in order to do so? or is there a different document that would help me further.
Thank you,
Hi,
In the code example CE224821 obtained from the link below, you can see how to get the X and Y co-ordinates of the finger from the Trackpad using the API CapSense_GetXYCoordinates(CapSense_TOUCHPAD0_WDGT_ID);.
https://www.cypress.com/documentation/code-examples/ce224821-psoc-4-capsense-touchpad-gestures
If you want to transmit these data over the air, you can use a custom service and send a notification if your trackpad is in peripheral side. Please find the attached projects for Central_Client and Peripheral_Server where you can find the APIs used in Central and peripheral side to transmit the data across two peers.
Thanks and regards
Ganesh
Hello,
Do you have any examples on how to save and access API's, specifically, the "CapSense_GetXYCoordinates"? It seems that is what I am looking for. Also, do you have any documentation on creating custom services? I am new to Cypress and could use any guidance provided.
Thank you so much for your help.
Hi,
Do you have any examples on how to save and access API's, specifically, the "CapSense_GetXYCoordinates"?
Please refer the code example CE224821 obtained from the link below:
https://www.cypress.com/documentation/code-examples/ce224821-psoc-4-capsense-touchpad-gestures
Also, do you have any documentation on creating custom services?
Please go through the following application note:
Thanks
Ganesh
Hello,
Thank you. This worked perfectly well. I created one custom BLE service containing two characteristics (one with the x value and one with the y value). I can see both values being updated using the dongle. Ideally, I would like to log both piece of information on the dongle. Is there a way to do this?
Hi,
Please refer section 2.11 Log Window in the CySmart for Windows application note obtained from the link below which tells you how to save the data to the log.
https://www.cypress.com/file/232316/download
You need to extract the characteristic data from the log file using a custom script.
Thanks
Ganesh
Thank you. That was very helpful. Now, I would like to send the X-coordinate and Y-coordinate as an array. Currently I have this code sending only YCoordinate info:
tempHandle.attrHandle = CYBLE_LEDCAPSENSE_CAPSENSE2_CHAR_HANDLE;
tempHandle.value.val = (uint8 *)&YCoor ;
tempHandle.value.len = 2;
How can I update tempHandle.value.val to send two pieces of information? I tried to make this an array and got errors.
Thank you for all your help. The Cypress Community is incredibly impressive in how quickly supportive, helpful responses are given.
Hi,
You can use something like this:
uint8 data[2];
data[0] = YCoor;
data[1] = XCoor;
tempHandle.attrHandle = CYBLE_LEDCAPSENSE_CAPSENSE2_CHAR_HANDLE;
tempHandle.value.val = data;
tempHandle.value.len = 2;
Please try this and let me know if you see any issues.
Thanks
Ganesh
Hello,
Thank you--that method worked. The trouble I am now having is that by assigning the variable "data" to a uint8, I cannot report values greater than 255. My trackpad is 340 (maximum X position) by 440 (maximum Y position), therefore I am missing a lot of values. How can I fix this issue? I noticed that the setting tempHandle.value.val requires a uint8 variable.
Let me know if you need more clarification on this issue. I so appreciate your help.
Hello,
I am just following up on my previous question. I appreciate your help.