DMXSerial  1.4
Public Member Functions | List of all members
DMXSerialClass Class Reference

Arduino library to send and receive DMXX. More...

Public Member Functions

void init (int mode)
 Initialize or re-initialize the specified mode. This function can be called to switch to restart or switch the operatin mode. More...
 
void init (int mode, int modePin)
 Initialize the specified mode including a specific mode pin. This function can be called to switch to restart or switch the operatin mode. More...
 
void maxChannel (int channel)
 Set the maximum used channel for DMXController mode. More...
 
uint8_t read (int channel)
 Read the current value of a channel. More...
 
void write (int channel, uint8_t value)
 Write a new value to a channel. This function also can be called in DMXReceiver mode to set a channel value even when no data is received. It will be overwritten by the next received package. More...
 
uint8_t * getBuffer ()
 Get a pointer to DMX Buffer. This is the internal byte-array where the current DMX values are stored. More...
 
unsigned long noDataSince ()
 Return the duration since data was received. On startup the internal timer is reset too. More...
 
bool dataUpdated ()
 Check for changed data. Check DMX data was updated by a received package since last resetUpdated() call or onUpdate callback. More...
 
void resetUpdated ()
 Reset DMX data update flag.
 
bool receive ()
 Actively wait for an incomming DMX packet. This function waits DMXPROBE_RECV_MAX milliseconds for a new package to receive. More...
 
bool receive (uint8_t wait)
 Actively wait for an incomming DMX packet. This function waits the specified milliseconds for a new package to receive. More...
 
void term ()
 Terminate the current operation mode.
 

Detailed Description

Arduino library to send and receive DMXX.

The library works unchanged with the Arduino 2009, UNO, MGEA 2560 and Leonardo boards.
The Arduino MGEA 2560 boards use the serial port 0 on pins 0 an 1.
The Arduino Leonardo will use serial port 1, also on pins 0 an 1. (on the 32u4 boards the first USART is USART1)
This is consistent with the Layout of the Arduino DMX Shield http://www.mathertel.de/Arduino/DMXShield.aspx.

Member Function Documentation

◆ dataUpdated()

bool DMXSerialClass::dataUpdated ( )

Check for changed data. Check DMX data was updated by a received package since last resetUpdated() call or onUpdate callback.

Returns
true Some DMX data was updated.
false No updated data.

◆ getBuffer()

uint8_t * DMXSerialClass::getBuffer ( )

Get a pointer to DMX Buffer. This is the internal byte-array where the current DMX values are stored.

Returns
uint8_t DMX values buffer.

◆ init() [1/2]

void DMXSerialClass::init ( int  mode)

Initialize or re-initialize the specified mode. This function can be called to switch to restart or switch the operatin mode.

Parameters
[in]modeThe mode of operation to be started. A value from enum DMXMode;
Returns
void

◆ init() [2/2]

void DMXSerialClass::init ( int  mode,
int  modePin 
)

Initialize the specified mode including a specific mode pin. This function can be called to switch to restart or switch the operatin mode.

Parameters
[in]modeThe mode of operation to be started. A value from enum DMXMode;
[in]modePinThe pin number for switching communication direction.
Returns
void

◆ maxChannel()

void DMXSerialClass::maxChannel ( int  channel)

Set the maximum used channel for DMXController mode.

Parameters
[in]channelThe highest channel that will be transferred.
Returns
void

◆ noDataSince()

unsigned long DMXSerialClass::noDataSince ( )

Return the duration since data was received. On startup the internal timer is reset too.

Returns
long milliseconds since last pdata package.

◆ read()

uint8_t DMXSerialClass::read ( int  channel)

Read the current value of a channel.

Parameters
[in]channelThe channel number.
Returns
uint8_t The current value.

◆ receive() [1/2]

bool DMXSerialClass::receive ( )

Actively wait for an incomming DMX packet. This function waits DMXPROBE_RECV_MAX milliseconds for a new package to receive.

Returns
true when a package was received.
false after timeout no package was received.

◆ receive() [2/2]

bool DMXSerialClass::receive ( uint8_t  wait)

Actively wait for an incomming DMX packet. This function waits the specified milliseconds for a new package to receive.

Parameters
waitMilliseconds to wait for a new package.
Returns
true when a package was received.
false after timeout no package was received.

◆ write()

void DMXSerialClass::write ( int  channel,
uint8_t  value 
)

Write a new value to a channel. This function also can be called in DMXReceiver mode to set a channel value even when no data is received. It will be overwritten by the next received package.

Parameters
[in]channelThe channel number.
[in]valueThe current value.
Returns
void

The documentation for this class was generated from the following files:

More information on Arduino projects can be found on my web site: https://www.mathertel.de/Arduino/