├── Doxyfile ├── LICENSE ├── README.md ├── docs ├── _dali_8h.html ├── _dali_8h_source.html ├── _dali_bus_8h.html ├── _dali_bus_8h_source.html ├── annotated.html ├── bc_s.png ├── bc_sd.png ├── bdwn.png ├── class_dali_bus_class-members.html ├── class_dali_bus_class.html ├── class_dali_class-members.html ├── class_dali_class.html ├── classes.html ├── closed.png ├── dali_8ino-example.html ├── dali_blink_8ino-example.html ├── dir_68267d1309a1af8e8297ef4c3efbcdba.html ├── doc.png ├── docd.png ├── doxygen.css ├── doxygen.png ├── doxygen.svg ├── dynsections.js ├── examples.html ├── files.html ├── folderclosed.png ├── folderopen.png ├── functions.html ├── functions_enum.html ├── functions_func.html ├── functions_vars.html ├── globals.html ├── globals_enum.html ├── globals_type.html ├── globals_vars.html ├── index.html ├── jquery.js ├── menu.js ├── menudata.js ├── nav_f.png ├── nav_fd.png ├── nav_g.png ├── nav_h.png ├── nav_hd.png ├── open.png ├── search │ ├── all_0.html │ ├── all_0.js │ ├── all_1.html │ ├── all_1.js │ ├── all_2.html │ ├── all_2.js │ ├── all_3.html │ ├── all_3.js │ ├── all_4.html │ ├── all_4.js │ ├── all_5.html │ ├── all_5.js │ ├── classes_0.html │ ├── classes_0.js │ ├── close.png │ ├── close.svg │ ├── enums_0.html │ ├── enums_0.js │ ├── enums_1.html │ ├── enums_1.js │ ├── files_0.html │ ├── files_0.js │ ├── functions_0.html │ ├── functions_0.js │ ├── functions_1.html │ ├── functions_1.js │ ├── functions_2.html │ ├── functions_2.js │ ├── functions_3.html │ ├── functions_3.js │ ├── mag.svg │ ├── mag_d.svg │ ├── mag_sel.png │ ├── mag_sel.svg │ ├── mag_seld.svg │ ├── nomatches.html │ ├── pages_0.js │ ├── search.css │ ├── search.js │ ├── search_l.png │ ├── search_m.png │ ├── search_r.png │ ├── searchdata.js │ ├── typedefs_0.html │ ├── typedefs_0.js │ ├── variables_0.html │ ├── variables_0.js │ ├── variables_1.html │ ├── variables_1.js │ ├── variables_2.html │ └── variables_2.js ├── splitbar.png ├── splitbard.png ├── sync_off.png ├── sync_on.png ├── tab_a.png ├── tab_ad.png ├── tab_b.png ├── tab_bd.png ├── tab_h.png ├── tab_hd.png ├── tab_s.png ├── tab_sd.png └── tabs.css ├── examples └── dali_blink.ino ├── library.properties └── src ├── Dali.cpp ├── Dali.h ├── DaliBus.cpp └── DaliBus.h /README.md: -------------------------------------------------------------------------------- 1 | # arduino-dali 2 | A timer-based DALI library for Arduino 3 | 4 | This library allows you to create a DALI controller/gateway with an Arduino device. It supports sending commands, receiving responses and commissioning devices. It requires the TimerOne library for transmission and the PinChangeInterrupt library for reception. These libraries need to be installed with the Library Manager in the Arduino IDE. 5 | 6 | 7 | Library Documentation: https://hubsif.github.io/arduino-dali/ 8 | 9 | Short example usage: 10 | 11 | ```c 12 | #include 13 | 14 | void setup() { 15 | Dali.begin(2, 3); 16 | } 17 | 18 | void loop() { 19 | // blink ballast with short address 3 20 | Dali.sendArc(3, 254); 21 | // alternatively to prevent fading you could use 22 | // Dali.sendCmd(3, Dali.CMD_RECALL_MIN); 23 | delay(1000); 24 | 25 | Dali.sendArc(3, 0); 26 | // alternatively to prevent fading you could use 27 | // Dali.sendCmd(3, Dali.CMD_OFF); 28 | delay(1000); 29 | } 30 | ``` 31 | 32 | more to follow... 33 | -------------------------------------------------------------------------------- /docs/_dali_8h.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: src/Dali.h File Reference 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 | 50 |
54 |
55 | 56 | 57 |
58 |
59 |
60 |
61 |
62 |
Loading...
63 |
Searching...
64 |
No Matches
65 |
66 |
67 |
68 |
69 | 70 | 74 |
75 |
76 |
77 | Classes | 78 | Variables
79 |
Dali.h File Reference
80 |
81 |
82 | 83 |

Main header file of the DALI library for Arduino. 84 | More...

85 |
#include <arduino.h>
86 | #include "dalibus.h"
87 |
88 |

Go to the source code of this file.

89 | 90 | 92 | 93 | 94 |

91 | Classes

class  DaliClass
 
95 | 97 | 98 | 99 |

96 | Variables

DaliClass Dali
 
100 |

Detailed Description

101 |

Main header file of the DALI library for Arduino.

102 |

Variable Documentation

103 | 104 |

◆ Dali

105 | 106 |
107 |
108 | 109 | 110 | 117 | 119 | 120 |
111 | 112 | 113 | 114 | 115 |
DaliClass Dali
116 |
118 | extern
121 |
122 |

Dali class instance for main usage (seems to be common Arduino Library style)

123 | 124 |
125 |
126 |
127 | 128 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /docs/_dali_bus_8h.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: src/DaliBus.h File Reference 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 | 50 |
54 |
55 | 56 | 57 |
58 |
59 |
60 |
61 |
62 |
Loading...
63 |
Searching...
64 |
No Matches
65 |
66 |
67 |
68 |
69 | 70 | 74 |
75 |
76 |
77 | Classes | 78 | Typedefs | 79 | Enumerations | 80 | Variables
81 |
DaliBus.h File Reference
82 |
83 |
84 | 85 |

DALI low level interface. 86 | More...

87 |
#include "Arduino.h"
88 | #include "TimerOne.h"
89 | #include "PinChangeInterrupt.h"
90 |
91 |

Go to the source code of this file.

92 | 93 | 95 | 96 | 97 |

94 | Classes

class  DaliBusClass
 
98 | 100 | 101 | 102 |

99 | Typedefs

typedef enum daliReturnValue daliReturnValue
 
103 | 105 | 117 | 118 |

104 | Enumerations

enum  daliReturnValue {
106 |   DALI_RX_EMPTY = -1 107 | , DALI_RX_ERROR = -2 108 | , DALI_SENT = -3 109 | , DALI_INVALID_PARAMETER = -4 110 | ,
111 |   DALI_BUSY = -5 112 | , DALI_READY_TIMEOUT = -6 113 | , DALI_SEND_TIMEOUT = -7 114 | , DALI_COLLISION = -8 115 |
116 | }
 
119 | 121 | 123 | 124 | 126 | 127 | 129 | 130 | 132 | 133 | 135 | 136 |

120 | Variables

122 | const int DALI_BAUD = 1200
 
125 | const unsigned long DALI_TE = 417
 
128 | const unsigned long DALI_TE_MIN = ( 80 * DALI_TE) / 100
 
131 | const unsigned long DALI_TE_MAX = (120 * DALI_TE) / 100
 
134 | DaliBusClass DaliBus
 
137 |

Detailed Description

138 |

DALI low level interface.

139 |

This file contains the low level part of the Dali library

140 |
Author
Hubert Nusser
141 |
Date
2019-05-14
142 |

Typedef Documentation

143 | 144 |

◆ daliReturnValue

145 | 146 |
147 |
148 | 149 | 150 | 151 | 152 |
typedef enum daliReturnValue daliReturnValue
153 |
154 |

some enum

155 | 156 |
157 |
158 |

Enumeration Type Documentation

159 | 160 |

◆ daliReturnValue

161 | 162 |
163 |
164 | 165 | 166 | 167 | 168 |
enum daliReturnValue
169 |
170 |

some enum

171 | 172 |
173 |
174 |
175 | 176 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /docs/annotated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: Class List 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |
Class List
73 |
74 |
75 |
Here are the classes, structs, unions and interfaces with brief descriptions:
76 | 77 | 78 | 79 |
 CDaliBusClass
 CDaliClass
80 |
81 |
82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /docs/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/bc_s.png -------------------------------------------------------------------------------- /docs/bc_sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/bc_sd.png -------------------------------------------------------------------------------- /docs/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/bdwn.png -------------------------------------------------------------------------------- /docs/class_dali_bus_class-members.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: Member List 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 | 50 |
54 |
55 | 56 | 57 |
58 |
59 |
60 |
61 |
62 |
Loading...
63 |
Searching...
64 |
No Matches
65 |
66 |
67 |
68 |
69 | 70 |
71 |
72 |
DaliBusClass Member List
73 |
74 |
75 | 76 |

This is the complete list of members for DaliBusClass, including all inherited members.

