grove: add grove button support and examples
Signed-off-by: Sarah Knepper <sarah.knepper@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
c5369315e9
commit
801209678b
@@ -247,4 +247,41 @@ class GroveSlide: public Grove {
|
||||
float m_ref_voltage;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief C++ API for Grove button
|
||||
*
|
||||
* Very basic UPM module for Grove button
|
||||
*
|
||||
* @ingroup grove gpio
|
||||
* @snippet grovebutton.cxx Interesting
|
||||
*/
|
||||
class GroveButton: public Grove {
|
||||
public:
|
||||
/**
|
||||
* Grove button constructor
|
||||
*
|
||||
* @param gpio pin to use
|
||||
*/
|
||||
GroveButton(unsigned int pin);
|
||||
/**
|
||||
* Grove button destructor
|
||||
*/
|
||||
~GroveButton();
|
||||
/**
|
||||
* Get name of sensor
|
||||
*
|
||||
* @return the name of this sensor
|
||||
*/
|
||||
std::string name();
|
||||
/**
|
||||
* Get value from GPIO pin
|
||||
*
|
||||
* @return the value from the GPIO pin
|
||||
*/
|
||||
int value();
|
||||
private:
|
||||
std::string m_name;
|
||||
mraa_gpio_context m_gpio;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user