-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSMPWM01A.h
53 lines (33 loc) · 1002 Bytes
/
SMPWM01A.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
// Amphenol Advanced Sensors SMPWM01A
// http://www.digikey.com/product-detail/en/SM-PWM-01A/235-1372-ND/5012137
// Application Notes
// http://www.digikey.com/Web%20Export/Supplier%20Content/amphenol-advanced-sensors-45/pdf/amphenol-advanced-smart-sensor.pdf?redirected=1
//
// Pin1 - GND
// Pin2 - OUTPUT P2 particles > 2um - Micro digital pin 4
// Pin3 - 5V
// Pin4 - OUTPUT P1 particles ~ 1um - Micro digital pin 5
// Pin5 - NC
//
#ifndef SMPWM01A_h
#define SMPWM01A_h
#include <Arduino.h>
#define P2 4
#define P1 5
#define FILTER_WEIGHT 2.0 //set to 1.0 for no filtering
#define SAMPLE_MS 4000ul
class SMPWM01A {
public:
SMPWM01A();
void begin();
static void PCINT2_ISR();
static void TIMER1_COMPA_ISR();
float getPM2();
float getPM10();
private:
static int statePM10, statePM02;
static unsigned long startPM10, startPM02;
static volatile unsigned long lpoPM10, lpoPM02;
static float concPM10, concPM02;
};
#endif