MSP430™CapTIvateSoftwareLibraryAPIGuide  1_83_00_05
Functions
CAPT_Slider

High level slider and wheel processing module. More...

Functions

uint16_t CAPT_computeArcTanApprox (int32_t i32XComp, int32_t i32YComp)
 
uint16_t CAPT_computeSliderVectors (tSensor *pSlider)
 
uint16_t CAPT_computeWheelWrap (int16_t i16Position, uint16_t ui16MaxPosition)
 
void CAPT_processSlider (tSensor *pSlider)
 
uint16_t CAPT_getSensorPosition (tSensor *pSensor)
 Get the position value for a slider or wheel sensor. More...
 

Detailed Description

High level slider and wheel processing module.

Slider processing APIs apply to sliders and wheels. Sliders and wheels share sensor structures (tSlider). A wheel is identical to a slider, except its filtering algorithm allows wrap-around on the endpoints.

Version
VERSION Released on RELEASE_DATE

Function Documentation

§ CAPT_computeArcTanApprox()

uint16_t CAPT_computeArcTanApprox ( int32_t  i32XComp,
int32_t  i32YComp 
)

Trigonometric Arctan approximation

Perform an arctan(YComp/XComp) approximation using a linear approximation with basic error correction, to give max error of +- 1 degree. A full 0 to 360 degree output range is achieved.

Parameters
i32XComp,i32YCompare the X and Y vectors
Returns
approximated arctan(Y/X) value (0 to 360 degrees mapped from 0 to 65535)

§ CAPT_computeSliderVectors()

uint16_t CAPT_computeSliderVectors ( tSensor pSlider)

Calculate Slider Position

Slider position is calculated using a vector sum method.

Parameters
pSlideris a pointer to the Slider Sensor to process
Returns
Slider position

§ CAPT_computeWheelWrap()

uint16_t CAPT_computeWheelWrap ( int16_t  i16Position,
uint16_t  ui16MaxPosition 
)

Test for a wrap on slider / wheel

With the slider/wheel functionality working in a 0-360 degree vector plane, a value must always be checked if it has not wrapped, and thus must be kept between 0 and 360.

Parameters
i16Positionis the slider/wheel position to check for wrapping
ui16MaxPositionis the wrapping value (relating to 360degrees)
Returns
the adjusted position to fit in 0 to slider/wheel resolution

§ CAPT_processSlider()

void CAPT_processSlider ( tSensor pSlider)

Perform processing for a Slider

Here processing is performed on a slider sensor implementation. This includes calculating the slider output position and filtering of this position.

Parameters
pSlideris a pointer to the Slider Sensor to process
Returns
none

§ CAPT_getSensorPosition()

uint16_t CAPT_getSensorPosition ( tSensor pSensor)

Get the position value for a slider or wheel sensor.

This function provides easy access to the slider or wheel position value.

Parameters
pSensoris a pointer to the sensor to query
Returns
The current slider position if touched, else 0xFFFF.
© Copyright 1995-2020, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale