DMX512

https://en.wikipedia.org/wiki/DMX512

../../../../../../_images/dmx512-decoder.jpg

Written to support DMX lighting controllers for dimmable lights. The model shown is for controlling RGB LED strip lighting.

DMX512 uses the RS485 physical interface, but a different protocol and usually higher baud rates than MODBUS. Nevertheless, it is possible to mix difference device types on the same network.

Requests to other devices will generally appear as garbage so shouldn’t have any bad side-effects.

namespace DMX512

DMX512/Device.h

Created on: 5 November 2018

Copyright 2022 mikee47 mike@sillyhouse.net

This file is part of the IOControl Library

This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 or later.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this library. If not, see https://www.gnu.org/licenses/.

DMX512/Request.h

Created on: 5 November 2018

Copyright 2022 mikee47 mike@sillyhouse.net

This file is part of the IOControl Library

This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 or later.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this library. If not, see https://www.gnu.org/licenses/.

struct NodeData
#include <Device.h>
class Device : public IO::RS485::Device
#include <Device.h>

Public Functions

virtual IO::Request *createRequest() override

Create a request object for this device.

Return values:

Request* – Caller must destroy or submit the request

inline virtual uint16_t maxNodes() const override

Determine maximum number of nodes supported by the device.

Return values:

uint16_t – 0 if device doesn’t support nodes

virtual void handleEvent(IO::Request *request, Event event) override

Implementations may override this method to customise event handling.

struct Config
#include <Device.h>

DMX512 Device Configuration.

Public Members

IO::RS485::Device::Config rs485

RS485 config.

uint8_t nodeCount

Number of nodes controlled by this device.

bool fade

Default node fade enable.

class Factory : public IO::RS485::Device::FactoryTemplate<Device>
#include <Device.h>

Public Functions

inline virtual const FlashString &deviceClass() const override

Return the Device class name, e.g. ‘r421a’.

class Request : public IO::Request
#include <Request.h>

Public Functions

virtual ErrorCode parseJson(JsonObjectConst json) override

Fill this request from a JSON description.

virtual void getJson(JsonObject json) const override

Get result of a completed request in JSON format.

virtual bool setNode(DevNode node) override

If nodes are supported, implement this method.

/

/**

inline virtual bool setValue(int value) override

If nodes support values, implement this method.

virtual void submit() override

Submit a request.

The request is added to the controller’s queue. If the queue is empty, it starts execution immediately. The result of the request is posted to the callback routine.