Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
FtdiDmxThread.h
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU Library General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15 *
16 * FtdiDmxThread.h
17 * The FTDI usb chipset DMX plugin for ola
18 * Copyright (C) 2011 Rui Barreiros
19 *
20 * Additional modifications to enable support for multiple outputs and
21 * additional device ids did change the original structure.
22 *
23 * by E.S. Rosenberg a.k.a. Keeper of the Keys 5774/2014
24 */
25
26#ifndef PLUGINS_FTDIDMX_FTDIDMXTHREAD_H_
27#define PLUGINS_FTDIDMX_FTDIDMXTHREAD_H_
28
29#include "ola/DmxBuffer.h"
30#include "ola/thread/Thread.h"
31
32namespace ola {
33namespace plugin {
34namespace ftdidmx {
35
37 public:
38 FtdiDmxThread(FtdiInterface *interface, unsigned int frequency);
40
41 bool Stop();
42 void *Run();
43 bool WriteDMX(const DmxBuffer &buffer);
44
45 private:
46 enum TimerGranularity { UNKNOWN, GOOD, BAD };
47
48 TimerGranularity m_granularity;
49 FtdiInterface *m_interface;
50 bool m_term;
51 unsigned int m_frequency;
52 DmxBuffer m_buffer;
53 ola::thread::Mutex m_term_mutex;
54 ola::thread::Mutex m_buffer_mutex;
55
56 void CheckTimeGranularity();
57
58 static const uint32_t DMX_MAB = 16;
59 static const uint32_t DMX_BREAK = 110;
60 static const uint32_t BAD_GRANULARITY_LIMIT = 3;
61};
62} // namespace ftdidmx
63} // namespace plugin
64} // namespace ola
65#endif // PLUGINS_FTDIDMX_FTDIDMXTHREAD_H_
A class used to hold a single universe of DMX data.
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
Definition FtdiDmxThread.h:36
bool Stop()
Stop this thread.
Definition FtdiDmxThread.cpp:56
void * Run()
The method called by the thread.
Definition FtdiDmxThread.cpp:80
bool WriteDMX(const DmxBuffer &buffer)
Copy a DMXBuffer to the output thread.
Definition FtdiDmxThread.cpp:68
Definition FtdiWidget.h:183
Definition Mutex.h:41
Definition Thread.h:52
The namespace containing all OLA symbols.
Definition Credentials.cpp:44