/******************************************************************************* * Function Name: CapSense_DisplayState ******************************************************************************** * * Summary: * Get current CapSense State * * Parameters: * None * Return: * uint32: Position on slider * *******************************************************************************/ uint32 CapSense_DisplayState(void) { /* Find Slider Position */ curPos = CapSense_CSD_GetCentroidPos(CapSense_CSD_LINEARSLIDER0__LS); /* Reset position */ if(curPos == 0xFFFFu) { curPos = 0u; } /* Move bargraph */ if (curPos != oldPos) { oldPos = curPos; /* Display Slider bargraph */ if (curPos != 0u) { uint32 myInt = (uint32)curPos << SLIDER_POS_TO_COMPARE_SHIFT; return myInt; } } //not moved return -1; }
/******************************************************************************* * Function Name: CapSense_DisplayState ******************************************************************************** * Summary: * Changes LEDs brightness by changing the duty cycle of PWM signals. * * Parameters: * None * * Return: * None * *******************************************************************************/ void CapSense_DisplayState(void) { /* Find Slider Position */ curPos = CapSense_CSD_GetCentroidPos(CapSense_CSD_LINEARSLIDER0__LS); /* Reset position */ if(curPos == 0xFFFFu) { curPos = 0u; } /* Move bargraph */ if (curPos != oldPos) { oldPos = curPos; /* Display Slider bargraph */ if (curPos != 0u) { LED_CONTROL_WriteCompare((uint32)curPos << SLIDER_POS_TO_COMPARE_SHIFT); } } }