File syn_dali.h¶
FileList > proto > syn_dali.h
Go to the source code of this file
Digital Addressable Lighting Interface (DALI / IEC 62386) Protocol Stack. More...
#include "../common/syn_defs.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_DALI_BackwardFrame DALI Backward Frame (Control Gear -> Master, 8-bit payload) |
| struct | SYN_DALI_ForwardFrame DALI Forward Frame (Master -> Control Gear, 16-bit payload) |
| struct | SYN_DALI_SlaveConfig DALI Slave Configuration. |
| struct | SYN_DALI_SlaveState DALI Slave Runtime State. |
Public Types¶
| Type | Name |
|---|---|
| enum | SYN_DALI_AddressType DALI Address Types. |
Public Functions¶
| Type | Name |
|---|---|
| bool | syn_dali_decode_backward (uint8_t raw_8, SYN_DALI_BackwardFrame * frame) Decode an 8-bit Slave Backward Frame. |
| bool | syn_dali_decode_forward (uint16_t raw_16, SYN_DALI_ForwardFrame * frame) Decode a 16-bit Master Forward Frame. |
| uint8_t | syn_dali_encode_backward (uint8_t data) Encode an 8-bit Slave Backward Frame. |
| uint16_t | syn_dali_encode_forward (uint8_t addr, uint8_t data_cmd) Encode a 16-bit Master Forward Frame. |
| bool | syn_dali_manchester_decode_byte (const uint8_t * bit_in, uint8_t * val_out) Decode Manchester bi-phase bit pairs into a byte value. |
| size_t | syn_dali_manchester_encode_byte (uint8_t val, uint8_t * bit_out) Encode a byte sequence into Manchester bi-phase bits. |
| SYN_Status | syn_dali_slave_init (SYN_DALI_SlaveState * slave, const SYN_DALI_SlaveConfig * cfg) Initialize a DALI Slave Control Gear instance. |
| SYN_Status | syn_dali_slave_process (SYN_DALI_SlaveState * slave, const SYN_DALI_ForwardFrame * req, uint8_t * resp_data, bool * has_resp) Process an incoming DALI Forward Frame on a Slave Control Gear node. |
Macros¶
Detailed Description¶
Implements non-blocking, zero-malloc DALI (IEC 62386-101/102) Manchester bi-phase frame encoding/decoding, address matching (Short, Group, Broadcast), Direct Arc Power control ($0..254$), standard commands, configuration commands, and query responses.
** **
static SYN_DALI_SlaveState dali_slave;
SYN_DALI_SlaveConfig cfg = {
.short_address = 5,
.min_level = 10,
.max_level = 254,
.power_on_level = 254,
.system_failure_level = 254
};
syn_dali_slave_init(&dali_slave, &cfg);
SYN_DALI_ForwardFrame req;
if (syn_dali_decode_forward(raw_16, &req)) {
uint8_t resp = 0;
bool has_resp = false;
syn_dali_slave_process(&dali_slave, &req, &resp, &has_resp);
}
Public Types Documentation¶
enum SYN_DALI_AddressType¶
DALI Address Types.
enum SYN_DALI_AddressType {
SYN_DALI_ADDR_SHORT = 0,
SYN_DALI_ADDR_GROUP,
SYN_DALI_ADDR_BROADCAST,
SYN_DALI_ADDR_SPECIAL
};
Public Functions Documentation¶
function syn_dali_decode_backward¶
Decode an 8-bit Slave Backward Frame.
Parameters:
raw_8Raw 8-bit frame integer.frame[out] Decoded frame structure.
Returns:
true on valid frame decoding.
function syn_dali_decode_forward¶
Decode a 16-bit Master Forward Frame.
Parameters:
raw_16Raw 16-bit frame integer.frame[out] Decoded frame structure.
Returns:
true on valid frame decoding.
function syn_dali_encode_backward¶
Encode an 8-bit Slave Backward Frame.
Parameters:
data8-bit response payload.
Returns:
Raw 8-bit frame integer.
function syn_dali_encode_forward¶
Encode a 16-bit Master Forward Frame.
Parameters:
addrAddress byte (Short, Group, Broadcast).data_cmdData / Command byte.
Returns:
Raw 16-bit frame integer.
function syn_dali_manchester_decode_byte¶
Decode Manchester bi-phase bit pairs into a byte value.
Parameters:
bit_inInput uint8_t array containing bi-phase pairs.val_out[out] Decoded byte.
Returns:
true on valid Manchester alignment.
function syn_dali_manchester_encode_byte¶
Encode a byte sequence into Manchester bi-phase bits.
Parameters:
valInput byte value.bit_outOutput uint16_t array (minimum 16 elements for bi-phase pairs).
Returns:
Number of bi-phase transitions written.
function syn_dali_slave_init¶
Initialize a DALI Slave Control Gear instance.
Parameters:
slaveSlave state handle.cfgSlave configuration pointer.
Returns:
SYN_OK on success, error code otherwise.
function syn_dali_slave_process¶
Process an incoming DALI Forward Frame on a Slave Control Gear node.
SYN_Status syn_dali_slave_process (
SYN_DALI_SlaveState * slave,
const SYN_DALI_ForwardFrame * req,
uint8_t * resp_data,
bool * has_resp
)
Parameters:
slaveSlave state handle.reqIncoming forward frame request.resp_data[out] 8-bit response payload (if has_resp is set to true).has_resp[out] Set to true if a backward response frame must be transmitted.
Returns:
SYN_OK on success, error code on invalid parameters.
Macro Definition Documentation¶
define SYN_DALI_CMD_ADD_TO_GROUP_BASE¶
define SYN_DALI_CMD_DOWN¶
define SYN_DALI_CMD_ENABLE_DAPC_SEQUENCE¶
define SYN_DALI_CMD_ENABLE_WRITE_MEMORY¶
define SYN_DALI_CMD_GO_TO_SCENE_BASE¶
define SYN_DALI_CMD_OFF¶
define SYN_DALI_CMD_ON_AND_STEP_UP¶
define SYN_DALI_CMD_QUERY_ACTUAL_LEVEL¶
define SYN_DALI_CMD_QUERY_CONTENT_DTR¶
define SYN_DALI_CMD_QUERY_CONTENT_DTR1¶
define SYN_DALI_CMD_QUERY_CONTENT_DTR2¶
define SYN_DALI_CMD_QUERY_CONTROL_GEAR¶
define SYN_DALI_CMD_QUERY_DEVICE_TYPE¶
define SYN_DALI_CMD_QUERY_GROUPS_0_7¶
define SYN_DALI_CMD_QUERY_GROUPS_8_15¶
define SYN_DALI_CMD_QUERY_LAMP_FAILURE¶
define SYN_DALI_CMD_QUERY_LAMP_POWER_ON¶
define SYN_DALI_CMD_QUERY_MAX_LEVEL¶
define SYN_DALI_CMD_QUERY_MIN_LEVEL¶
define SYN_DALI_CMD_QUERY_PHYSICAL_MIN_LEVEL¶
define SYN_DALI_CMD_QUERY_POWER_ON_LEVEL¶
define SYN_DALI_CMD_QUERY_RANDOM_ADDR_H¶
define SYN_DALI_CMD_QUERY_RANDOM_ADDR_L¶
define SYN_DALI_CMD_QUERY_RANDOM_ADDR_M¶
define SYN_DALI_CMD_QUERY_STATUS¶
define SYN_DALI_CMD_QUERY_SYS_FAIL_LEVEL¶
define SYN_DALI_CMD_RECALL_MAX¶
define SYN_DALI_CMD_RECALL_MIN¶
define SYN_DALI_CMD_REMOVE_FROM_GROUP_BASE¶
define SYN_DALI_CMD_REMOVE_FROM_SCENE_BASE¶
define SYN_DALI_CMD_RESET¶
define SYN_DALI_CMD_STEP_DOWN¶
define SYN_DALI_CMD_STEP_DOWN_AND_OFF¶
define SYN_DALI_CMD_STEP_UP¶
define SYN_DALI_CMD_STORE_ACTUAL_LEVEL_IN_DTR¶
define SYN_DALI_CMD_STORE_DTR_AS_FADE_RATE¶
define SYN_DALI_CMD_STORE_DTR_AS_FADE_TIME¶
define SYN_DALI_CMD_STORE_DTR_AS_MAX_LEVEL¶
define SYN_DALI_CMD_STORE_DTR_AS_MIN_LEVEL¶
define SYN_DALI_CMD_STORE_DTR_AS_POWER_ON_LEVEL¶
define SYN_DALI_CMD_STORE_DTR_AS_SCENE_BASE¶
define SYN_DALI_CMD_STORE_DTR_AS_SHORT_ADDR¶
define SYN_DALI_CMD_STORE_DTR_AS_SYS_FAIL_LEVEL¶
define SYN_DALI_CMD_UP¶
define SYN_DALI_MASK_LEVEL¶
MASK level (no change)
define SYN_DALI_SHORT_ADDR_UNASSIGNED¶
Unassigned Short Address
define SYN_DALI_SPEC_COMPARE¶
define SYN_DALI_SPEC_DTR0¶
define SYN_DALI_SPEC_DTR1¶
define SYN_DALI_SPEC_DTR2¶
define SYN_DALI_SPEC_INITIALISE¶
define SYN_DALI_SPEC_PROGRAM_SHORT_ADDR¶
define SYN_DALI_SPEC_QUERY_SHORT_ADDR¶
define SYN_DALI_SPEC_RANDOMISE¶
define SYN_DALI_SPEC_SEARCHADDRH¶
define SYN_DALI_SPEC_SEARCHADDRL¶
define SYN_DALI_SPEC_SEARCHADDRM¶
define SYN_DALI_SPEC_TERMINATE¶
define SYN_DALI_SPEC_VERIFY_SHORT_ADDR¶
define SYN_DALI_SPEC_WITHDRAW¶
The documentation for this class was generated from the following file src/syntropic/proto/syn_dali.h