77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 |
activeLow (defined in DaliBusClass)DaliBusClassprotected
begin(byte tx_pin, byte rx_pin, bool active_low=true) (defined in DaliBusClass)DaliBusClass
busIdleCount (defined in DaliBusClass)DaliBusClass
busIsIdle() (defined in DaliBusClass)DaliBusClass
busState (defined in DaliBusClass)DaliBusClassprotected
busStateEnum enum name (defined in DaliBusClass)DaliBusClassprotected
getBusLevel() (defined in DaliBusClass)DaliBusClassprotected
getLastResponse() (defined in DaliBusClass)DaliBusClass
IDLE enum value (defined in DaliBusClass)DaliBusClassprotected
isDeltaWithin2TE(unsigned long delta) (defined in DaliBusClass)DaliBusClassprotected
isDeltaWithinTE(unsigned long delta) (defined in DaliBusClass)DaliBusClassprotected
pinchangeISR() (defined in DaliBusClass)DaliBusClass
RX_BIT enum value (defined in DaliBusClass)DaliBusClassprotected
RX_START enum value (defined in DaliBusClass)DaliBusClassprotected
RX_STOP enum value (defined in DaliBusClass)DaliBusClassprotected
rxError (defined in DaliBusClass)DaliBusClassprotected
rxLastChange (defined in DaliBusClass)DaliBusClassprotected
rxLength (defined in DaliBusClass)DaliBusClassprotected
rxMessage (defined in DaliBusClass)DaliBusClassprotected
rxPin (defined in DaliBusClass)DaliBusClassprotected
sendRaw(const byte *message, byte length) (defined in DaliBusClass)DaliBusClass
setBusLevel(byte level) (defined in DaliBusClass)DaliBusClassprotected
SHORT enum value (defined in DaliBusClass)DaliBusClassprotected
timerISR() (defined in DaliBusClass)DaliBusClass
TX_BIT_1ST enum value (defined in DaliBusClass)DaliBusClassprotected
TX_BIT_2ND enum value (defined in DaliBusClass)DaliBusClassprotected
TX_START_1ST enum value (defined in DaliBusClass)DaliBusClassprotected
TX_START_2ND enum value (defined in DaliBusClass)DaliBusClassprotected
TX_STOP enum value (defined in DaliBusClass)DaliBusClassprotected
TX_STOP_1ST enum value (defined in DaliBusClass)DaliBusClassprotected
txBusLevel (defined in DaliBusClass)DaliBusClassprotected
txCollision (defined in DaliBusClass)DaliBusClassprotected
txLength (defined in DaliBusClass)DaliBusClassprotected
txMessage (defined in DaliBusClass)DaliBusClassprotected
txPin (defined in DaliBusClass)DaliBusClassprotected
txPos (defined in DaliBusClass)DaliBusClassprotected
WAIT_RX enum value (defined in DaliBusClass)DaliBusClassprotected
116 | 117 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /docs/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: Class Index 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |
Class Index
73 |
74 |
75 | 76 |
77 |
78 |
D
79 |
DaliBusClass
DaliClass
80 |
81 |
82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /docs/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/closed.png -------------------------------------------------------------------------------- /docs/dali_8ino-example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: dali.ino 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 47 | 48 |
49 | 50 |
54 |
55 | 56 | 57 |
58 | 61 |
62 | 63 |
64 |
65 |
dali.ino
66 |
67 |
68 |
#include <Dali.h>
void setup() {
Dali.begin(2, 3);
}
void loop() {
// blink ballast with short address 3
Dali.sendArc(3, 254);
// alternatively without fading you could use
Dali.sendCmd(3, Dali.CMD_RECALL_MIN);
delay(1000);
Dali.sendArc(3, 0);
// alternatively without fading you could use
Dali.sendCmd(3, Dali.CMD_OFF);
delay(1000);
}
69 | 70 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /docs/dali_blink_8ino-example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: dali_blink.ino 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |
dali_blink.ino
73 |
74 |
75 |
76 |
#include <Dali.h>
77 |
78 |
void setup() {
79 |
Dali.begin(2, 3);
80 |
}
81 |
82 |
void loop() {
83 |
// blink ballast with short address 3
84 |
Dali.sendArc(3, 254);
85 |
// alternatively to prevent fading you could use
86 |
// Dali.sendCmd(3, Dali.CMD_RECALL_MIN);
87 |
delay(1000);
88 |
89 |
Dali.sendArc(3, 0);
90 |
// alternatively to prevent fading you could use
91 |
// Dali.sendCmd(3, Dali.CMD_OFF);
92 |
delay(1000);
93 |
}
94 |
Main header file of the DALI library for Arduino.
95 |
daliReturnValue sendArc(byte address, byte value, byte addr_type=DALI_SHORT_ADDRESS)
Definition: Dali.cpp:64
96 |
void begin(byte tx_pin, byte rx_pin, bool active_low=true)
Definition: Dali.cpp:36
97 |
98 | 99 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /docs/dir_68267d1309a1af8e8297ef4c3efbcdba.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: src Directory Reference 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 | 50 |
54 |
55 | 56 | 57 |
58 |
59 |
60 |
61 |
62 |
Loading...
63 |
Searching...
64 |
No Matches
65 |
66 |
67 |
68 |
69 | 70 | 74 |
75 |
76 |
src Directory Reference
77 |
78 |
79 | 80 | 82 | 83 | 84 | 85 | 86 | 87 | 88 |

81 | Files

file  Dali.h [code]
 Main header file of the DALI library for Arduino.
 
file  DaliBus.h [code]
 DALI low level interface.
 
