LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
dmx.h File Reference

DMX input/output (and Art-Net) support. More...

#include "options.h"
#include "aJSON.h"

Go to the source code of this file.

Macros

#define D_UPDATED1   1
#define D_UPDATED2   2
#define D_UPDATED3   4
#define D_UPDATED4   8
#define D_CHECKT   300

Functions

void DMXput (void)
 Propagates received DMX input frames to the mapped items.
void DMXinSetup (int channels)
 Sets up the DMX input for the given number of channels.
void DMXoutSetup (int channels)
 Sets up the DMX output for the given number of channels.
void artnetSetup ()
 Initializes the Art-Net receiver and wires its frame callback.
void artnetSetChans (uint8_t minCh, uint8_t maxCh)
 Restricts the Art-Net channel range that is forwarded.
void DMXCheck (void)
 DMX housekeeping called from the main loop: propagates changes and services pending DMX-in updates.
int itemCtrl2 (char *name, int r, int g, int b, int w)
 Drives a named DMX/LED item with an RGB(W) value.
void DmxWriteBuf (uint16_t chan, uint8_t val)
 Writes a value into the intermediate (smoothing) DMX output buffer.
void DMXOUT_propagate ()
 Smoothly ramps the actual DMX output toward the buffered target.

Variables

aJsonObject * dmxArr
 DMX channel-to-item mapping array from the JSON config.

Detailed Description

DMX input/output (and Art-Net) support.

DMX output uses a hardware USART on the SAM3X8E (Due) and a software bit-banged driver (DmxSimple, pin 3/18) on AVR; DMX input uses DMXSerial on AVR and the hardware USART on the Due. Received DMX/Art-Net channels are mapped to items via the dmxArr configuration.

Macro Definition Documentation

◆ D_CHECKT

#define D_CHECKT   300

◆ D_UPDATED1

#define D_UPDATED1   1

◆ D_UPDATED2

#define D_UPDATED2   2

◆ D_UPDATED3

#define D_UPDATED3   4

◆ D_UPDATED4

#define D_UPDATED4   8

Function Documentation

◆ artnetSetChans()

void artnetSetChans ( uint8_t minCh,
uint8_t maxCh )

Restricts the Art-Net channel range that is forwarded.

Parameters
minChFirst channel (1-based) to accept.
maxChLast channel (1-based) to accept.

◆ artnetSetup()

void artnetSetup ( )

Initializes the Art-Net receiver and wires its frame callback.

◆ DMXCheck()

void DMXCheck ( void )

DMX housekeeping called from the main loop: propagates changes and services pending DMX-in updates.

◆ DMXinSetup()

void DMXinSetup ( int channels)

Sets up the DMX input for the given number of channels.

Parameters
channelsNumber of DMX input channels.

ToDo: re-init

◆ DMXOUT_propagate()

void DMXOUT_propagate ( )

Smoothly ramps the actual DMX output toward the buffered target.

◆ DMXoutSetup()

void DMXoutSetup ( int channels)

Sets up the DMX output for the given number of channels.

Parameters
channelsNumber of DMX output channels.

◆ DMXput()

void DMXput ( void )

Propagates received DMX input frames to the mapped items.

DMX in/out is handled per platform: on the SAM3X8E (Due) a hardware USART (DmxDue) is used for both input and output; on AVR a software bit-banged driver (DmxSimple for output on pin 3/18, DMXSerial for input). ESP8266/ESP32 use ESPDMX.

◆ DmxWriteBuf()

void DmxWriteBuf ( uint16_t chan,
uint8_t val )

Writes a value into the intermediate (smoothing) DMX output buffer.

Parameters
chan1-based DMX channel.
valChannel value 0..255.

◆ itemCtrl2()

int itemCtrl2 ( char * name,
int r,
int g,
int b,
int w )

Drives a named DMX/LED item with an RGB(W) value.

Parameters
nameName of the target item.
rRed component.
gGreen component.
bBlue component.
wWhite component.
Returns
1 on success, 0 if the item was not found.

Variable Documentation

◆ dmxArr

aJsonObject* dmxArr
extern

DMX channel-to-item mapping array from the JSON config.