upm
1.0.2
Sensor/Actuator repository for libmraa (v1.1.1)
Main Page
Related Pages
UPM Libraries
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
wfs
wfs.hpp
1
/*
2
* Author: Jon Trulson <jtrulson@ics.com>
3
* Copyright (c) 2015 Intel Corporation.
4
*
5
* Permission is hereby granted, free of charge, to any person obtaining
6
* a copy of this software and associated documentation files (the
7
* "Software"), to deal in the Software without restriction, including
8
* without limitation the rights to use, copy, modify, merge, publish,
9
* distribute, sublicense, and/or sell copies of the Software, and to
10
* permit persons to whom the Software is furnished to do so, subject to
11
* the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be
14
* included in all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
*/
24
#pragma once
25
26
#include <string>
27
#include <stdint.h>
28
#include <sys/time.h>
29
#include <mraa/gpio.h>
30
31
namespace
upm {
32
68
class
WFS
{
69
public
:
75
WFS
(
int
pin);
79
~WFS
();
86
uint32_t
getMillis
();
87
92
void
initClock
();
93
99
void
clearFlowCounter
() { m_flowCounter = 0; };
100
105
void
startFlowCounter
();
106
111
void
stopFlowCounter
();
112
118
uint32_t
flowCounter
() {
return
m_flowCounter; };
119
125
float
flowRate
();
126
127
private
:
132
static
void
flowISR(
void
*ctx);
133
134
volatile
uint32_t m_flowCounter;
135
struct
timeval m_startTime;
136
mraa_gpio_context m_gpio;
137
bool
m_isrInstalled;
138
};
139
}
140
141
upm::WFS::flowCounter
uint32_t flowCounter()
Definition:
wfs.hpp:118
upm::WFS::clearFlowCounter
void clearFlowCounter()
Definition:
wfs.hpp:99
upm::WFS::getMillis
uint32_t getMillis()
Definition:
wfs.cxx:63
upm::WFS::stopFlowCounter
void stopFlowCounter()
Definition:
wfs.cxx:101
upm::WFS::initClock
void initClock()
Definition:
wfs.cxx:58
upm::WFS
API for the Grove Water Flow Sensor.
Definition:
wfs.hpp:68
upm::WFS::startFlowCounter
void startFlowCounter()
Definition:
wfs.cxx:91
upm::WFS::flowRate
float flowRate()
Definition:
wfs.cxx:115
upm::WFS::~WFS
~WFS()
Definition:
wfs.cxx:50
upm::WFS::WFS
WFS(int pin)
Definition:
wfs.cxx:34
Generated on Thu Dec 8 2016 16:18:49 for upm by
1.8.6