5 Stack API

The input and output of the stack act through functions defined in dali_hal.h.
  • dali_hal_enable_forward_disable_backward( )

    This function is used after the DALI slave has finished sending a backward frame. This will re-enable the DALI external input detection and disable the DALI detection timer. The detection timer will be enabled when the DALI Start bit is detected.

  • dali_hal_disable_forward_enable_backward( )

    This function is used before the DALI slave starts to send a backward frame. This will disable DALI input detection and enable the slave sending timer. It is necessary to disable the input detection because the backward frame signal can route back to the DALI input.

  • dali_hal_get_dali_input_level( )

    This function detects the DALI interface input voltage level used to check the interface failure state.

  • dali_hal_update_pwm_output( )

    This function is used to update the PWM output for LED light dimming.

  • dali_hal_get_seed0_value( ), dali_hal_get_seed1_value( )

    These two functions generate random address seeds for auto-address allocation. Two different clock sources are used to get a 32-bit random value.

  • dali_hal_save_persistent_variables( )

    This function is called when the “SAVE PERSISTENT VARIABLES” command is executed. It should update variables in the EEPROM immediately.

  • dali_hal_identify_device ( )

    This function executes the identification by flashing, sound, or other visual or audible means after receiving the “IDENTIFY DEVICE” command.

When the stack variables need executing outside, the below functions offer channels for outside functions to get or set them. These functions are listed in file dali_top.h.

/**
 *  \brief Set the DALI bytes (address and data) to stack after DALI frame decoding.
 */
void dali_set_addr_to_stack(uint8_t address);
void dali_set_data_to_stack(uint8_t data);

/**
 *  \brief Set the DALI bytes received flag to stack after decoding.
 */
void dali_set_received_flag_to_stack(bool flag);

/**
 *  \brief Set current DALI byte sent status to stack when encoding.
 */
void dali_set_sent_status_to_stack(uint8_t status);

/**
 *  \brief Get the DALI byte sent status from stack to start encoding.
 */
uint8_t dali_get_sent_status_from_stack(void);

/**
 *  \brief Get the DALI sent byte from stack when encoding.
 */
uint8_t dali_get_sent_data_from_stack(void);

/**
 *  \brief Get the EEPROM update flag address from stack.
 */
uint8_t *dali_get_update_flag_addr_from_stack(void);

/**
 *  \brief Get the data address and size from stack for EEPROM write.
 */
uint8_t *dali_get_data_addr_from_stack(void);
uint8_t dali_get_data_size_from_stack(void);


/**
 *  \brief Set the control gear failure status to stack.
 */
void dali_set_gear_failure_status_to_stack(bool failure_status);

/**
 *  \brief Set the lamp failure status to stack.
 */
void dali_set_lamp_failure_status_to_stack(bool failure_status);

The above two functions should be implemented in the application layer according to the dedicated detection methods by the designer.