Fork of Kojto's library with bugfixes: * added PTC2/TSI0_CH15 pinmapping for KL25 and KL46 MCUs * Fixed readDistance() function

Fork of tsi_sensor by Martin Kojtal

Embed: (wiki syntax)

« Back to documentation index

TSIAnalogSlider Class Reference

TSIAnalogSlider Class Reference

Analog slider which consists of two electrodes. More...

#include <tsi_sensor.h>

Public Member Functions

 TSIAnalogSlider (PinName elec0, PinName elec1, uint32_t range)
 Initialize the TSI Touch Sensor with the given PinNames.
 TSIAnalogSlider (uint32_t elec0, uint32_t elec1, uint32_t range)
 Initialize the TSI Touch Sensor.
float readPercentage ()
 Read Touch Sensor percentage value.
uint32_t readDistance ()
 Read Touch Sensor distance.
TSIElectrodegetCurrentElectrode ()
 Get current electrode.
void setCurrentElectrode (TSIElectrode *elec)
 Set current electrode which is being measured.
TSIElectrodegetNextElectrode (TSIElectrode *electrode)
 Get next electrode.
uint32_t getAbsoluteDistance ()
 Return absolute distance position.
uint32_t getAbsolutePosition ()
 Return absolute precentage position.
void setScan (uint32_t scan)
 Set value to the scan in progress flag.

Static Public Member Functions

static TSIAnalogSlidergetInstance ()
 Return instance to Analog slider.

Detailed Description

Analog slider which consists of two electrodes.

Definition at line 153 of file tsi_sensor.h.


Constructor & Destructor Documentation

TSIAnalogSlider ( PinName  elec0,
PinName  elec1,
uint32_t  range 
)

Initialize the TSI Touch Sensor with the given PinNames.

Definition at line 27 of file tsi_sensor.cpp.

TSIAnalogSlider ( uint32_t  elec0,
uint32_t  elec1,
uint32_t  range 
)

Initialize the TSI Touch Sensor.

Definition at line 30 of file tsi_sensor.cpp.


Member Function Documentation

uint32_t getAbsoluteDistance (  )

Return absolute distance position.

Definition at line 197 of file tsi_sensor.h.

uint32_t getAbsolutePosition (  )

Return absolute precentage position.

Definition at line 202 of file tsi_sensor.h.

TSIElectrode* getCurrentElectrode (  )

Get current electrode.

Definition at line 178 of file tsi_sensor.h.

static TSIAnalogSlider* getInstance (  ) [static]

Return instance to Analog slider.

Used in tsi irq.

Definition at line 212 of file tsi_sensor.h.

TSIElectrode* getNextElectrode ( TSIElectrode electrode )

Get next electrode.

Definition at line 188 of file tsi_sensor.h.

uint32_t readDistance (  )

Read Touch Sensor distance.

Returns:
distance in mm. The value is between [0 ... _range]

Definition at line 130 of file tsi_sensor.cpp.

float readPercentage (  )

Read Touch Sensor percentage value.

Returns:
percentage value between [0 ... 1]

Definition at line 125 of file tsi_sensor.cpp.

void setCurrentElectrode ( TSIElectrode elec )

Set current electrode which is being measured.

Definition at line 183 of file tsi_sensor.h.

void setScan ( uint32_t  scan )

Set value to the scan in progress flag.

Definition at line 207 of file tsi_sensor.h.