DALI send/recv library see: https://os.mbed.com/users/okini3939/code/DALI/

Dependencies:   mbed DALI

Files at this revision

API Documentation at this revision

Comitter:
okini3939
Date:
Mon Jul 27 05:54:25 2020 +0000
Parent:
0:306a7e28f64a
Commit message:
bug fix;

Changed in this revision

DALI.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/DALI.lib	Wed Jul 22 03:17:03 2020 +0000
+++ b/DALI.lib	Mon Jul 27 05:54:25 2020 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/okini3939/code/DALI/#6cb7026982fc
+https://os.mbed.com/users/okini3939/code/DALI/#319d52b5116b
--- a/main.cpp	Wed Jul 22 03:17:03 2020 +0000
+++ b/main.cpp	Mon Jul 27 05:54:25 2020 +0000
@@ -15,33 +15,37 @@
 
     for (;;) {
         if (dali.readable()) {
-            int f, d, v;
+            int f, a, v;
             led3 = 1;
-            dali.read((enum DALI::DALI_FRAME*)&f, &d, &v);
-            pc.printf("dali f=%d d=%d v=%d\r\n", f, d, v);
+            dali.read((enum DALI::DALI_FRAME*)&f, &a, &v);
+            pc.printf("recv f=%d a=%d v=%d\r\n", f, a, v);
         }
 
         if (pc.readable()) {
             char c = pc.getc();
             led4 = 1;
             if (c >= '0' && c <= '9') {
-                dali.write(DALI::DALI_FORWARD_SHORT_DAP, DALI_ADDRESS, (c - '0') * 20);
+                dali.write(DALI::FORWARD_SHORT_DAP, DALI_ADDRESS, (c - '0') * 20);
+                dali.write(DALI::FORWARD_GROUP_DAP, DALI_ADDRESS, (c - '0') * 20);
             } else
             if (c == ' ') {
-                dali.write(DALI::DALI_FORWARD_SHORT_DAP, DALI_ADDRESS, 255);
+                dali.write(DALI::FORWARD_SHORT_DAP, DALI_ADDRESS, 255);
             } else
             if (c == 'a') {
-                dali.write(DALI::DALI_FORWARD_SHORT_IAP, DALI_ADDRESS, 0x00); // OFF
+                dali.write(DALI::FORWARD_SHORT_IAP, DALI_ADDRESS, DALI::OFF); // OFF
             } else
             if (c == 'b') {
-                dali.write(DALI::DALI_FORWARD_SHORT_IAP, DALI_ADDRESS, 0x05); // RECALL_MAX_LEVEL
+                dali.write(DALI::FORWARD_SHORT_IAP, DALI_ADDRESS, DALI::RECALL_MAX_LEVEL); // RECALL_MAX_LEVEL
             } else
             if (c == 'c') {
-                dali.write(DALI::DALI_FORWARD_SHORT_IAP, DALI_ADDRESS, 0x90); // QUERY_STATUS
+                dali.write(DALI::FORWARD_SHORT_IAP, DALI_ADDRESS, DALI::QUERY_STATUS); // QUERY_STATUS
+            } else
+            if (c == 'd') {
+                dali.write(DALI::FORWARD_GROUP_DAP, 63, 127);
             }
         }
 
-        wait_ms(50);
+        wait_ms(1);
         led2 = ! led2;
         led3 = led4 = 0;
     }