upm  1.5.0
Sensor/Actuator repository for libmraa (v1.8.0)
Public Member Functions | Protected Attributes

API for the TTP223 Touch Sensor. More...

Detailed Description

This touch sensor detects when a finger is near the metallic pad by the change in capacitance. It can replace a more traditional push button. The touch sensor can still function when placed under a non-metallic surface like glass or plastic.

// Create the TTP223 touch sensor object using GPIO pin 0
upm::TTP223 touch(0);
// Check whether or not a finger is near the touch sensor and
// print accordingly, waiting one second between readings
while (1) {
if (touch.isPressed()) {
std::cout << touch.name() << " is pressed" << std::endl;
} else {
std::cout << touch.name() << " is not pressed" << std::endl;
// Delete the touch sensor object

Public Member Functions

 TTP223 (unsigned int pin)
 ~TTP223 ()
std::string name ()
int value ()
bool isPressed ()
void installISR (mraa::Edge level, void(*isr)(void *), void *arg)
void uninstallISR ()

Protected Attributes

std::string m_name
 name of this sensor
mraa_gpio_context m_gpio
 GPIO pin.
bool m_isrInstalled

Constructor & Destructor Documentation

TTP223 ( unsigned int  pin)

TTP223 constructor

pinGPIO pin where the sensor is connected
~TTP223 ( )

TTP223 destructor

Member Function Documentation

std::string name ( )

Returns the name of this sensor

Name of this sensor
int value ( )

Gets the value from the GPIO pin

Value from the GPIO pin

Here is the caller graph for this function:

bool isPressed ( )

Determines whether the touch sensor is being touched

True if touched, false otherwise

Here is the call graph for this function:

void installISR ( mraa::Edge  level,
void(*)(void *)  isr,
void *  arg 

Installs an interrupt service routine (ISR) to be called when the button is activated or deactivated.

isrPointer to a function to be called on interrupt
argPointer to an object to be supplied as an argument to the ISR.

Here is the call graph for this function:

Here is the caller graph for this function:

void uninstallISR ( )

Uninstalls the previously installed ISR

Here is the caller graph for this function:

The documentation for this class was generated from the following files: