/** * \file * * * * \brief Phase partialization driver with TRIACs. * * \author Francesco Sacchi * * $WIZ$ module_name = "phase" * $WIZ$ module_depends = "timer" * $WIZ$ module_configuration = "bertos/cfg/cfg_phase.h" * $WIZ$ module_hw = "bertos/hw/hw_phase.h", "bertos/hw/phase_map.h", "bertos/hw/hw_phase.c" */ #ifndef DRV_PHASE_H #define DRV_PHASE_H #include "hw/phase_map.h" #include "cfg/cfg_phase.h" #include #define TRIAC_POWER_K CONFIG_TRIAC_MAX_DUTY * (1 / sqrt(2 * CONFIG_TRIAC_MAX_POWER)) /** * \name Types for duty and power. * \{ */ typedef uint16_t triac_duty_t; typedef uint16_t triac_power_t; /* \} */ DB(extern bool phase_initialized;) /** * \name Type for triac control. * \{ */ typedef struct Triac { Timer timer; /**< Timer for phase control. */ triac_duty_t duty; /**< Duty cycle of the channel. */ bool running; /**< True when the timer is active. */ } Triac; /* \} */ void phase_setDutyUnlock(TriacDev dev, triac_duty_t duty); void phase_setDuty(TriacDev dev, triac_duty_t duty); void phase_setPower(TriacDev dev, triac_power_t power); void phase_init(void); #endif /* DRV_PHASE_H */