Button: Removed grove dependency

* Renamed all files from groverrotary to rotary
    * Replaced all instances of groverrotary with rotary
    * Updated all CMake files

Signed-off-by: Sisinty Sasmita Patra <sisinty.s.patra@intel.com>
This commit is contained in:
Sisinty Sasmita Patra
2016-09-13 12:06:37 -07:00
committed by Noel Eck
parent 6a6a572069
commit 3753a1be5c
20 changed files with 84 additions and 42 deletions

View File

@ -0,0 +1,5 @@
upm_mixed_module_init (NAME button
DESCRIPTION "UPM Button Module: button"
CPP_HDR button.hpp
CPP_SRC button.cxx
REQUIRES mraa)

View File

@ -28,11 +28,11 @@
#include <string>
#include <stdexcept>
#include "grovebutton.hpp"
#include "button.hpp"
using namespace upm;
GroveButton::GroveButton(unsigned int pin)
Button::Button(unsigned int pin)
{
if ( !(m_gpio = mraa_gpio_init(pin)) ) {
throw std::invalid_argument(std::string(__FUNCTION__) +
@ -43,29 +43,29 @@ GroveButton::GroveButton(unsigned int pin)
m_name = "Button Sensor";
}
GroveButton::~GroveButton()
Button::~Button()
{
mraa_gpio_close(m_gpio);
}
std::string GroveButton::name()
std::string Button::name()
{
return m_name;
}
int GroveButton::value()
int Button::value()
{
return mraa_gpio_read(m_gpio);
}
#ifdef JAVACALLBACK
void GroveButton::installISR(mraa::Edge level, jobject runnable)
void Button::installISR(mraa::Edge level, jobject runnable)
{
installISR(level, mraa_java_isr_callback, runnable);
}
#endif
void GroveButton::installISR(mraa::Edge level, void (*isr)(void *), void *arg)
void Button::installISR(mraa::Edge level, void (*isr)(void *), void *arg)
{
if (m_isrInstalled)
uninstallISR();
@ -75,7 +75,7 @@ void GroveButton::installISR(mraa::Edge level, void (*isr)(void *), void *arg)
m_isrInstalled = true;
}
void GroveButton::uninstallISR()
void Button::uninstallISR()
{
mraa_gpio_isr_exit(m_gpio);
m_isrInstalled = false;

View File

@ -28,39 +28,38 @@
#include <string>
#include <mraa/gpio.hpp>
#include "grovebase.hpp"
namespace upm {
/**
* @library grove
* @sensor grovebutton
* @comname Grove Button
* @library button
* @sensor button libupm-button
* @comname Button
* @altname Grove Touch Sensor
* @type button touch
* @man seeed
* @con gpio
* @kit gsk
*
* @brief API for the Grove Button
* @brief API for the Button
*
* Basic UPM module for the Grove button
* Basic UPM module for the button sensor
*
* @image html grovebutton.jpg
* @snippet grovebutton.cxx Interesting
* @image html button.jpg
* @snippet button.cxx Interesting
*/
class GroveButton: public Grove {
class Button{
public:
/**
* Grove button constructor
*
* @param gpio Pin to use
*/
GroveButton(unsigned int pin);
Button(unsigned int pin);
/**
* Grove button destructor
*/
~GroveButton();
~Button();
/**
* Gets the name of the sensor
*

View File

@ -0,0 +1,19 @@
%module javaupm_button
%include "../upm.i"
%{
#include "button.hpp"
%}
%include "button.hpp"
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("javaupm_button");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}

View File

@ -0,0 +1,8 @@
%module jsupm_button
%include "../upm.i"
%{
#include "button.hpp"
%}
%include "button.hpp"

11
src/button/pyupm_button.i Normal file
View File

@ -0,0 +1,11 @@
// Include doxygen-generated documentation
%include "pyupm_doxy2swig.i"
%module pyupm_button
%include "../upm.i"
%feature("autodoc", "3");
%include "button.hpp"
%{
#include "button.hpp"
%}

View File

@ -1,7 +1,7 @@
upm_mixed_module_init (NAME grove
DESCRIPTION "upm grove module"
CPP_HDR grovebutton.hpp groveled.hpp
CPP_HDR groveled.hpp
grovetemp.hpp grovebase.hpp grove.hpp
CPP_SRC grovebutton.cxx groveled.cxx
CPP_SRC groveled.cxx
grovetemp.cxx
REQUIRES mraa)

View File

@ -25,6 +25,6 @@
*/
#pragma once
#include <grovebutton.hpp>
#include <button.hpp>
#include <groveled.hpp>
#include <grovetemp.hpp>

View File

@ -14,9 +14,9 @@
#include "grovebase.hpp"
%}
%include "grovebutton.hpp"
%include "button.hpp"
%{
#include "grovebutton.hpp"
#include "button.hpp"
%}
%include "groveled.hpp"

View File

@ -11,9 +11,9 @@
#include "grovebase.hpp"
%}
%include "grovebutton.hpp"
%include "button.hpp"
%{
#include "grovebutton.hpp"
#include "button.hpp"
%}
%include "groveled.hpp"

View File

@ -15,9 +15,9 @@
#include "grovebase.hpp"
%}
%include "grovebutton.hpp"
%include "button.hpp"
%{
#include "grovebutton.hpp"
#include "button.hpp"
%}
%include "groveled.hpp"