-
Notifications
You must be signed in to change notification settings - Fork 8
/
NexaCtrl.h
55 lines (41 loc) · 1.54 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
#ifndef NexaCtrl_h
#define NexaCtrl_h
#include "Arduino.h"
class NexaCtrl
{
public:
NexaCtrl(int tx_pin, int rx_pin=-1, int led_pin=-1);
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 */