upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions | Protected Attributes
TTP223 Class Reference

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.

ttp223.jpg
// Create the TTP223 touch sensor object using GPIO pin 0
upm::TTP223* touch = new upm::TTP223(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;
}
sleep(1);
}
// Delete the touch sensor object
delete touch;

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

Parameters
pinGPIO pin where the sensor is connected
~TTP223 ( )

TTP223 destructor

Member Function Documentation

std::string name ( )

Returns the name of this sensor

Returns
Name of this sensor
int value ( )

Gets the value from the GPIO pin

Returns
Value from the GPIO pin

Here is the caller graph for this function:

bool isPressed ( )

Determines whether the touch sensor is being touched

Returns
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.

Parameters
fptrPointer 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:

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: