Skip to content

File syn_dali.c

FileList > proto > syn_dali.c

Go to the source code of this file

Digital Addressable Lighting Interface (DALI / IEC 62386) Protocol Stack implementation.

  • #include "../util/syn_assert.h"
  • #include "syn_dali.h"
  • #include <string.h>

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.

Public Static Functions

Type Name
bool check_address_match (const SYN_DALI_SlaveState * slave, const SYN_DALI_ForwardFrame * req)

Public Functions Documentation

function syn_dali_decode_backward

Decode an 8-bit Slave Backward Frame.

bool syn_dali_decode_backward (
    uint8_t raw_8,
    SYN_DALI_BackwardFrame * frame
) 

Parameters:

  • raw_8 Raw 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.

bool syn_dali_decode_forward (
    uint16_t raw_16,
    SYN_DALI_ForwardFrame * frame
) 

Parameters:

  • raw_16 Raw 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.

uint8_t syn_dali_encode_backward (
    uint8_t data
) 

Parameters:

  • data 8-bit response payload.

Returns:

Raw 8-bit frame integer.


function syn_dali_encode_forward

Encode a 16-bit Master Forward Frame.

uint16_t syn_dali_encode_forward (
    uint8_t addr,
    uint8_t data_cmd
) 

Parameters:

  • addr Address byte (Short, Group, Broadcast).
  • data_cmd Data / Command byte.

Returns:

Raw 16-bit frame integer.


function syn_dali_manchester_decode_byte

Decode Manchester bi-phase bit pairs into a byte value.

bool syn_dali_manchester_decode_byte (
    const uint8_t * bit_in,
    uint8_t * val_out
) 

Parameters:

  • bit_in Input 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.

size_t syn_dali_manchester_encode_byte (
    uint8_t val,
    uint8_t * bit_out
) 

Parameters:

  • val Input byte value.
  • bit_out Output 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.

SYN_Status syn_dali_slave_init (
    SYN_DALI_SlaveState * slave,
    const SYN_DALI_SlaveConfig * cfg
) 

Parameters:

  • slave Slave state handle.
  • cfg Slave 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:

  • slave Slave state handle.
  • req Incoming 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.


Public Static Functions Documentation

function check_address_match

static bool check_address_match (
    const SYN_DALI_SlaveState * slave,
    const SYN_DALI_ForwardFrame * req
) 


The documentation for this class was generated from the following file src/syntropic/proto/syn_dali.c