Added initial interfaces and some sensors implementing them

This commit is contained in:
Mihai Stefanescu
2018-06-12 18:46:49 +03:00
committed by Serban Waltter
parent 85608a9f61
commit e7820f2831
102 changed files with 1183 additions and 182 deletions

View File

@ -49,3 +49,9 @@ HCSR04::getDistance(HCSR04_U unit)
{
return hcsr04_get_distance(m_hcsr04, unit);
}
int
HCSR04::getDistance()
{
return getDistance(HCSR04_CM);
}

View File

@ -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 */ }