LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
dmx.h
Go to the documentation of this file.
1/* Copyright © 2017-2018 Andrey Klimov. All rights reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14
15Homepage: http://lazyhome.ru
16GIT: https://github.com/anklimov/lighthub
17e-mail anklimov@gmail.com
18
19 */
29#define D_UPDATED1 1
30#define D_UPDATED2 2
31#define D_UPDATED3 4
32#define D_UPDATED4 8
33#define D_CHECKT 300
34
35//#define MAX_CHANNELS 60
36//define MAX_IN_CHANNELS 16
37
38//#define DMX_OUT_PIN 3
39
40#include "options.h"
41
42#if defined(_dmxout)
43
44#if defined DMX_SMOOTH
45
46#if defined(ARDUINO_ARCH_AVR)
47#include <DmxSimple.h>
48#define DmxWrite DmxSimple.write
49//#define DmxWrite DmxWriteBuf
50#endif
51
52#if defined(ESP8266)
53#include <ESPDMX.h>
54extern DMXESPSerial dmxout;
55#define DmxWrite dmxout.write
56//#define DmxWrite DmxWriteBuf
57#endif
58
59#if defined(ARDUINO_ARCH_ESP32)
60#include <ESPDMX.h>
61extern DMXESPSerial dmxout;
62#define DmxWrite dmxout.write
63//#define DmxWrite DmxWriteBuf
64#endif
65
66#if defined(__SAM3X8E__)
67#include <DmxDue.h>
68#define DmxWrite2 dmxout.write
69#define DmxWrite DmxWriteBuf
70#endif
71
72#else
73#if defined(ARDUINO_ARCH_AVR)
74#include <DmxSimple.h>
75#define DmxWrite DmxSimple.write
76#endif
77
78#if defined(ESP8266)
79#include <ESPDMX.h>
80extern DMXESPSerial dmxout;
81#define DmxWrite dmxout.write
82#endif
83
84#if defined(ARDUINO_ARCH_ESP32)
85#include <ESPDMX.h>
86extern DMXESPSerial dmxout;
87#define DmxWrite dmxout.write
88#endif
89
90#if defined(__SAM3X8E__)
91#include <DmxDue.h>
92#define DmxWrite dmxout.write
93#endif
94
95#endif
96#endif
97
98#ifdef _artnet
99#include <Artnet.h>
100extern Artnet *artnet;
101#endif
102
103#ifdef _dmxin
104#if defined(ARDUINO_ARCH_AVR)
105#include <DMXSerial.h>
106#endif
107#endif
108
109#include "aJSON.h"
110
112extern aJsonObject *dmxArr;
113
122void DMXput(void);
127void DMXinSetup(int channels);
132void DMXoutSetup(int channels);
136void artnetSetup();
142void artnetSetChans(uint8_t minCh, uint8_t maxCh);
147void DMXCheck(void);
157int itemCtrl2(char* name,int r,int g, int b, int w);
163void DmxWriteBuf(uint16_t chan,uint8_t val);
167void DMXOUT_propagate();
aJsonObject * dmxArr
Definition main.cpp:131
void DMXCheck(void)
DMX housekeeping called from the main loop: propagates changes and services pending DMX-in updates.
Definition dmx.cpp:256
void artnetSetup()
Initializes the Art-Net receiver and wires its frame callback.
Definition dmx.cpp:402
void DmxWriteBuf(uint16_t chan, uint8_t val)
Writes a value into the intermediate (smoothing) DMX output buffer.
Definition dmx.cpp:423
void DMXinSetup(int channels)
Sets up the DMX input for the given number of channels.
Definition dmx.cpp:295
void DMXOUT_propagate()
Smoothly ramps the actual DMX output toward the buffered target.
Definition dmx.cpp:365
void DMXput(void)
Propagates received DMX input frames to the mapped items.
Definition dmx.cpp:206
int itemCtrl2(char *name, int r, int g, int b, int w)
Drives a named DMX/LED item with an RGB(W) value.
Definition dmx.cpp:120
void artnetSetChans(uint8_t minCh, uint8_t maxCh)
Restricts the Art-Net channel range that is forwarded.
Definition dmx.cpp:415
void DMXoutSetup(int channels)
Sets up the DMX output for the given number of channels.
Definition dmx.cpp:327
#define b
Definition item.cpp:2411