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

Revision:
6:9e7b4eeac6ec
Parent:
5:72039cd4c874
Child:
7:16d6874076dd
diff -r 72039cd4c874 -r 9e7b4eeac6ec DMX.h
--- a/DMX.h	Fri Jan 04 04:31:53 2013 +0000
+++ b/DMX.h	Sun Jan 13 01:33:17 2013 +0000
@@ -1,6 +1,6 @@
 /*
  * DMX512 send/recv library
- * Copyright (c) 2011 Hiroshi Suga
+ * Copyright (c) 2013 Hiroshi Suga
  * Released under the MIT License: http://mbed.org/license/mit
  */
 
@@ -40,22 +40,34 @@
      */
     DMX (PinName p_tx, PinName p_rx); 
 
-    /** Send the message
-     * @param ch DMX data address (0-511)
+    /** Send the data
+     * @param addr DMX data address (0-511)
      * @param data DMX data (0-255)
      */
-    void put (int ch, int data);
+    void put (int addr, int data);
+    /** Send the data
+     * @param buf DMX data buffer
+     * @param addr DMX data address
+     * @param len data length
+     */
+    void put (unsigned char *buf, int addr = 0, int len = DMX_SIZE);
 
-    /** Send the message
+    /** Send the data
      * @param ch DMX data address (0-511)
      * @return DMX data (0-255)
      */
-    int get (int ch);
+    int get (int addr);
+    /** Send the data
+     * @param buf DMX data buffer
+     * @param addr DMX data address
+     * @param len data length
+     */
+    void get (unsigned char *buf, int addr = 0, int len = DMX_SIZE);
 
-    /** Start DMX send
+    /** Start DMX send operation
      */
     void start ();
-    /** Stop DMX send
+    /** Stop DMX send operation
      */
     void stop ();
 
@@ -69,6 +81,12 @@
 
     Serial _dmx;
     Timeout timeout01;
+    volatile DMX_MODE mode_tx, mode_rx;
+    volatile int addr_tx, addr_rx;
+    unsigned char data_tx[DMX_SIZE];
+    unsigned char data_rx[DMX_SIZE];
+
+private:
 #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
     __IO uint8_t *uart_lcr;
     __I  uint8_t *uart_lsr;
@@ -80,12 +98,6 @@
     __IO uint32_t *uart_thr;
     __I  uint32_t *uart_rbr;
 #endif
-    volatile DMX_MODE mode_tx, mode_rx;
-    volatile int addr_tx, addr_rx;
-    unsigned char data_tx[DMX_SIZE];
-    unsigned char data_rx[DMX_SIZE];
-
-private:
 
 };