mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 01:41:12 +03:00
Added initial interfaces and some sensors implementing them
This commit is contained in:

committed by
Serban Waltter

parent
85608a9f61
commit
e7820f2831
@ -49,3 +49,9 @@ HCSR04::getDistance(HCSR04_U unit)
|
||||
{
|
||||
return hcsr04_get_distance(m_hcsr04, unit);
|
||||
}
|
||||
|
||||
int
|
||||
HCSR04::getDistance()
|
||||
{
|
||||
return getDistance(HCSR04_CM);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "hcsr04.h"
|
||||
#include <interfaces/iDistance.hpp>
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
@ -49,7 +50,7 @@ namespace upm {
|
||||
* @image html groveultrasonic.jpg
|
||||
* @snippet hcsr04.cxx Interesting
|
||||
*/
|
||||
class HCSR04 {
|
||||
class HCSR04 : virtual public iDistance {
|
||||
public:
|
||||
/**
|
||||
* Instantiates an HCSR04 object
|
||||
@ -70,6 +71,12 @@ class HCSR04 {
|
||||
*/
|
||||
double getDistance (HCSR04_U unit);
|
||||
|
||||
/**
|
||||
* Gets the distance from the sensor
|
||||
*
|
||||
* @return distance measured in cm.
|
||||
*/
|
||||
virtual int getDistance();
|
||||
private:
|
||||
hcsr04_context m_hcsr04;
|
||||
HCSR04(const HCSR04& src) { /* do not create copied constructor */ }
|
||||
|
Reference in New Issue
Block a user