DMX512, RDM send/recv library http://mbed.org/users/okini3939/notebook/dmx512

Dependents:   dmx_test ArtNodeLED SPK-DVIMXR SPK-DMXer ... more

DMX512 send/recv library

DMX512 is protocol for lighting.

調光プロトコル DMX512 を送受信するライブラリです。

see: http://mbed.org/users/okini3939/notebook/dmx512/

LPC1114 support is thanks to Stanly Chen

Files at this revision

API Documentation at this revision

Comitter:
okini3939
Date:
Fri Mar 29 02:06:50 2013 +0000
Parent:
8:d4a45bba41d2
Child:
10:b748aab8404c
Commit message:
fix

Changed in this revision

DMX.cpp Show annotated file Show diff for this revision Revisions of this file
DMX.h Show annotated file Show diff for this revision Revisions of this file
--- a/DMX.cpp	Mon Mar 11 04:02:26 2013 +0000
+++ b/DMX.cpp	Fri Mar 29 02:06:50 2013 +0000
@@ -99,9 +99,10 @@
         mode_tx = DMX_MODE_DATA;
         _dmx.attach(this, &DMX::int_tx, Serial::TxIrq);
 #ifdef DMX_UART_DIRECT
-        _uart->THR = 0;
+        while(!(_uart->LSR & (1<<5)));
+        _uart->THR = DMX_START_CODE;
 #else
-        _dmx.putc(0);
+        _dmx.putc(DMX_START_CODE);
 #endif
         break;
     }
@@ -148,7 +149,7 @@
     if (mode_rx == DMX_MODE_BREAK) {
 
         // Start Code
-        if (dat == 0) {
+        if (dat == DMX_START_CODE) {
             addr_rx = 0;
             mode_rx = DMX_MODE_DATA;
         } else {
--- a/DMX.h	Mon Mar 11 04:02:26 2013 +0000
+++ b/DMX.h	Fri Mar 29 02:06:50 2013 +0000
@@ -16,9 +16,10 @@
 #define DMX_UART_DIRECT
 
 #define DMX_SIZE 512
-#define DMX_TIME_BREAK 100 // 100us
-#define DMX_TIME_MAB 10 // 10us
-#define DMX_TIME_BETWEEN 10 // 10us
+#define DMX_TIME_BREAK 100 // 100us (88us-1s)
+#define DMX_TIME_MAB 10 // 10us (8us-1s)
+#define DMX_TIME_BETWEEN 10 // 10us (0-1s)
+#define DMX_START_CODE 0
 
 enum DMX_MODE {
     DMX_MODE_BEGIN,