MSP430™CapTIvateSoftwareLibraryAPIGuide
1_83_00_05
|
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... | |
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.
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.
i32XComp,i32YComp | are the X and Y vectors |
uint16_t CAPT_computeSliderVectors | ( | tSensor * | pSlider | ) |
Calculate Slider Position
Slider position is calculated using a vector sum method.
pSlider | is a pointer to the Slider Sensor to process |
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.
i16Position | is the slider/wheel position to check for wrapping |
ui16MaxPosition | is the wrapping value (relating to 360degrees) |
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.
pSlider | is a pointer to the Slider Sensor to process |
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.
pSensor | is a pointer to the sensor to query |