89 |
90 | 91 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /docs/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/doc.png -------------------------------------------------------------------------------- /docs/docd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/docd.png -------------------------------------------------------------------------------- /docs/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/doxygen.png -------------------------------------------------------------------------------- /docs/dynsections.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | function toggleVisibility(linkObj) 26 | { 27 | var base = $(linkObj).attr('id'); 28 | var summary = $('#'+base+'-summary'); 29 | var content = $('#'+base+'-content'); 30 | var trigger = $('#'+base+'-trigger'); 31 | var src=$(trigger).attr('src'); 32 | if (content.is(':visible')===true) { 33 | content.hide(); 34 | summary.show(); 35 | $(linkObj).addClass('closed').removeClass('opened'); 36 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); 37 | } else { 38 | content.show(); 39 | summary.hide(); 40 | $(linkObj).removeClass('closed').addClass('opened'); 41 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); 42 | } 43 | return false; 44 | } 45 | 46 | function updateStripes() 47 | { 48 | $('table.directory tr'). 49 | removeClass('even').filter(':visible:even').addClass('even'); 50 | $('table.directory tr'). 51 | removeClass('odd').filter(':visible:odd').addClass('odd'); 52 | } 53 | 54 | function toggleLevel(level) 55 | { 56 | $('table.directory tr').each(function() { 57 | var l = this.id.split('_').length-1; 58 | var i = $('#img'+this.id.substring(3)); 59 | var a = $('#arr'+this.id.substring(3)); 60 | if (l 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: Examples 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |
Examples
73 |
74 |
75 |
Here is a list of all examples:
78 |
79 | 80 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /docs/files.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: File List 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |
File List
73 |
74 |
75 |
Here is a list of all documented files with brief descriptions:
76 |
[detail level 12]
77 | 78 | 79 | 80 |
  src
 Dali.hMain header file of the DALI library for Arduino
 DaliBus.hDALI low level interface
81 |
82 |
83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /docs/folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/folderclosed.png -------------------------------------------------------------------------------- /docs/folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/folderopen.png -------------------------------------------------------------------------------- /docs/functions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: Class Members 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |
Here is a list of all documented class members with links to the class documentation for each member:
94 |
95 | 96 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /docs/functions_enum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: Class Members - Enumerations 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |   79 |
80 | 81 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /docs/functions_func.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: Class Members - Functions 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |   86 |
87 | 88 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /docs/functions_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: Class Members - Variables 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |   77 |
78 | 79 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /docs/globals.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: File Members 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |
Here is a list of all documented file members with links to the documentation:
76 |
77 | 78 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /docs/globals_enum.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: File Members 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |   75 |
76 | 77 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/globals_type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: File Members 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |   75 |
76 | 77 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/globals_vars.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: File Members 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |   75 |
76 | 77 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | DALI Library for Arduino/AVR: DALI Library for Arduino/AVR 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 | 27 | 28 | 29 |
24 |
DALI Library for Arduino/AVR 25 |
26 |
30 |
31 | 32 | 33 | 38 | 39 | 40 | 48 | 49 |
50 | 51 |
55 |
56 | 57 | 58 |
59 |
60 |
61 |
62 |
63 |
Loading...
64 |
Searching...
65 |
No Matches
66 |
67 |
68 |
69 |
70 | 71 |
72 |
DALI Library for Arduino/AVR
73 |
74 |
75 |

This library allows you to create a DALI controller/gateway with an Arduino device. It supports sending commands, receiving responses and commissioning devices. It requires the TimerOne library for transmission and the PinChangeInterrupt library for reception. These libraries need to be installed with the Library Manager in the Arduino IDE.

76 |
Simple example
77 |
#include <Dali.h>
78 |
79 |
void setup() {
80 |
Dali.begin(2, 3);
81 |
}
82 |
83 |
void loop() {
84 |
// blink ballast with short address 3
85 |
Dali.sendArc(3, 254);
86 |
// alternatively to prevent fading you could use
87 |
// Dali.sendCmd(3, Dali.CMD_RECALL_MIN);
88 |
delay(1000);
89 |
90 |
Dali.sendArc(3, 0);
91 |
// alternatively to prevent fading you could use
92 |
// Dali.sendCmd(3, Dali.CMD_OFF);
93 |
delay(1000);
94 |
}
95 |
Main header file of the DALI library for Arduino.
96 |
daliReturnValue sendArc(byte address, byte value, byte addr_type=DALI_SHORT_ADDRESS)
Definition: Dali.cpp:64
97 |
void begin(byte tx_pin, byte rx_pin, bool active_low=true)
Definition: Dali.cpp:36
98 |
99 |
Changelog
    100 |
  • (2022-09-19) Make commissioning state public
  • 101 |
  • (2019-05-14) Initial release
  • 102 |
103 |
104 |
Author
hubsif hubsi.nosp@m.f@gm.nosp@m.x.de
105 |
106 |
107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /docs/menu.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { 26 | function makeTree(data,relPath) { 27 | var result=''; 28 | if ('children' in data) { 29 | result+=''; 44 | } 45 | return result; 46 | } 47 | var searchBoxHtml; 48 | if (searchEnabled) { 49 | if (serverSide) { 50 | searchBoxHtml='
'+ 51 | '
'+ 52 | '
 '+ 54 | ''+ 57 | '
'+ 58 | '
'+ 59 | '
'+ 60 | '
'; 61 | } else { 62 | searchBoxHtml='
'+ 63 | ''+ 64 | ' '+ 66 | ''+ 70 | ''+ 71 | ''+ 73 | ''+ 75 | ''+ 76 | '
'; 77 | } 78 | } 79 | 80 | $('#main-nav').before('
'+ 81 | ''+ 84 | ''+ 85 | '
'); 86 | $('#main-nav').append(makeTree(menudata,relPath)); 87 | $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); 88 | if (searchBoxHtml) { 89 | $('#main-menu').append('
  • '); 90 | } 91 | var $mainMenuState = $('#main-menu-state'); 92 | var prevWidth = 0; 93 | if ($mainMenuState.length) { 94 | function initResizableIfExists() { 95 | if (typeof initResizable==='function') initResizable(); 96 | } 97 | // animate mobile menu 98 | $mainMenuState.change(function(e) { 99 | var $menu = $('#main-menu'); 100 | var options = { duration: 250, step: initResizableIfExists }; 101 | if (this.checked) { 102 | options['complete'] = function() { $menu.css('display', 'block') }; 103 | $menu.hide().slideDown(options); 104 | } else { 105 | options['complete'] = function() { $menu.css('display', 'none') }; 106 | $menu.show().slideUp(options); 107 | } 108 | }); 109 | // set default menu visibility 110 | function resetState() { 111 | var $menu = $('#main-menu'); 112 | var $mainMenuState = $('#main-menu-state'); 113 | var newWidth = $(window).outerWidth(); 114 | if (newWidth!=prevWidth) { 115 | if ($(window).outerWidth()<768) { 116 | $mainMenuState.prop('checked',false); $menu.hide(); 117 | $('#searchBoxPos1').html(searchBoxHtml); 118 | $('#searchBoxPos2').hide(); 119 | } else { 120 | $menu.show(); 121 | $('#searchBoxPos1').empty(); 122 | $('#searchBoxPos2').html(searchBoxHtml); 123 | $('#searchBoxPos2').show(); 124 | } 125 | if (typeof searchBox!=='undefined') { 126 | searchBox.CloseResultsWindow(); 127 | } 128 | prevWidth = newWidth; 129 | } 130 | } 131 | $(window).ready(function() { resetState(); initResizableIfExists(); }); 132 | $(window).resize(resetState); 133 | } 134 | $('#main-menu').smartmenus(); 135 | } 136 | /* @license-end */ 137 | -------------------------------------------------------------------------------- /docs/menudata.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | var menudata={children:[ 26 | {text:"Main Page",url:"index.html"}, 27 | {text:"Classes",url:"annotated.html",children:[ 28 | {text:"Class List",url:"annotated.html"}, 29 | {text:"Class Index",url:"classes.html"}, 30 | {text:"Class Members",url:"functions.html",children:[ 31 | {text:"All",url:"functions.html"}, 32 | {text:"Functions",url:"functions_func.html"}, 33 | {text:"Variables",url:"functions_vars.html"}, 34 | {text:"Enumerations",url:"functions_enum.html"}]}]}, 35 | {text:"Files",url:"files.html",children:[ 36 | {text:"File List",url:"files.html"}, 37 | {text:"File Members",url:"globals.html",children:[ 38 | {text:"All",url:"globals.html"}, 39 | {text:"Variables",url:"globals_vars.html"}, 40 | {text:"Typedefs",url:"globals_type.html"}, 41 | {text:"Enumerations",url:"globals_enum.html"}]}]}, 42 | {text:"Examples",url:"examples.html"}]} 43 | -------------------------------------------------------------------------------- /docs/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/nav_f.png -------------------------------------------------------------------------------- /docs/nav_fd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/nav_fd.png -------------------------------------------------------------------------------- /docs/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/nav_g.png -------------------------------------------------------------------------------- /docs/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/nav_h.png -------------------------------------------------------------------------------- /docs/nav_hd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/nav_hd.png -------------------------------------------------------------------------------- /docs/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/open.png -------------------------------------------------------------------------------- /docs/search/all_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/all_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['begin_0',['begin',['../class_dali_class.html#a72c4417f788bbb465a4d234db4975b72',1,'DaliClass']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/search/all_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/all_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['commission_0',['commission',['../class_dali_class.html#acd38aec28e257d510f152fb50cca3848',1,'DaliClass']]], 4 | ['commission_5ftick_1',['commission_tick',['../class_dali_class.html#a013b2d375ea49a6ab4c709d6ec4099b5',1,'DaliClass']]], 5 | ['commissiononlynew_2',['commissionOnlyNew',['../class_dali_class.html#acb5b0ebc685ae10f3e870ef13ec0683c',1,'DaliClass']]], 6 | ['commissionstate_3',['commissionState',['../class_dali_class.html#aef718f914b7e59fc1b3097259467b029',1,'DaliClass']]], 7 | ['commissionstateenum_4',['commissionStateEnum',['../class_dali_class.html#ad025396aa4dbd349e5c8d1f1e792b39a',1,'DaliClass']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /docs/search/all_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/all_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['dali_0',['Dali',['../_dali_8h.html#af6a260a728b354f13a5e0849e8c49959',1,'Dali.cpp']]], 4 | ['dali_20library_20for_20arduino_2favr_1',['DALI Library for Arduino/AVR',['../index.html',1,'']]], 5 | ['dali_2eh_2',['Dali.h',['../_dali_8h.html',1,'']]], 6 | ['daliaddresstypes_3',['daliAddressTypes',['../class_dali_class.html#a5867a1a323a0b4efeaf2b830e03694fa',1,'DaliClass']]], 7 | ['dalibus_2eh_4',['DaliBus.h',['../_dali_bus_8h.html',1,'']]], 8 | ['dalibusclass_5',['DaliBusClass',['../class_dali_bus_class.html',1,'']]], 9 | ['daliclass_6',['DaliClass',['../class_dali_class.html',1,'']]], 10 | ['dalicmd_7',['daliCmd',['../class_dali_class.html#af768430212976a7dca6f3e5d8e260b0d',1,'DaliClass']]], 11 | ['dalidevtypes_8',['daliDevTypes',['../class_dali_class.html#aa219a54f5a4d569f19c351fc26f205ea',1,'DaliClass']]], 12 | ['dalireturnvalue_9',['daliReturnValue',['../_dali_bus_8h.html#ae16f7cc30f294c9b437cb4295de5bc35',1,'daliReturnValue(): DaliBus.h'],['../_dali_bus_8h.html#a686dd03ccc96b1f1532f0fa4a46a7744',1,'daliReturnValue(): DaliBus.h']]], 13 | ['dalispecialcmd_10',['daliSpecialCmd',['../class_dali_class.html#ad036bea5694e61c123bb16373769a4e2',1,'DaliClass']]] 14 | ]; 15 | -------------------------------------------------------------------------------- /docs/search/all_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/all_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['nextshortaddress_0',['nextShortAddress',['../class_dali_class.html#a340ae714905347dffe131a8e8b8851f8',1,'DaliClass']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/search/all_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/all_4.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['preparecmd_0',['prepareCmd',['../class_dali_class.html#afeba3c88cbc521dabf418be7cdcbd4c4',1,'DaliClass']]], 4 | ['preparespecialcmd_1',['prepareSpecialCmd',['../class_dali_class.html#afb4d86833b3e0c4b3fc6c412df8cc0ca',1,'DaliClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/search/all_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/all_5.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['sendarc_0',['sendArc',['../class_dali_class.html#a1980f90fce6c8869ffa9a6124c24101e',1,'DaliClass']]], 4 | ['sendarcwait_1',['sendArcWait',['../class_dali_class.html#a626c30d5b2d5e8c182fc1c2b685ccf54',1,'DaliClass']]], 5 | ['sendcmd_2',['sendCmd',['../class_dali_class.html#aee991b7ff97c4486358c06a1e67f8bc5',1,'DaliClass']]], 6 | ['sendcmdwait_3',['sendCmdWait',['../class_dali_class.html#a6c4e7396ea030118d0e42ca4c8163aa9',1,'DaliClass']]], 7 | ['sendrawwait_4',['sendRawWait',['../class_dali_class.html#a163f15760823445b74764109482aec5d',1,'DaliClass']]], 8 | ['sendspecialcmd_5',['sendSpecialCmd',['../class_dali_class.html#a337ecc2c136bc99e601cb820b44732cb',1,'DaliClass']]], 9 | ['sendspecialcmdwait_6',['sendSpecialCmdWait',['../class_dali_class.html#a555004b2172624c72fc056c9abf6c60c',1,'DaliClass']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /docs/search/classes_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/classes_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['dalibusclass_0',['DaliBusClass',['../class_dali_bus_class.html',1,'']]], 4 | ['daliclass_1',['DaliClass',['../class_dali_class.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/search/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/search/close.png -------------------------------------------------------------------------------- /docs/search/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 16 | 18 | image/svg+xml 19 | 21 | 22 | 23 | 24 | 25 | 27 | 31 | 32 | -------------------------------------------------------------------------------- /docs/search/enums_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/enums_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['commissionstateenum_0',['commissionStateEnum',['../class_dali_class.html#ad025396aa4dbd349e5c8d1f1e792b39a',1,'DaliClass']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/search/enums_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/enums_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['daliaddresstypes_0',['daliAddressTypes',['../class_dali_class.html#a5867a1a323a0b4efeaf2b830e03694fa',1,'DaliClass']]], 4 | ['dalicmd_1',['daliCmd',['../class_dali_class.html#af768430212976a7dca6f3e5d8e260b0d',1,'DaliClass']]], 5 | ['dalidevtypes_2',['daliDevTypes',['../class_dali_class.html#aa219a54f5a4d569f19c351fc26f205ea',1,'DaliClass']]], 6 | ['dalireturnvalue_3',['daliReturnValue',['../_dali_bus_8h.html#ae16f7cc30f294c9b437cb4295de5bc35',1,'DaliBus.h']]], 7 | ['dalispecialcmd_4',['daliSpecialCmd',['../class_dali_class.html#ad036bea5694e61c123bb16373769a4e2',1,'DaliClass']]] 8 | ]; 9 | -------------------------------------------------------------------------------- /docs/search/files_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/files_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['dali_2eh_0',['Dali.h',['../_dali_8h.html',1,'']]], 4 | ['dalibus_2eh_1',['DaliBus.h',['../_dali_bus_8h.html',1,'']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/search/functions_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/functions_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['begin_0',['begin',['../class_dali_class.html#a72c4417f788bbb465a4d234db4975b72',1,'DaliClass']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/search/functions_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/functions_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['commission_0',['commission',['../class_dali_class.html#acd38aec28e257d510f152fb50cca3848',1,'DaliClass']]], 4 | ['commission_5ftick_1',['commission_tick',['../class_dali_class.html#a013b2d375ea49a6ab4c709d6ec4099b5',1,'DaliClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/search/functions_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/functions_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['preparecmd_0',['prepareCmd',['../class_dali_class.html#afeba3c88cbc521dabf418be7cdcbd4c4',1,'DaliClass']]], 4 | ['preparespecialcmd_1',['prepareSpecialCmd',['../class_dali_class.html#afb4d86833b3e0c4b3fc6c412df8cc0ca',1,'DaliClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/search/functions_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/functions_3.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['sendarc_0',['sendArc',['../class_dali_class.html#a1980f90fce6c8869ffa9a6124c24101e',1,'DaliClass']]], 4 | ['sendarcwait_1',['sendArcWait',['../class_dali_class.html#a626c30d5b2d5e8c182fc1c2b685ccf54',1,'DaliClass']]], 5 | ['sendcmd_2',['sendCmd',['../class_dali_class.html#aee991b7ff97c4486358c06a1e67f8bc5',1,'DaliClass']]], 6 | ['sendcmdwait_3',['sendCmdWait',['../class_dali_class.html#a6c4e7396ea030118d0e42ca4c8163aa9',1,'DaliClass']]], 7 | ['sendrawwait_4',['sendRawWait',['../class_dali_class.html#a163f15760823445b74764109482aec5d',1,'DaliClass']]], 8 | ['sendspecialcmd_5',['sendSpecialCmd',['../class_dali_class.html#a337ecc2c136bc99e601cb820b44732cb',1,'DaliClass']]], 9 | ['sendspecialcmdwait_6',['sendSpecialCmdWait',['../class_dali_class.html#a555004b2172624c72fc056c9abf6c60c',1,'DaliClass']]] 10 | ]; 11 | -------------------------------------------------------------------------------- /docs/search/mag.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 16 | 18 | image/svg+xml 19 | 21 | 22 | 23 | 24 | 25 | 27 | 33 | 37 | 38 | -------------------------------------------------------------------------------- /docs/search/mag_d.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 16 | 18 | image/svg+xml 19 | 21 | 22 | 23 | 24 | 25 | 27 | 33 | 37 | 38 | -------------------------------------------------------------------------------- /docs/search/mag_sel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/search/mag_sel.png -------------------------------------------------------------------------------- /docs/search/mag_sel.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 22 | 24 | image/svg+xml 25 | 27 | 28 | 29 | 30 | 31 | 33 | 57 | 63 | 69 | 74 | 75 | -------------------------------------------------------------------------------- /docs/search/mag_seld.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 22 | 24 | image/svg+xml 25 | 27 | 28 | 29 | 30 | 31 | 33 | 57 | 63 | 69 | 74 | 75 | -------------------------------------------------------------------------------- /docs/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
    9 |
    No Matches
    10 |
    11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/search/pages_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['dali_20library_20for_20arduino_2favr_0',['DALI Library for Arduino/AVR',['../index.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/search/search.css: -------------------------------------------------------------------------------- 1 | /*---------------- Search Box positioning */ 2 | 3 | #main-menu > li:last-child { 4 | /* This
  • object is the parent of the search bar */ 5 | display: flex; 6 | justify-content: center; 7 | align-items: center; 8 | height: 36px; 9 | margin-right: 1em; 10 | } 11 | 12 | /*---------------- Search box styling */ 13 | 14 | .SRPage * { 15 | font-weight: normal; 16 | line-height: normal; 17 | } 18 | 19 | dark-mode-toggle { 20 | margin-left: 5px; 21 | display: flex; 22 | float: right; 23 | } 24 | 25 | #MSearchBox { 26 | display: inline-block; 27 | white-space : nowrap; 28 | background: var(--search-background-color); 29 | border-radius: 0.65em; 30 | box-shadow: var(--search-box-shadow); 31 | z-index: 102; 32 | } 33 | 34 | #MSearchBox .left { 35 | display: inline-block; 36 | vertical-align: middle; 37 | height: 1.4em; 38 | } 39 | 40 | #MSearchSelect { 41 | display: inline-block; 42 | vertical-align: middle; 43 | width: 20px; 44 | height: 19px; 45 | background-image: var(--search-magnification-select-image); 46 | margin: 0 0 0 0.3em; 47 | padding: 0; 48 | } 49 | 50 | #MSearchSelectExt { 51 | display: inline-block; 52 | vertical-align: middle; 53 | width: 10px; 54 | height: 19px; 55 | background-image: var(--search-magnification-image); 56 | margin: 0 0 0 0.5em; 57 | padding: 0; 58 | } 59 | 60 | 61 | #MSearchField { 62 | display: inline-block; 63 | vertical-align: middle; 64 | width: 7.5em; 65 | height: 19px; 66 | margin: 0 0.15em; 67 | padding: 0; 68 | line-height: 1em; 69 | border:none; 70 | color: var(--search-foreground-color); 71 | outline: none; 72 | font-family: var(--font-family-search); 73 | -webkit-border-radius: 0px; 74 | border-radius: 0px; 75 | background: none; 76 | } 77 | 78 | @media(hover: none) { 79 | /* to avoid zooming on iOS */ 80 | #MSearchField { 81 | font-size: 16px; 82 | } 83 | } 84 | 85 | #MSearchBox .right { 86 | display: inline-block; 87 | vertical-align: middle; 88 | width: 1.4em; 89 | height: 1.4em; 90 | } 91 | 92 | #MSearchClose { 93 | display: none; 94 | font-size: inherit; 95 | background : none; 96 | border: none; 97 | margin: 0; 98 | padding: 0; 99 | outline: none; 100 | 101 | } 102 | 103 | #MSearchCloseImg { 104 | padding: 0.3em; 105 | margin: 0; 106 | } 107 | 108 | .MSearchBoxActive #MSearchField { 109 | color: var(--search-active-color); 110 | } 111 | 112 | 113 | 114 | /*---------------- Search filter selection */ 115 | 116 | #MSearchSelectWindow { 117 | display: none; 118 | position: absolute; 119 | left: 0; top: 0; 120 | border: 1px solid var(--search-filter-border-color); 121 | background-color: var(--search-filter-background-color); 122 | z-index: 10001; 123 | padding-top: 4px; 124 | padding-bottom: 4px; 125 | -moz-border-radius: 4px; 126 | -webkit-border-top-left-radius: 4px; 127 | -webkit-border-top-right-radius: 4px; 128 | -webkit-border-bottom-left-radius: 4px; 129 | -webkit-border-bottom-right-radius: 4px; 130 | -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); 131 | } 132 | 133 | .SelectItem { 134 | font: 8pt var(--font-family-search); 135 | padding-left: 2px; 136 | padding-right: 12px; 137 | border: 0px; 138 | } 139 | 140 | span.SelectionMark { 141 | margin-right: 4px; 142 | font-family: var(--font-family-monospace); 143 | outline-style: none; 144 | text-decoration: none; 145 | } 146 | 147 | a.SelectItem { 148 | display: block; 149 | outline-style: none; 150 | color: var(--search-filter-foreground-color); 151 | text-decoration: none; 152 | padding-left: 6px; 153 | padding-right: 12px; 154 | } 155 | 156 | a.SelectItem:focus, 157 | a.SelectItem:active { 158 | color: var(--search-filter-foreground-color); 159 | outline-style: none; 160 | text-decoration: none; 161 | } 162 | 163 | a.SelectItem:hover { 164 | color: var(--search-filter-highlight-text-color); 165 | background-color: var(--search-filter-highlight-bg-color); 166 | outline-style: none; 167 | text-decoration: none; 168 | cursor: pointer; 169 | display: block; 170 | } 171 | 172 | /*---------------- Search results window */ 173 | 174 | iframe#MSearchResults { 175 | /*width: 60ex;*/ 176 | height: 15em; 177 | } 178 | 179 | #MSearchResultsWindow { 180 | display: none; 181 | position: absolute; 182 | left: 0; top: 0; 183 | border: 1px solid var(--search-results-border-color); 184 | background-color: var(--search-results-background-color); 185 | z-index:10000; 186 | width: 300px; 187 | height: 400px; 188 | overflow: auto; 189 | } 190 | 191 | /* ----------------------------------- */ 192 | 193 | 194 | #SRIndex { 195 | clear:both; 196 | } 197 | 198 | .SREntry { 199 | font-size: 10pt; 200 | padding-left: 1ex; 201 | } 202 | 203 | .SRPage .SREntry { 204 | font-size: 8pt; 205 | padding: 1px 5px; 206 | } 207 | 208 | div.SRPage { 209 | margin: 5px 2px; 210 | background-color: var(--search-results-background-color); 211 | } 212 | 213 | .SRChildren { 214 | padding-left: 3ex; padding-bottom: .5em 215 | } 216 | 217 | .SRPage .SRChildren { 218 | display: none; 219 | } 220 | 221 | .SRSymbol { 222 | font-weight: bold; 223 | color: var(--search-results-foreground-color); 224 | font-family: var(--font-family-search); 225 | text-decoration: none; 226 | outline: none; 227 | } 228 | 229 | a.SRScope { 230 | display: block; 231 | color: var(--search-results-foreground-color); 232 | font-family: var(--font-family-search); 233 | font-size: 8pt; 234 | text-decoration: none; 235 | outline: none; 236 | } 237 | 238 | a.SRSymbol:focus, a.SRSymbol:active, 239 | a.SRScope:focus, a.SRScope:active { 240 | text-decoration: underline; 241 | } 242 | 243 | span.SRScope { 244 | padding-left: 4px; 245 | font-family: var(--font-family-search); 246 | } 247 | 248 | .SRPage .SRStatus { 249 | padding: 2px 5px; 250 | font-size: 8pt; 251 | font-style: italic; 252 | font-family: var(--font-family-search); 253 | } 254 | 255 | .SRResult { 256 | display: none; 257 | } 258 | 259 | div.searchresults { 260 | margin-left: 10px; 261 | margin-right: 10px; 262 | } 263 | 264 | /*---------------- External search page results */ 265 | 266 | .pages b { 267 | color: white; 268 | padding: 5px 5px 3px 5px; 269 | background-image: var(--nav-gradient-active-image-parent); 270 | background-repeat: repeat-x; 271 | text-shadow: 0 1px 1px #000000; 272 | } 273 | 274 | .pages { 275 | line-height: 17px; 276 | margin-left: 4px; 277 | text-decoration: none; 278 | } 279 | 280 | .hl { 281 | font-weight: bold; 282 | } 283 | 284 | #searchresults { 285 | margin-bottom: 20px; 286 | } 287 | 288 | .searchpages { 289 | margin-top: 10px; 290 | } 291 | 292 | -------------------------------------------------------------------------------- /docs/search/search_l.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/search/search_l.png -------------------------------------------------------------------------------- /docs/search/search_m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/search/search_m.png -------------------------------------------------------------------------------- /docs/search/search_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/search/search_r.png -------------------------------------------------------------------------------- /docs/search/searchdata.js: -------------------------------------------------------------------------------- 1 | var indexSectionsWithContent = 2 | { 3 | 0: "bcdnps", 4 | 1: "d", 5 | 2: "d", 6 | 3: "bcps", 7 | 4: "cdn", 8 | 5: "d", 9 | 6: "cd", 10 | 7: "d" 11 | }; 12 | 13 | var indexSectionNames = 14 | { 15 | 0: "all", 16 | 1: "classes", 17 | 2: "files", 18 | 3: "functions", 19 | 4: "variables", 20 | 5: "typedefs", 21 | 6: "enums", 22 | 7: "pages" 23 | }; 24 | 25 | var indexSectionLabels = 26 | { 27 | 0: "All", 28 | 1: "Classes", 29 | 2: "Files", 30 | 3: "Functions", 31 | 4: "Variables", 32 | 5: "Typedefs", 33 | 6: "Enumerations", 34 | 7: "Pages" 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /docs/search/typedefs_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/typedefs_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['dalireturnvalue_0',['daliReturnValue',['../_dali_bus_8h.html#a686dd03ccc96b1f1532f0fa4a46a7744',1,'DaliBus.h']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/search/variables_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/variables_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['commissiononlynew_0',['commissionOnlyNew',['../class_dali_class.html#acb5b0ebc685ae10f3e870ef13ec0683c',1,'DaliClass']]], 4 | ['commissionstate_1',['commissionState',['../class_dali_class.html#aef718f914b7e59fc1b3097259467b029',1,'DaliClass']]] 5 | ]; 6 | -------------------------------------------------------------------------------- /docs/search/variables_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/variables_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['dali_0',['Dali',['../_dali_8h.html#af6a260a728b354f13a5e0849e8c49959',1,'Dali.cpp']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/search/variables_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
    Loading...
    12 |
    13 | 18 |
    Searching...
    19 |
    No Matches
    20 | 28 |
    29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/search/variables_2.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['nextshortaddress_0',['nextShortAddress',['../class_dali_class.html#a340ae714905347dffe131a8e8b8851f8',1,'DaliClass']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/splitbar.png -------------------------------------------------------------------------------- /docs/splitbard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/splitbard.png -------------------------------------------------------------------------------- /docs/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/sync_off.png -------------------------------------------------------------------------------- /docs/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/sync_on.png -------------------------------------------------------------------------------- /docs/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/tab_a.png -------------------------------------------------------------------------------- /docs/tab_ad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/tab_ad.png -------------------------------------------------------------------------------- /docs/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/tab_b.png -------------------------------------------------------------------------------- /docs/tab_bd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/tab_bd.png -------------------------------------------------------------------------------- /docs/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/tab_h.png -------------------------------------------------------------------------------- /docs/tab_hd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/tab_hd.png -------------------------------------------------------------------------------- /docs/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/tab_s.png -------------------------------------------------------------------------------- /docs/tab_sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubsif/arduino-dali/28aafd04348bb17abc3dc1fb5b110b98bf475cee/docs/tab_sd.png -------------------------------------------------------------------------------- /docs/tabs.css: -------------------------------------------------------------------------------- 1 | .sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.main-menu-btn{position:relative;display:inline-block;width:36px;height:36px;text-indent:36px;margin-left:8px;white-space:nowrap;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.main-menu-btn-icon,.main-menu-btn-icon:before,.main-menu-btn-icon:after{position:absolute;top:50%;left:2px;height:2px;width:24px;background:var(--nav-menu-button-color);-webkit-transition:all .25s;transition:all .25s}.main-menu-btn-icon:before{content:'';top:-7px;left:0}.main-menu-btn-icon:after{content:'';top:7px;left:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon{height:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before{top:0;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after{top:0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}#main-menu-state{position:absolute;width:1px;height:1px;margin:-1px;border:0;padding:0;overflow:hidden;clip:rect(1px,1px,1px,1px)}#main-menu-state:not(:checked) ~ #main-menu{display:none}#main-menu-state:checked ~ #main-menu{display:block}@media(min-width:768px){.main-menu-btn{position:absolute;top:-99999px}#main-menu-state:not(:checked) ~ #main-menu{display:block}}.sm-dox{background-image:var(--nav-gradient-image)}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:var(--font-family-nav);font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:var(--nav-text-normal-shadow);color:var(--nav-text-normal-color);outline:0}.sm-dox a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:var(--nav-menu-toggle-color);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a span.sub-arrow:before{display:block;content:'+'}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:var(--nav-menu-background-color)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:var(--nav-menu-background-color);background-image:none}.sm-dox ul a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:var(--nav-gradient-image);line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:var(--nav-text-normal-color) transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:var(--nav-separator-image);background-repeat:no-repeat;background-position:right;-moz-border-radius:0 !important;-webkit-border-radius:0;border-radius:0 !important}.sm-dox a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox a:hover span.sub-arrow{border-color:var(--nav-text-hover-color) transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent var(--nav-menu-background-color) transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:var(--nav-menu-background-color);-moz-border-radius:5px !important;-webkit-border-radius:5px;border-radius:5px !important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent var(--nav-menu-foreground-color);border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:var(--nav-menu-foreground-color);background-image:none;border:0 !important;color:var(--nav-menu-foreground-color);background-image:none}.sm-dox ul a:hover{background-image:var(--nav-gradient-active-image);background-repeat:repeat-x;color:var(--nav-text-hover-color);text-shadow:var(--nav-text-hover-shadow)}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent var(--nav-text-hover-color)}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:var(--nav-menu-background-color);height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent var(--nav-menu-foreground-color) transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:var(--nav-menu-foreground-color) transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:var(--nav-gradient-image)}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:var(--nav-menu-background-color)}} -------------------------------------------------------------------------------- /examples/dali_blink.ino: -------------------------------------------------------------------------------- 1 | /** @file dali_blink.ino 2 | * simple DALI library usage example 3 | */ 4 | #include 5 | 6 | void setup() { 7 | Dali.begin(2, 3); 8 | } 9 | 10 | void loop() { 11 | // blink ballast with short address 3 12 | Dali.sendArc(3, 254); 13 | // alternatively to prevent fading you could use 14 | // Dali.sendCmd(3, Dali.CMD_RECALL_MIN); 15 | delay(1000); 16 | 17 | Dali.sendArc(3, 0); 18 | // alternatively to prevent fading you could use 19 | // Dali.sendCmd(3, Dali.CMD_OFF); 20 | delay(1000); 21 | } 22 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=Dali 2 | version=0.0.3 3 | author=hubsif 4 | maintainer=hubsif 5 | sentence=A (non-blocking) library for the Digital Addressable Lighting Interface (DALI) 6 | paragraph=This library allows you the create a DALI controller/gateway with an Arduino device. It supports sending commands, receiving responses and commissioning devices. It requires the TimerOne library for transmission and the PinChangeInterrupt library for reception. 7 | category=Communication 8 | url=https://github.com/hubsif/arduino-dali 9 | architectures=* 10 | includes=Dali.h 11 | -------------------------------------------------------------------------------- /src/Dali.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is free software; you can redistribute it and/or 3 | * modify it under the terms of the GNU Lesser General Public 4 | * License as published by the Free Software Foundation; either 5 | * version 2.1 of the License, or (at your option) any later version. 6 | * 7 | * This library is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | * Lesser General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU Lesser General Public 13 | * License along with this library; if not, write to the Free Software 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 15 | * MA 02110-1301 USA 16 | */ 17 | 18 | #include "dali.h" 19 | 20 | /* 21 | 0- 31 arc power control commands 22 | 32-143 configuration commands 23 | 144-223 query commands 24 | 224-255 application extended commands 25 | 256-271 special commands 26 | 272-287 extended special commands 27 | 28 | or: 29 | 256-271 0b10100001 30 | 272-287 0b11000001 31 | 32 | no address: >= 256 33 | repeat: 32-128(-143), 258, 259, 34 | */ 35 | 36 | void DaliClass::begin(byte tx_pin, byte rx_pin, bool active_low = true) { 37 | DaliBus.begin(tx_pin, rx_pin, active_low); 38 | } 39 | 40 | int DaliClass::sendRawWait(const byte * message, byte length, byte timeout = 50) { 41 | unsigned long time = millis(); 42 | int result; 43 | 44 | while (!DaliBus.busIsIdle()) 45 | if (millis() - time > timeout) return DALI_READY_TIMEOUT; 46 | 47 | result = DaliBus.sendRaw(message, length); 48 | 49 | while (!DaliBus.busIsIdle()) 50 | if (millis() - time > timeout) return DALI_READY_TIMEOUT; 51 | 52 | return (result != DALI_SENT) ? result : DaliBus.getLastResponse(); 53 | } 54 | 55 | byte * DaliClass::prepareCmd(byte * message, byte address, byte command, byte type, byte selector) { 56 | message[0] = type << 7; 57 | message[0] |= address << 1; 58 | message[0] |= selector; 59 | 60 | message[1] = command; 61 | return message; 62 | } 63 | 64 | daliReturnValue DaliClass::sendArc(byte address, byte value, byte addr_type = DALI_SHORT_ADDRESS) { 65 | byte message[2]; 66 | return DaliBus.sendRaw(prepareCmd(message, address, value, addr_type, 0), 2); 67 | } 68 | 69 | daliReturnValue DaliClass::sendArcWait(byte address, byte value, byte addr_type = DALI_SHORT_ADDRESS, byte timeout = 50) { 70 | byte message[2]; 71 | return sendRawWait(prepareCmd(message, address, value, addr_type, 0), 2, timeout); 72 | } 73 | 74 | daliReturnValue DaliClass::sendCmd(byte address, byte command, byte addr_type = DALI_SHORT_ADDRESS) { 75 | byte message[2]; 76 | return DaliBus.sendRaw(prepareCmd(message, address, command, addr_type, 1), 2); 77 | } 78 | 79 | int DaliClass::sendCmdWait(byte address, byte command, byte addr_type = DALI_SHORT_ADDRESS, byte timeout = 50) { 80 | byte sendCount = (command > 32 && command < 143) ? 2 : 1; // config commands need to be sent twice 81 | 82 | byte message[2]; 83 | int result; 84 | 85 | while (sendCount) { 86 | result = sendRawWait(prepareCmd(message, address, command, addr_type, 1), 2, timeout); 87 | if (result != DALI_RX_EMPTY) return result; 88 | sendCount--; 89 | } 90 | 91 | return result; 92 | } 93 | 94 | byte * DaliClass::prepareSpecialCmd(byte * message, word command, byte value) { 95 | message[0] = ((byte) command + 16) << 1; // convert command number 96 | message[0] |= 0b10000001; // to special command byte 97 | 98 | message[1] = value; 99 | return message; 100 | } 101 | 102 | daliReturnValue DaliClass::sendSpecialCmd(word command, byte value = 0) { 103 | if (command < 256 || command > 287) return 1; 104 | byte message[2]; 105 | return DaliBus.sendRaw(prepareSpecialCmd(message, command, value), 2); 106 | } 107 | 108 | int DaliClass::sendSpecialCmdWait(word command, byte value = 0, byte timeout = 50) { 109 | byte message[2]; 110 | return sendRawWait(prepareSpecialCmd(message, command, value), 2); 111 | } 112 | 113 | void DaliClass::commission(byte startAddress = 0, bool onlyNew = false) { 114 | nextShortAddress = startAddress; 115 | commissionOnlyNew = onlyNew; 116 | 117 | // start commissioning 118 | commissionState = COMMISSION_INIT; 119 | } 120 | 121 | void DaliClass::commission_tick() { 122 | // TODO: set timeout for commissioning? 123 | // TODO: also clear group addresses? 124 | 125 | static byte searchIterations; 126 | static unsigned long currentSearchAddress; 127 | 128 | if (DaliBus.busIsIdle()) { // wait until bus is idle 129 | switch (commissionState) { 130 | case COMMISSION_INIT: 131 | sendSpecialCmd(CMD_INITIALISE, (commissionOnlyNew ? 255 : 0)); 132 | commissionState = COMMISSION_INIT2; 133 | break; 134 | case COMMISSION_INIT2: 135 | sendSpecialCmd(CMD_INITIALISE, (commissionOnlyNew ? 255 : 0)); 136 | commissionState = (commissionOnlyNew ? COMMISSION_RANDOM : COMMISSION_WRITE_DTR); 137 | break; 138 | case COMMISSION_WRITE_DTR: 139 | sendSpecialCmd(CMD_SET_DTR, 255); 140 | commissionState = COMMISSION_REMOVE_SHORT; 141 | break; 142 | case COMMISSION_REMOVE_SHORT: 143 | sendCmd(63, CMD_DTR_AS_SHORT, DALI_GROUP_ADDRESS); 144 | commissionState = COMMISSION_REMOVE_SHORT2; 145 | break; 146 | case COMMISSION_REMOVE_SHORT2: 147 | sendCmd(63, CMD_DTR_AS_SHORT, DALI_GROUP_ADDRESS); 148 | commissionState = COMMISSION_RANDOM; 149 | break; 150 | case COMMISSION_RANDOM: 151 | sendSpecialCmd(CMD_RANDOMISE); 152 | commissionState = COMMISSION_RANDOM2; 153 | break; 154 | case COMMISSION_RANDOM2: 155 | sendSpecialCmd(CMD_RANDOMISE); 156 | commissionState = COMMISSION_RANDOMWAIT; 157 | break; 158 | case COMMISSION_RANDOMWAIT: // wait 100ms for random address to generate 159 | if (DaliBus.busIdleCount >= 255) 160 | commissionState = COMMISSION_STARTSEARCH; 161 | break; 162 | case COMMISSION_STARTSEARCH: 163 | searchIterations = 0; 164 | currentSearchAddress = 0xFFFFFF; 165 | case COMMISSION_SEARCHHIGH: 166 | sendSpecialCmd(CMD_SEARCHADDRH, (currentSearchAddress >> 16) & 0xFF); 167 | commissionState = COMMISSION_SEARCHMID; 168 | break; 169 | case COMMISSION_SEARCHMID: 170 | sendSpecialCmd(CMD_SEARCHADDRM, (currentSearchAddress >> 8) & 0xFF); 171 | commissionState = COMMISSION_SEARCHLOW; 172 | break; 173 | case COMMISSION_SEARCHLOW: 174 | sendSpecialCmd(CMD_SEARCHADDRL, (currentSearchAddress) & 0xFF); 175 | commissionState = COMMISSION_COMPARE; 176 | break; 177 | case COMMISSION_COMPARE: 178 | sendSpecialCmd(CMD_COMPARE); 179 | commissionState = COMMISSION_CHECKFOUND; 180 | break; 181 | case COMMISSION_CHECKFOUND: 182 | { // create scope for response variable 183 | int response = DaliBus.getLastResponse(); 184 | if (response != DALI_RX_EMPTY) 185 | if (searchIterations >= 24) // ballast found 186 | commissionState = COMMISSION_PROGRAMSHORT; 187 | else { 188 | currentSearchAddress -= (0x800000 >> searchIterations); 189 | commissionState = COMMISSION_SEARCHHIGH; 190 | } 191 | else 192 | if (searchIterations == 0 || searchIterations > 24) // no device at all responded or error 193 | commissionState = COMMISSION_TERMINATE; 194 | else if (searchIterations == 24) { // device responded before, but didn't now, so address is one higher 195 | currentSearchAddress++; // and for the device to act at upcoming commands, we need to send the actual address 196 | commissionState = COMMISSION_SEARCHHIGH; 197 | } 198 | else { // there's a device that didn't respond anymore, increase address 199 | currentSearchAddress += (0x800000 >> searchIterations); 200 | commissionState = COMMISSION_SEARCHHIGH; 201 | } 202 | searchIterations++; 203 | break; 204 | } 205 | case COMMISSION_PROGRAMSHORT: 206 | sendSpecialCmd(CMD_PROGRAMSHORT, (nextShortAddress << 1) | 1); 207 | commissionState = COMMISSION_VERIFYSHORT; 208 | break; 209 | case COMMISSION_VERIFYSHORT: 210 | sendSpecialCmd(CMD_VERIFYSHORT, (nextShortAddress << 1) | 1); 211 | commissionState = COMMISSION_VERIFYSHORTRESPONSE; 212 | break; 213 | case COMMISSION_VERIFYSHORTRESPONSE: 214 | if (DaliBus.getLastResponse() == 0xFF) { 215 | nextShortAddress++; 216 | commissionState = COMMISSION_WITHDRAW; 217 | } else 218 | // error, stop commissioning 219 | commissionState = COMMISSION_TERMINATE; 220 | break; 221 | case COMMISSION_WITHDRAW: 222 | sendSpecialCmd(CMD_WITHDRAW); 223 | commissionState = COMMISSION_STARTSEARCH; 224 | break; 225 | case COMMISSION_TERMINATE: 226 | sendSpecialCmd(CMD_TERMINATE); 227 | commissionState = COMMISSION_OFF; 228 | break; 229 | } 230 | } 231 | } 232 | 233 | DaliClass Dali; 234 | -------------------------------------------------------------------------------- /src/Dali.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * This library is free software; you can redistribute it and/or * 3 | * modify it under the terms of the GNU Lesser General Public * 4 | * License as published by the Free Software Foundation; either * 5 | * version 2.1 of the License, or (at your option) any later version. * 6 | * * 7 | * This library is distributed in the hope that it will be useful, * 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 10 | * Lesser General Public License for more details. * 11 | * * 12 | * You should have received a copy of the GNU Lesser General Public * 13 | * License along with this library; if not, write to the Free Software * 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * 15 | * MA 02110-1301 USA * 16 | ***********************************************************************/ 17 | 18 | /** 19 | * @mainpage 20 | * This library allows you to create a DALI controller/gateway with an Arduino device. 21 | * It supports sending commands, receiving responses and commissioning devices. 22 | * It requires the TimerOne library for transmission and the PinChangeInterrupt library 23 | * for reception. These libraries need to be installed with the Library Manager in the 24 | * Arduino IDE. 25 | * 26 | * @par Simple example 27 | * @include dali_blink.ino 28 | * 29 | * @par Changelog 30 | * - v0.0.3 (2022-09-19) Make commissioning state public 31 | * - v0.0.2 (2019-05-14) Initial release 32 | * 33 | * @author hubsif 34 | * @example dali_blink.ino 35 | * 36 | * @file Dali.h 37 | * @brief Main header file of the DALI library for Arduino 38 | */ 39 | 40 | 41 | #ifndef DALI_H 42 | #define DALI_H 43 | 44 | #include 45 | #include "dalibus.h" 46 | 47 | /** 48 | * DALI library base class. 49 | */ 50 | class DaliClass { 51 | public: 52 | /** DALI commands */ 53 | enum daliCmd { 54 | CMD_OFF = 0, CMD_UP = 1, CMD_DOWN = 2, CMD_STEP_UP = 3, CMD_STEP_DOWN = 4, 55 | CMD_RECALL_MAX = 5, CMD_RECALL_MIN = 6, CMD_STEP_DOWN_AND_OFF = 7, CMD_ON_AND_STEP_UP = 8, 56 | CMD_GO_TO_LAST = 10, // DALI-2 57 | CMD_GO_TO_SCENE = 16, 58 | CMD_RESET = 32, CMD_ARC_TO_DTR = 33, 59 | CMD_SAVE_VARS = 34, CMD_SET_OPMODE = 35, CMD_RESET_MEM = 36, CMD_IDENTIFY = 37, // DALI-2 60 | CMD_DTR_AS_MAX = 42, CMD_DTR_AS_MIN = 43, CMD_DTR_AS_FAIL = 44, CMD_DTR_AS_POWER_ON = 45, CMD_DTR_AS_FADE_TIME = 46, CMD_DTR_AS_FADE_RATE = 47, 61 | CMD_DTR_AS_EXT_FADE_TIME = 48, // DALI-2 62 | CMD_DTR_AS_SCENE = 64, CMD_REMOVE_FROM_SCENE = 80, 63 | CMD_ADD_TO_GROUP = 96, CMD_REMOVE_FROM_GROUP = 112, 64 | CMD_DTR_AS_SHORT = 128, 65 | CMD_QUERY_STATUS = 144, CMD_QUERY_BALLAST = 145, CMD_QUERY_LAMP_FAILURE = 146, CMD_QUERY_LAMP_POWER_ON = 147, CMD_QUERY_LIMIT_ERROR = 148, 66 | CMD_QUERY_RESET_STATE = 149, CMD_QUERY_MISSING_SHORT = 150, CMD_QUERY_VERSION = 151, CMD_QUERY_DTR = 152, CMD_QUERY_DEVICE_TYPE = 153, 67 | CMD_QUERY_PHYS_MIN = 154, CMD_QUERY_POWER_FAILURE = 155, 68 | CMD_QUERY_OPMODE = 158, CMD_QUERY_LIGHTTYPE = 159, // DALI-2 69 | CMD_QUERY_ACTUAL_LEVEL = 160, CMD_QUERY_MAX_LEVEL = 161, CMD_QUERY_MIN_LEVEL = 162, CMD_QUERY_POWER_ON_LEVEL = 163, CMD_QUERY_FAIL_LEVEL = 164, CMD_QUERY_FADE_SPEEDS = 165, 70 | CMD_QUERY_SPECMODE = 166, CMD_QUERY_NEXT_DEVTYPE = 167, CMD_QUERY_EXT_FADE_TIME = 168, CMD_QUERY_CTRL_GEAR_FAIL = 169, // DALI-2 71 | CMD_QUERY_SCENE_LEVEL = 176, 72 | CMD_QUERY_GROUPS_0_7 = 192, CMD_QUERY_GROUPS_8_15 = 193, 73 | CMD_QUERY_ADDRH = 194, CMD_QUERY_ADDRM = 195, CMD_QUERY_ADDRL = 196 74 | }; 75 | 76 | /** DALI special commands */ 77 | enum daliSpecialCmd { 78 | CMD_TERMINATE = 256, CMD_SET_DTR = 257, 79 | CMD_INITIALISE = 258, CMD_RANDOMISE = 259, CMD_COMPARE = 260, CMD_WITHDRAW = 261, 80 | CMD_SEARCHADDRH = 264, CMD_SEARCHADDRM = 265, CMD_SEARCHADDRL = 266, 81 | CMD_PROGRAMSHORT = 267, CMD_VERIFYSHORT = 268, CMD_QUERY_SHORT = 269, CMD_PHYS_SEL = 270, 82 | CMD_ENABLE_DT = 272, CMD_LOAD_DTR1 = 273, CMD_LOAD_DTR2 = 274, CMD_WRITE_MEM_LOC = 275, 83 | CMD_WRITE_MEM_LOC_NOREPLY = 276 // DALI-2 84 | }; 85 | 86 | /** DALI device types */ 87 | enum daliDevTypes { 88 | FLUORESCENT_LAMP, 89 | EMERGENCY_LIGHT, 90 | DISCHARGE_LAMP, 91 | HALOGEN_LAMP, 92 | INCANDESCENT_LAMP, 93 | DC_CONVERTER, 94 | LED_MODULE, 95 | SWITCH, 96 | COLOUR_CTRL, 97 | SEQUENCER, 98 | OPTICAL_CTRL 99 | }; 100 | 101 | /** Type of address (short/group) */ 102 | enum daliAddressTypes { 103 | DALI_SHORT_ADDRESS = 0, 104 | DALI_GROUP_ADDRESS = 1 105 | }; 106 | 107 | /** Start the DALI bus 108 | * @param tx_pin Pin to use for transmission 109 | * @param rx_pin Pin to use for reception. Must support Pin Change Interrupt. 110 | * @param active_low set to false if bus is active low 111 | * 112 | * Initialize the hardware for DALI usage (i.e. set pin modes, timer and interrupts). By default the bus is 113 | * driven active-low, meaning with the µC tx pin being low the DALI bus will be high (idle). For transmission 114 | * the µC pin will be set high, which will pull the DALI voltage low. This behaviour 115 | * is used by most DALI hardware interfaces. The same logic applies to the rx pin. */ 116 | void begin(byte tx_pin, byte rx_pin, bool active_low = true); 117 | 118 | /** Send a direct arc level command 119 | * @param address destination address 120 | * @param value arc level 121 | * @param addr_type address type (short/group) 122 | * @return ::daliReturnValue 123 | * 124 | * This methods sends a "direct arc power control command" to the bus 125 | * It doesn't check if the bus is ready and returns immediately, stating if transmission could be 126 | * initiated through its response value ::daliReturnValue. */ 127 | daliReturnValue sendArc(byte address, byte value, byte addr_type = DALI_SHORT_ADDRESS); 128 | 129 | /** Send a direct arc level command and wait for its completion 130 | * @param address destination address 131 | * @param value arc level 132 | * @param addr_type address type (short/group) 133 | * @return ::daliReturnValue 134 | * 135 | * This methods sends a "direct arc power control command" to the bus 136 | * It uses sendRawWait(), so it waits for the bus to become idle before and after transmission. */ 137 | daliReturnValue sendArcWait(byte address, byte value, byte addr_type = DALI_SHORT_ADDRESS, byte timeout = 50); 138 | 139 | /** Send a DALI command 140 | * @param address destination address 141 | * @param command DALI command 142 | * @param addr_type address type (short/group) 143 | * @return ::daliReturnValue 144 | * This method sends a DALI Command to the bus (Commands from 0 to 255). 145 | * It doesn't check if the bus is ready and returns immediately, stating if transmission could be 146 | * initiated through its response value ::daliReturnValue. 147 | * Note that some of the special commands need to be sent twice (258 - INITIALISE, 259 - RANDOMISE), which 148 | * this method doesn't do by itself. */ 149 | daliReturnValue sendCmd(byte address, byte command, byte addr_type = DALI_SHORT_ADDRESS); 150 | 151 | /** Send a DALI command, wait for its completion and return the response if available 152 | * @param address destination address 153 | * @param command DALI command 154 | * @param addr_type address type (short/group) 155 | * @param timeout time in ms to wait for action to complete 156 | * @return returns either the response, DALI_RX_EMPTY or any of ::daliReturnValue on error */ 157 | int sendCmdWait(byte address, byte command, byte addr_type = DALI_SHORT_ADDRESS, byte timeout = 50); 158 | 159 | /** Send a DALI special command 160 | * @param command DALI special command 161 | * @param value Value (2nd byte) 162 | * @return ::daliReturnValue 163 | * 164 | * This method sends a DALI Special Command to the bus (Special Commands are commands from 256 to 287). 165 | * It doesn't check if the bus is ready and returns immediately, stating if transmission could be 166 | * initiated through its response value ::daliReturnValue. 167 | * Note that some of the special commands need to be sent twice (258 - INITIALISE, 259 - RANDOMISE), which 168 | * this method doesn't do by itself. */ 169 | daliReturnValue sendSpecialCmd(word command, byte value = 0); 170 | 171 | /** Send a DALI special command, wait for its completion and return the response if available 172 | * @param command DALI special command 173 | * @param value Value (2nd byte) 174 | * @param timeout time in ms to wait for action to complete 175 | * @return returns either the response, DALI_RX_EMPTY or any of ::daliReturnValue on error 176 | * 177 | * This method sends a DALI Special Command to the bus (Special Commands are commands from 256 to 287). 178 | * It uses sendRawWait(), so it waits for the bus to become idle before and after transmission. 179 | * It returns either the received response, DALI_RX_EMPTY if no response has been received or any of 180 | * ::daliReturnValue if an error has occurred. 181 | * Note that some of the special commands need to be sent twice (258 - INITIALISE, 259 - RANDOMISE), which 182 | * this method doesn't do by itself. */ 183 | int sendSpecialCmdWait(word command, byte value = 0, byte timeout = 50); 184 | 185 | /** Send raw values to the DALI bus 186 | * @param message byte array to send 187 | * @param length length of the byte array 188 | * @param timeout time in ms to wait for action to complete 189 | * 190 | * This method sends a raw byte array of @p length to the bus. The array can be three bytes max. 191 | * It waits for the bus to become idle before and after transmission. It returns either the received response, 192 | * DALI_RX_EMPTY if no response has been received or any of ::daliReturnValue if an error has occurred. */ 193 | int sendRawWait(const byte * message, byte length, byte timeout = 50); 194 | 195 | /** Initiate commissioning of all DALI ballasts 196 | * @param startAddress address starting short address assignment from 197 | * @param onlyNew commission only ballasts without short address 198 | * 199 | * This method starts the DALI commissioning process. During commissioning the method commission_tick() 200 | * needs to be called repeatedly until commissioning has finished. By default commissioning is done for 201 | * all ballasts on the bus (@p onlyNew = false). With this, at first current short addresses from 202 | * all ballasts are removed. Then all found ballasts are assigned a new short address, starting 203 | * from @p startAddress. Commissioning has finished when @p commissionState is set back to COMMISSION_OFF. 204 | * The number of ballasts found can be determined from #nextShortAddress. 205 | * With @p onlyNew = true ballasts with a short address assigned are ignored. The caller is responsible 206 | * for setting an appropriate value to @p startAddress. */ 207 | void commission(byte startAddress = 0, bool onlyNew = false); 208 | 209 | /** State machine ticker for commissioning. See commission(). */ 210 | void commission_tick(); 211 | 212 | /** next address to program on commissioning. When commissioning finished, reflects number of ballasts found. */ 213 | byte nextShortAddress; 214 | 215 | /** When true, only ballasts without short address set are commissioned. */ 216 | bool commissionOnlyNew; 217 | 218 | /** commissioning state machine states */ 219 | enum commissionStateEnum { 220 | COMMISSION_OFF, COMMISSION_INIT, COMMISSION_INIT2, COMMISSION_WRITE_DTR, COMMISSION_REMOVE_SHORT, COMMISSION_REMOVE_SHORT2, COMMISSION_RANDOM, COMMISSION_RANDOM2, COMMISSION_RANDOMWAIT, 221 | COMMISSION_STARTSEARCH, COMMISSION_SEARCHHIGH, COMMISSION_SEARCHMID, COMMISSION_SEARCHLOW, 222 | COMMISSION_COMPARE, COMMISSION_CHECKFOUND, COMMISSION_PROGRAMSHORT, 223 | COMMISSION_VERIFYSHORT, COMMISSION_VERIFYSHORTRESPONSE, COMMISSION_QUERYDEVICETYPE, COMMISSION_QUERYDEVICETYPERESPONSE, 224 | COMMISSION_WITHDRAW, COMMISSION_TERMINATE 225 | }; 226 | commissionStateEnum commissionState = COMMISSION_OFF; /**< current state of commissioning state machine */ 227 | 228 | protected: 229 | /** Prepares a byte array for sending DALI commands */ 230 | byte * prepareCmd(byte * message, byte address, byte command, byte type, byte selector); 231 | 232 | /** Prepares a byte array for sending DALI Special Commands */ 233 | byte * prepareSpecialCmd(byte * message, word command, byte value); 234 | }; 235 | 236 | /** Dali class instance for main usage (seems to be common Arduino Library style) */ 237 | extern DaliClass Dali; 238 | 239 | #endif // DALI_H 240 | -------------------------------------------------------------------------------- /src/DaliBus.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This library is free software; you can redistribute it and/or 3 | * modify it under the terms of the GNU Lesser General Public 4 | * License as published by the Free Software Foundation; either 5 | * version 2.1 of the License, or (at your option) any later version. 6 | * 7 | * This library is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 | * Lesser General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU Lesser General Public 13 | * License along with this library; if not, write to the Free Software 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 15 | * MA 02110-1301 USA 16 | */ 17 | 18 | #include "DaliBus.h" 19 | 20 | // wrapper for interrupt handler 21 | void DaliBus_wrapper_pinchangeISR() { DaliBus.pinchangeISR(); } 22 | void DaliBus_wrapper_timerISR() { DaliBus.timerISR(); } 23 | 24 | void DaliBusClass::begin(byte tx_pin, byte rx_pin, bool active_low = true) { 25 | txPin = tx_pin; 26 | rxPin = rx_pin; 27 | activeLow = active_low; 28 | 29 | // init bus state 30 | busState = IDLE; 31 | 32 | // TX pin setup 33 | pinMode(txPin, OUTPUT); 34 | setBusLevel(HIGH); 35 | 36 | // RX pin setup 37 | pinMode(rxPin, INPUT); 38 | attachPinChangeInterrupt(digitalPinToPinChangeInterrupt(rxPin), DaliBus_wrapper_pinchangeISR, CHANGE); 39 | 40 | // Timer setup 41 | Timer1.initialize(DALI_TE); // set timer to time of one half-bit 42 | Timer1.attachInterrupt(DaliBus_wrapper_timerISR); 43 | } 44 | 45 | daliReturnValue DaliBusClass::sendRaw(const byte * message, byte length) { 46 | if (length > 3) return DALI_INVALID_PARAMETER; 47 | if (busState != IDLE) return DALI_BUSY; 48 | 49 | // prepare variables for sending 50 | for (byte i = 0; i < length; i++) 51 | txMessage[i] = message[i]; 52 | txLength = length * 8; 53 | txCollision = 0; 54 | rxMessage = DALI_RX_EMPTY; 55 | rxLength = 0; 56 | 57 | // initiate transmission 58 | busState = TX_START_1ST; 59 | return DALI_SENT; 60 | } 61 | 62 | bool DaliBusClass::busIsIdle() { 63 | return (busState == IDLE); 64 | } 65 | 66 | int DaliBusClass::getLastResponse() { 67 | int response; 68 | switch (rxLength) { 69 | case 16: 70 | response = rxMessage; 71 | break; 72 | case 0: 73 | response = DALI_RX_EMPTY; 74 | break; 75 | default: 76 | response = DALI_RX_ERROR; 77 | } 78 | rxLength = 0; 79 | return response; 80 | } 81 | 82 | void DaliBusClass::timerISR() { 83 | if (busIdleCount < 0xff) // increment idle counter avoiding overflow 84 | busIdleCount++; 85 | 86 | if (busIdleCount == 4 && getBusLevel() == LOW) { // bus is low idle for more than 2 TE, something's pulling down for too long 87 | busState = SHORT; 88 | setBusLevel(HIGH); 89 | // TODO: log error? 90 | } 91 | 92 | // timer state machine 93 | switch (busState) { 94 | case TX_START_1ST: // initiate transmission by setting bus low (1st half) 95 | if (busIdleCount >= 26) { // wait at least 9.17ms (22 TE) settling time before sending (little more for TCI compatibility) 96 | setBusLevel(LOW); 97 | busState = TX_START_2ND; 98 | } 99 | break; 100 | case TX_START_2ND: // send start bit (2nd half) 101 | setBusLevel(HIGH); 102 | txPos = 0; 103 | busState = TX_BIT_1ST; 104 | break; 105 | case TX_BIT_1ST: // prepare bus for bit (1st half) 106 | if (txMessage[txPos >> 3] & 1 << (7 - (txPos & 0x7))) 107 | setBusLevel(LOW); 108 | else 109 | setBusLevel(HIGH); 110 | busState = TX_BIT_2ND; 111 | break; 112 | case TX_BIT_2ND: // send bit (2nd half) 113 | if (txMessage[txPos >> 3] & 1 << (7 - (txPos & 0x7))) 114 | setBusLevel(HIGH); 115 | else 116 | setBusLevel(LOW); 117 | txPos++; 118 | if (txPos < txLength) 119 | busState = TX_BIT_1ST; 120 | else 121 | busState = TX_STOP_1ST; 122 | break; 123 | case TX_STOP_1ST: // 1st stop bit (1st half) 124 | setBusLevel(HIGH); 125 | busState = TX_STOP; 126 | break; 127 | case TX_STOP: // remaining stop half-bits 128 | if (busIdleCount >= 4) { 129 | busState = WAIT_RX; 130 | busIdleCount = 0; 131 | } 132 | break; 133 | case WAIT_RX: // wait 9.17ms (22 TE) for a response 134 | if (busIdleCount > 23) 135 | busState = IDLE; // response timed out 136 | break; 137 | case RX_STOP: 138 | if (busIdleCount > 4) { 139 | // rx message incl stop bits finished. 140 | busState = IDLE; 141 | } 142 | break; 143 | case RX_START: 144 | case RX_BIT: 145 | if (busIdleCount > 3) // bus has been inactive for too long 146 | busState = IDLE; // rx has been interrupted, bus is idle 147 | break; 148 | } 149 | } 150 | 151 | void DaliBusClass::pinchangeISR() { 152 | byte busLevel = getBusLevel(); // TODO: do we have to check if level actually changed? 153 | busIdleCount = 0; // reset idle counter so timer knows that something's happening 154 | 155 | if (busState <= TX_STOP) { // check if we are transmitting 156 | if (busLevel != txBusLevel) { // check for collision 157 | txCollision = 1; // signal collision 158 | busState = IDLE; // stop transmission 159 | } 160 | return; // no collision, ignore pin change 161 | } 162 | 163 | // logical bus level changed -> store timings 164 | unsigned long tmp_ts = micros(); 165 | unsigned long delta = tmp_ts - rxLastChange; // store delta since last change 166 | rxLastChange = tmp_ts; // store timestamp 167 | 168 | // rx state machine 169 | switch (busState) { 170 | case WAIT_RX: 171 | if (busLevel == LOW) { // start of rx frame 172 | //Timer1.restart(); // sync timer 173 | busState = RX_START; 174 | } else 175 | busState = IDLE; // bus can't actually be high, reset 176 | // TODO: log error? 177 | break; 178 | case RX_START: 179 | if (busLevel == HIGH && isDeltaWithinTE(delta)) { // validate start bit 180 | rxLength = 0; // clear old rx message 181 | rxMessage = 0; 182 | busState = RX_BIT; 183 | } else { // invalid start bit -> reset bus state 184 | rxLength = DALI_RX_ERROR; 185 | busState = RX_STOP; 186 | } 187 | break; 188 | case RX_BIT: 189 | if (isDeltaWithinTE(delta)) { // check if change is within time of a half-bit 190 | if (rxLength % 2) // if rxLength is odd (= actual bit change) 191 | rxMessage = rxMessage << 1 | busLevel; // shift in received bit 192 | rxLength++; 193 | } else if (isDeltaWithin2TE(delta)) { // check if change is within time of two half-bits 194 | rxMessage = rxMessage << 1 | busLevel; // shift in received bit 195 | rxLength += 2; 196 | } else { 197 | rxLength = DALI_RX_ERROR; 198 | busState = RX_STOP; // timing error -> reset state 199 | } 200 | if (rxLength == 16) // check if all 8 bits have been received 201 | busState = RX_STOP; 202 | break; 203 | case SHORT: 204 | if (busLevel == HIGH) 205 | busState = IDLE; // recover from bus error 206 | break; 207 | case IDLE: 208 | break; // ignore, we didn't expect rx 209 | } 210 | } 211 | 212 | bool DaliBusClass::isDeltaWithinTE(unsigned long delta) { 213 | return (DALI_TE_MIN <= delta && delta <= DALI_TE_MAX); 214 | } 215 | 216 | bool DaliBusClass::isDeltaWithin2TE(unsigned long delta) { 217 | return (2*DALI_TE_MIN <= delta && delta <= 2*DALI_TE_MAX); 218 | } 219 | 220 | byte DaliBusClass::getBusLevel() { 221 | return (activeLow ? !digitalRead(rxPin) : digitalRead(rxPin)); 222 | } 223 | 224 | void DaliBusClass::setBusLevel(byte level) { 225 | digitalWrite(txPin, (activeLow ? !level : level)); 226 | txBusLevel = level; 227 | } 228 | 229 | DaliBusClass DaliBus; 230 | -------------------------------------------------------------------------------- /src/DaliBus.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * This library is free software; you can redistribute it and/or * 3 | * modify it under the terms of the GNU Lesser General Public * 4 | * License as published by the Free Software Foundation; either * 5 | * version 2.1 of the License, or (at your option) any later version. * 6 | * * 7 | * This library is distributed in the hope that it will be useful, * 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 10 | * Lesser General Public License for more details. * 11 | * * 12 | * You should have received a copy of the GNU Lesser General Public * 13 | * License along with this library; if not, write to the Free Software * 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * 15 | * MA 02110-1301 USA * 16 | ***********************************************************************/ 17 | 18 | /** 19 | * @file DaliBus.h 20 | * @brief DALI low level interface 21 | * 22 | * This file contains the low level part of the Dali library 23 | * 24 | * @author Hubert Nusser 25 | * @date 2019-05-14 26 | */ 27 | 28 | #include "Arduino.h" 29 | 30 | // TimerOne library for tx timer 31 | #include "TimerOne.h" 32 | // PinChangeInterrupt library for rx interrupt 33 | #include "PinChangeInterrupt.h" 34 | 35 | const int DALI_BAUD = 1200; 36 | const unsigned long DALI_TE = 417; 37 | const unsigned long DALI_TE_MIN = ( 80 * DALI_TE) / 100; // 333us 38 | const unsigned long DALI_TE_MAX = (120 * DALI_TE) / 100; // 500us 39 | 40 | 41 | /** some enum */ 42 | typedef enum daliReturnValue { 43 | DALI_RX_EMPTY = -1, 44 | DALI_RX_ERROR = -2, 45 | DALI_SENT = -3, 46 | DALI_INVALID_PARAMETER = -4, 47 | DALI_BUSY = -5, 48 | DALI_READY_TIMEOUT = -6, 49 | DALI_SEND_TIMEOUT = -7, 50 | DALI_COLLISION = -8, 51 | } daliReturnValue; 52 | 53 | class DaliBusClass { 54 | public: 55 | void begin(byte tx_pin, byte rx_pin, bool active_low = true); 56 | daliReturnValue sendRaw(const byte * message, byte length); 57 | 58 | int getLastResponse(); 59 | 60 | bool busIsIdle(); 61 | volatile byte busIdleCount; 62 | 63 | void timerISR(); 64 | void pinchangeISR(); 65 | 66 | protected: 67 | byte txPin, rxPin; 68 | bool activeLow; 69 | byte txMessage[3]; 70 | byte txLength; 71 | 72 | enum busStateEnum { 73 | TX_START_1ST, TX_START_2ND, 74 | TX_BIT_1ST, TX_BIT_2ND, 75 | TX_STOP_1ST, TX_STOP, 76 | IDLE, 77 | SHORT, 78 | WAIT_RX, RX_START, RX_BIT, RX_STOP 79 | }; 80 | volatile busStateEnum busState; 81 | volatile byte txPos; 82 | volatile byte txBusLevel; 83 | volatile byte txCollision; 84 | 85 | volatile unsigned long rxLastChange; 86 | volatile byte rxMessage; 87 | volatile char rxLength; 88 | volatile char rxError; 89 | 90 | bool isDeltaWithinTE(unsigned long delta); 91 | bool isDeltaWithin2TE(unsigned long delta); 92 | byte getBusLevel(); 93 | void setBusLevel(byte level); 94 | }; 95 | 96 | extern DaliBusClass DaliBus; 97 | --------------------------------------------------------------------------------