Lumiverse  2.5
A framework for creating lighting control applications
pro_driver.h
1 #include "../LumiverseCoreConfig.h"
2 
3 #ifdef USE_DMXPRO2
4 
5 #ifndef _PRO_DRIVER_H
6 #define _PRO_DRIVER_H
7 
8 #ifdef _MSC_VER
9  #include <windows.h>
10  #include <process.h>
11  #include <tchar.h>
12  #include <conio.h>
13 #endif
14 
15 #include <stdlib.h>
16 #include <stdio.h>
17 #include <assert.h>
18 #include <time.h>
19 #include "FTD2XX.H"
20 
21 //#ifdef _MSC_VER
22 // #include "ms_stdint.h"
23 //#else
24  #include <stdint.h>
25 //#endif
26 
27 /********************** PLEASE SET THESE FIRST **********************************/
28 /******************** PRO MK2 LABELS: ASSIGN AS PER YOUR API *********************/
29 // THE API Key is LSB First: so if it says 11223344 .. define it as ... 44,33,22,11
30 
31 const unsigned char APIKey[] = {0x17, 0xE1, 0x3A, 0x32};
32 
33 #define SET_PORT_ASSIGNMENT_LABEL 209
34 #define SEND_DMX_PORT2 150
35 #define RECEIVE_DMX_PORT2 194
36 #define SEND_MIDI_PORT 228
37 #define RECEIVE_MIDI_PORT 214
38 
39 /***********************************************************************************/
40 
41 // Enttec Pro definitions
42 #define GET_WIDGET_PARAMS 3
43 #define GET_WIDGET_PARAMS_REPLY 3
44 #define SET_WIDGET_PARAMS 4
45 #define RECEIVE_DMX_PORT1 5
46 #define SEND_DMX_PORT1 6
47 #define SEND_DMX_RDM_TX 7
48 #define RECEIVE_DMX_ON_CHANGE 8
49 #define RECEIVED_DMX_COS_TYPE 9
50 #define GET_WIDGET_SN 10
51 #define SET_API_KEY_LABEL 13
52 #define HARDWARE_VERSION_LABEL 14
53 
54 
55 #define ONE_BYTE 1
56 #define DMX_START_CODE 0x7E
57 #define DMX_END_CODE 0xE7
58 #define OFFSET 0xFF
59 #define DMX_HEADER_LENGTH 4
60 #define BYTE_LENGTH 8
61 #define HEADER_RDM_LABEL 5
62 #define NO_RESPONSE 0
63 #define DMX_PACKET_SIZE 512
64 
65 #define RX_BUFFER_SIZE 40960
66 #define TX_BUFFER_SIZE 40960
67 
68 #pragma pack(1)
69 typedef struct {
70  unsigned char FirmwareLSB;
71  unsigned char FirmwareMSB;
72  unsigned char BreakTime;
73  unsigned char MaBTime;
74  unsigned char RefreshRate;
76 
77 typedef struct {
78  unsigned char UserSizeLSB;
79  unsigned char UserSizeMSB;
80  unsigned char BreakTime;
81  unsigned char MaBTime;
82  unsigned char RefreshRate;
84 #pragma pack()
85 
87 {
88  unsigned char start_changed_byte_number;
89  unsigned char changed_byte_array[5];
90  unsigned char changed_byte_data[40];
91 };
92 
93 #define MAX_PROS 20
94 #define SEND_NOW 0
95 #define TRUE 1
96 #define FALSE 0
97 #define HEAD 0
98 #define IO_ERROR 9
99 
100 // API calls from the original sample code.
101 //int FTDI_SendData(int label, unsigned char *data, int length);
102 //int FTDI_ReceiveData(int label, unsigned char *data, unsigned int expected_length);
103 //uint8_t FTDI_SendDataToPro(uint8_t label, unsigned char *data, uint32_t length);
104 //void* Get_Pro_Handle();
105 //uint8_t FTDI_ReceiveDataFromPro(uint8_t label, unsigned char *data, uint32_t expected_length);
106 //uint16_t FTDI_OpenDevice(int device_num, int* VersionMSB, int* VersionLSB,bool full_mode = true);
107 //int FTDI_ListDevices(uint64_t * Locations);
108 //void FTDI_ClosePort();
109 //void FTDI_PurgeBuffer();
110 //void ReceiveMIDI(int PortLabel);
111 //void SendMIDI(int PortLabel, unsigned char channel, unsigned char note, unsigned char velocity);
112 //void ReceiveDMX(int PortLabel);
113 //void SendDMX(int PortLabel);
114 //void enable_midi();
115 //void init_promk2();
116 //void FTDI_Reload();
117 
118 #endif
119 
120 #endif
Definition: pro_driver.h:77
Definition: pro_driver.h:86
Definition: pro_driver.h:69