forked from theCarlG/NexaCtrl
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NexaCtrl.h
56 lines (42 loc) · 1.62 KB
/
NexaCtrl.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
#ifndef NexaCtrl_h
#define NexaCtrl_h
#include "Arduino.h"
class NexaCtrl
{
public:
NexaCtrl(unsigned int tx_pin, unsigned int rx_pin, unsigned int led_pin);
NexaCtrl(unsigned int tx_pin, unsigned int rx_pin);
void DeviceOn(unsigned long controller_id, unsigned int device_id);
void DeviceOff(unsigned long controller_id, unsigned int device_id);
void DeviceDim(unsigned long controller_id, unsigned int device_id, unsigned int dim_level);
void GroupOn(unsigned long controller_id);
void GroupOff(unsigned long controller_id);
private:
int tx_pin_;
int rx_pin_;
int led_pin_;
unsigned long controller_id_;
int* low_pulse_array;
const static int kPulseHigh;
const static int kPulseLow0;
const static int kPulseLow1;
const static int kLowPulseLength;
const static int kControllerIdOffset;
const static int kControllerIdLength;
const static int kGroupFlagOffset;
const static int kOnFlagOffset;
const static int kDeviceIdOffset;
const static int kDeviceIdLength;
const static int kDimOffset;
const static int kDimLength;
void SetBit(unsigned int bit_index, bool value);
void SetDeviceBits(unsigned int device_id);
void SetControllerBits(unsigned long controller_id);
void SendPair(bool on);
void Transmit(int pulse_length);
void TransmitLatch1(void);
void TransmitLatch2(void);
};
void itob(bool *bits, unsigned long, int length);
unsigned long power2(int power);
#endif /* NexaCtrl_h */