- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I wanted a simple proximity sensor demo that would work on ModusToolbox, but there isn’t one, so I made one.
The base was based on the CapSense sample for MTB and CE218137.
The environment used is as follows:
・ModusToolbox 2.2.1
・CY8CKIT-062-BLE
The settings of the peripherals (Pin and CapSense) are the same as CE218137, but they are set for ModusToolbox.
First, the CapSense settings are configured in the CapSense Configurator, which is the same as CE218137.
The LED and PWM are set programmatically, as it is using the CapSense sample for ModusToolbox.
The touch process is as follows:
-----------------
static void process_touch(void)
{
static uint32_t currentProxData = 0u;
static led_data_t led_data = {LED_ON, LED_MAX_BRIGHTNESS};
if(CY_CAPSENSE_PROXIMITY0_SNS0_DIFF0_VALUE >
CY_CAPSENSE_PROXIMITY0_FINGER_TH_VALUE)
{
/*If proximity value is not within the range, cap the value */
if((CY_CAPSENSE_PROXIMITY0_SNS0_DIFF0_VALUE -
CY_CAPSENSE_PROXIMITY0_FINGER_TH_VALUE)
<= UINT8_MAX)
{
/* Store the proximity data */
currentProxData = (uint8_t)(CY_CAPSENSE_PROXIMITY0_SNS0_DIFF0_VALUE -
CY_CAPSENSE_PROXIMITY0_FINGER_TH_VALUE);
}
/* Store the maximum value otherwise */
else
{
currentProxData = (uint8_t)UINT8_MAX;
}
}
led_data.brightness = currentProxData;
update_led_state(&led_data);
}
-----------------
CapSense Tuner can be used in this sample, so please use it for fine adjustment.
Thanks,
Kenshow
- Labels:
-
ispn:39619:1:0
-
l1:314:1:0
-
PSoc6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @Kenshow ,
Thank you for sharing this example project with the community. Appreciate your effort in creating this 🙂
Regards,
Dheeraj