-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFrSkySportSensorRpm.h
executable file
·45 lines (38 loc) · 1.15 KB
/
FrSkySportSensorRpm.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
/*
FrSky RPM sensor class for Teensy 3.x/LC and 328P based boards (e.g. Pro Mini, Nano, Uno)
(c) Pawelsky 20160919
Not for commercial use
*/
#ifndef _FRSKY_SPORT_SENSOR_RPM_H_
#define _FRSKY_SPORT_SENSOR_RPM_H_
#include "FrSkySportSensor.h"
#define RPM_DEFAULT_ID ID5
#define RPM_DATA_COUNT 3
#define RPM_T1_DATA_ID 0x0400
#define RPM_T2_DATA_ID 0x0410
#define RPM_ROT_DATA_ID 0x0500
#define RPM_T1_DATA_PERIOD 1000
#define RPM_T2_DATA_PERIOD 1000
#define RPM_ROT_DATA_PERIOD 500
class FrSkySportSensorRpm : public FrSkySportSensor
{
public:
FrSkySportSensorRpm(SensorId id = RPM_DEFAULT_ID);
void setData(uint32_t rpm, float t1 = 0.0, float t2 = 0.0);
virtual void send(FrSkySportSingleWireSerial& serial, uint8_t id, uint32_t now);
virtual uint16_t decodeData(uint8_t id, uint16_t appId, uint32_t data);
uint32_t getRpm();
int32_t getT1();
int32_t getT2();
private:
uint32_t rpmData;
int32_t t1Data;
int32_t t2Data;
uint32_t rpmTime;
uint32_t t1Time;
uint32_t t2Time;
uint32_t rpm;
int32_t t1;
int32_t t2;
};
#endif // _FRSKY_SPORT_SENSOR_RPM_H_