EHR: Removed Grove dependency

Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
Abhishek Malik
2016-09-13 11:10:13 -07:00
committed by Noel Eck
parent f9a36314fb
commit a08b8bbcb0
14 changed files with 61 additions and 61 deletions

5
src/ehr/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
upm_mixed_module_init (NAME ehr
DESCRIPTION "upm ear-clip heart rate sensor module"
CPP_HDR ehr.hpp
CPP_SRC ehr.cxx
REQUIRES mraa)

View File

@ -26,12 +26,12 @@
#include <string>
#include <stdexcept>
#include "groveehr.hpp"
#include "ehr.hpp"
using namespace upm;
using namespace std;
GroveEHR::GroveEHR(int pin)
EHR::EHR(int pin)
{
if ( !(m_gpio = mraa_gpio_init(pin)) )
{
@ -46,17 +46,17 @@ GroveEHR::GroveEHR(int pin)
m_beatCounter = 0;
}
GroveEHR::~GroveEHR()
EHR::~EHR()
{
mraa_gpio_close(m_gpio);
}
void GroveEHR::initClock()
void EHR::initClock()
{
gettimeofday(&m_startTime, NULL);
}
uint32_t GroveEHR::getMillis()
uint32_t EHR::getMillis()
{
struct timeval elapsed, now;
uint32_t elapse;
@ -84,36 +84,36 @@ uint32_t GroveEHR::getMillis()
return elapse;
}
void GroveEHR::clearBeatCounter()
void EHR::clearBeatCounter()
{
m_beatCounter = 0;
}
void GroveEHR::startBeatCounter()
void EHR::startBeatCounter()
{
// install our interrupt handler
mraa_gpio_isr(m_gpio, MRAA_GPIO_EDGE_RISING,
&beatISR, this);
}
void GroveEHR::stopBeatCounter()
void EHR::stopBeatCounter()
{
// remove the interrupt handler
mraa_gpio_isr_exit(m_gpio);
}
uint32_t GroveEHR::beatCounter()
uint32_t EHR::beatCounter()
{
return m_beatCounter;
}
void GroveEHR::beatISR(void *ctx)
void EHR::beatISR(void *ctx)
{
upm::GroveEHR *This = (upm::GroveEHR *)ctx;
upm::EHR *This = (upm::EHR *)ctx;
This->m_beatCounter++;
}
int GroveEHR::heartRate()
int EHR::heartRate()
{
uint32_t millis = getMillis();
uint32_t beats = beatCounter();

View File

@ -30,39 +30,39 @@
namespace upm {
/**
* @brief Grove Ear-clip Heart Rate Sensor library
* @defgroup groveehr libupm-groveehr
* @brief Ear-clip Heart Rate Sensor library
* @defgroup ehr libupm-ehr
* @ingroup seeed gpio medical
*/
/**
* @library groveehr
* @sensor groveehr
* @comname Grove Ear-clip Heart Rate Sensor
* @library ehr
* @sensor ehr
* @comname Ear-clip Heart Rate Sensor
* @type medical
* @man seeed
* @con gpio
*
* @brief API for the Grove Ear-clip Heart Rate Sensor
* @brief API for the Ear-clip Heart Rate Sensor
*
* UPM module for the Grove ear-clip heart rate sensor. It is used to measure your
* UPM module for the ear-clip heart rate sensor. It is used to measure your
* heart rate.
*
* @image html groveehr.jpg
* @snippet groveehr.cxx Interesting
* @image html ehr.jpg
* @snippet ehr.cxx Interesting
*/
class GroveEHR {
class EHR {
public:
/**
* GroveEHR constructor
* EHR constructor
*
* @param pin Digital pin to use
*/
GroveEHR(int pin);
EHR(int pin);
/**
* GroveEHR destructor
* EHR destructor
*/
~GroveEHR();
~EHR();
/**
* Returns the time of milliseconds elapsed since initClock()
* was last called.

View File

@ -1,18 +1,18 @@
%module javaupm_groveehr
%module javaupm_ehr
%include "../upm.i"
%ignore beatISR;
%{
#include "groveehr.hpp"
#include "ehr.hpp"
%}
%include "groveehr.hpp"
%include "ehr.hpp"
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("javaupm_groveehr");
System.loadLibrary("javaupm_ehr");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);

8
src/ehr/jsupm_ehr.i Normal file
View File

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

View File

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

View File

@ -1,5 +0,0 @@
set (libname "groveehr")
set (libdescription "upm grove ear-clip heart rate sensor module")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
upm_module_init()

View File

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