mirror of
https://github.com/eclipse/upm.git
synced 2025-07-03 02:11:15 +03:00
Moved SWIG code from C++ files (hpp and cxx) to SWIG interface files (.i). Added getter/setter methods for classes with protected or private vars.
This commit is contained in:
@ -11,4 +11,13 @@
|
||||
|
||||
%include "ttp223.hpp"
|
||||
|
||||
#%ignore installISR(mraa::Edge , void *, void *)
|
||||
|
||||
%extend upm::TTP223 {
|
||||
void installISR(mraa::Edge level, jobject runnable)
|
||||
{
|
||||
$self->installISR(level, mraa_java_isr_callback, runnable);
|
||||
}
|
||||
}
|
||||
|
||||
JAVA_JNI_LOADLIBRARY(javaupm_ttp223)
|
||||
|
@ -31,7 +31,7 @@ using namespace upm;
|
||||
|
||||
TTP223::TTP223(unsigned int pin) {
|
||||
// initialize gpio input
|
||||
if ( !(m_gpio = mraa_gpio_init(pin)) )
|
||||
if ( !(m_gpio = mraa_gpio_init(pin)) )
|
||||
{
|
||||
throw std::invalid_argument(std::string(__FUNCTION__) +
|
||||
": mraa_gpio_init() failed, invalid pin?");
|
||||
@ -59,12 +59,6 @@ bool TTP223::isPressed() {
|
||||
return this->value() == 1;
|
||||
}
|
||||
|
||||
#ifdef JAVACALLBACK
|
||||
void TTP223::installISR(mraa::Edge level, jobject runnable)
|
||||
{
|
||||
installISR(level, mraa_java_isr_callback, runnable);
|
||||
}
|
||||
#endif
|
||||
|
||||
void TTP223::installISR(mraa::Edge level, void (*isr)(void *), void *arg)
|
||||
{
|
||||
|
@ -43,10 +43,10 @@ namespace upm {
|
||||
* @con gpio
|
||||
*
|
||||
* @brief API for the TTP223 Touch Sensor
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* button. The touch sensor can still function when placed under a
|
||||
* non-metallic surface like glass or plastic.
|
||||
*
|
||||
* @image html ttp223.jpg
|
||||
@ -95,11 +95,8 @@ class TTP223 {
|
||||
* @param arg Pointer to an object to be supplied as an
|
||||
* argument to the ISR.
|
||||
*/
|
||||
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
|
||||
void installISR(mraa::Edge level, jobject runnable);
|
||||
#else
|
||||
|
||||
void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
|
||||
#endif
|
||||
/**
|
||||
* Uninstalls the previously installed ISR
|
||||
*
|
||||
@ -107,9 +104,6 @@ class TTP223 {
|
||||
void uninstallISR();
|
||||
|
||||
protected:
|
||||
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
|
||||
void installISR(mraa::Edge level, void (*isr)(void *), void *arg);
|
||||
#endif
|
||||
std::string m_name; //!< name of this sensor
|
||||
mraa_gpio_context m_gpio; //!< GPIO pin
|
||||
bool m_isrInstalled;
|
||||
|
Reference in New Issue
Block a user