-
Notifications
You must be signed in to change notification settings - Fork 0
/
RF24SensorNet_humid.cpp
52 lines (43 loc) · 1.05 KB
/
RF24SensorNet_humid.cpp
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
/*
RF24SensorNet
A library for sending standard sensor and actuator
messages between nodes connected using RF24Network.
Handling for temperature sensors.
--
Peter Hardy <[email protected]>
*/
#ifndef __RF24_SENSOR_NET_HUMID_H__
#define __RF24_SENSOR_NET_HUMID_H__
#if ARDUINO < 100
#include <WProgram.h>
#else
#include <Arduino.h>
#endif
#include "RF24Network.h"
#include "RF24SensorNet.h"
#include "RF24SensorNet_types.h"
void RF24SensorNet::addHumidReadHandler(humidReadHandler handler)
{
_humidReadHandler = handler;
}
void RF24SensorNet::addHumidRcvHandler(humidRcvHandler handler)
{
_humidRcvHandler = handler;
}
bool RF24SensorNet::readHumid(uint16_t toAddr, uint16_t id)
{
pkt_humid_t payload;
payload.id = id;
payload.humidity = 0;
bool ok = _write(toAddr, PKT_HUMID+32, &payload);
return ok;
}
bool RF24SensorNet::sendHumid(uint16_t toAddr, uint16_t id, uint16_t humidity)
{
pkt_humid_t payload;
payload.id = id;
payload.humidity = humidity;
bool ok = _write(toAddr, PKT_HUMID, &payload);
return ok;
}
#endif