-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCurrentSensor.h
57 lines (42 loc) · 1.11 KB
/
CurrentSensor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* Copyright (C) 2015 Willi Menapace <willi.menapace@gmail.com>, Simone Lorengo <simone@lorengo.org> - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Simone Lorengo <simone@lorengo.org>
*/
#ifndef CURRENT_SENSOR_INCLUDED
#define CURRENT_SENSOR_INCLUDED
#include "GlobalDefines.h"
#ifdef ONBOARD
#include "EmonLib.h"
#include "Sensor.h"
/**
* Rappresenta un sensore di corrente elettrica alternata
* Modello di riferimento: ACS712 20A
*/
class CurrentSensor : public Sensor {
private:
SensorType type;
int sensorPin;
long offset;
EnergyMonitor sensor;
/**
* @return valore non elaborato
*/
long getRaw();
public:
SensorType getType();
/**
* @return valore elaborato del sensore in Amper RMS (Irms)
*/
long readValue();
/**
* Imposta un offset per la calibrazione del sensore
*/
void setOffset(long calibOffset);
/**
* Crea un sensore di tipo CURRENT
*/
CurrentSensor(int sensorAnalogPin);
};
#endif //ONBOARD
#endif // CURRENT_SENSOR_INCLUDED