DMX512 send/recv library with STM32 slave support originally from http://mbed.org/users/okini3939/notebook/dmx512

Fork of DMX by Suga koubou

Files at this revision

API Documentation at this revision

Comitter:
Ingram
Date:
Sat Mar 04 10:24:03 2017 +0000
Parent:
20:908740273e88
Commit message:
Remove deprecations

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
diff -r 908740273e88 -r 36276a92303f DMX.cpp
--- a/DMX.cpp	Tue May 31 11:02:49 2016 +0000
+++ b/DMX.cpp	Sat Mar 04 10:24:03 2017 +0000
@@ -11,8 +11,7 @@
 #include "mbed.h"
 #include "DMX.h"
 
-DMX::DMX (PinName p_tx, PinName p_rx) : _dmx(p_tx, p_rx) {
-
+DMX::DMX (PinName p_tx, PinName p_rx) : _dmx(p_tx, p_rx, 250000) {
     clear();
 //    mode_tx = DMX_MODE_BEGIN;
     mode_tx = DMX_MODE_STOP;
@@ -83,9 +82,8 @@
     }
 #endif
 
-    _dmx.baud(250000);
     _dmx.format(8, Serial::None, 2);
-    _dmx.attach(this, &DMX::int_rx, Serial::RxIrq);
+    _dmx.attach(callback(this, &DMX::int_rx), Serial::RxIrq);
 
 //    timeout01.attach_us(this, &DMX::int_timer, DMX_TIME_BETWEEN);
 }
@@ -126,7 +124,7 @@
             _uart->LCR |= (1 << 6);
         #endif
         mode_tx = DMX_MODE_BREAK;
-        timeout01.attach_us(this, &DMX::int_timer, time_break);
+        timeout01.attach_us(callback(this, &DMX::int_timer), time_break);
         break;
 
     case DMX_MODE_BREAK:
@@ -138,7 +136,7 @@
             _uart->LCR &= ~(1 << 6);
         #endif
         mode_tx = DMX_MODE_MAB;
-        timeout01.attach_us(this, &DMX::int_timer, time_mab);
+        timeout01.attach_us(callback(this, &DMX::int_timer), time_mab);
         break;
 
     case DMX_MODE_MAB:
@@ -146,7 +144,7 @@
         timeout01.detach();
         addr_tx = 0;
         mode_tx = DMX_MODE_DATA;
-        _dmx.attach(this, &DMX::int_tx, Serial::TxIrq);
+        _dmx.attach(callback(this, &DMX::int_tx), Serial::TxIrq);
 #ifdef DMX_UART_DIRECT
         while(!(_uart->LSR & (1<<5)));
         _uart->THR = DMX_START_CODE;
@@ -171,7 +169,7 @@
             _dmx.attach(0, Serial::TxIrq);
             mode_tx = DMX_MODE_BEGIN;
             is_sent = 1;
-            timeout01.attach_us(this, &DMX::int_timer, time_mbb);
+            timeout01.attach_us(callback(this, &DMX::int_timer), time_mbb);
         }
     }
 }
@@ -231,7 +229,7 @@
     if (mode_tx == DMX_MODE_STOP) {
         mode_tx = DMX_MODE_BEGIN;
         is_sent = 0;
-        timeout01.attach_us(this, &DMX::int_timer, time_mbb);
+        timeout01.attach_us(callback(this, &DMX::int_timer), time_mbb);
     }
 }
 
diff -r 908740273e88 -r 36276a92303f DMX.h
--- a/DMX.h	Tue May 31 11:02:49 2016 +0000
+++ b/DMX.h	Sat Mar 04 10:24:03 2017 +0000
@@ -102,7 +102,7 @@
     unsigned char data_rx[DMX_SIZE];
     int is_received, is_sent;
     int time_break, time_mab, time_mbb;
-    FunctionPointer on_rx;
+    Callback<void()> on_rx;
 
 private:
 #if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088)