phase.h

Go to the documentation of this file.
00001 
00045 #ifndef DRV_PHASE_H
00046 #define DRV_PHASE_H
00047 
00048 #include "hw/phase_map.h"
00049 
00050 #include "cfg/cfg_phase.h"
00051 
00052 #include <drv/timer.h>
00053 
00054 #define TRIAC_POWER_K   CONFIG_TRIAC_MAX_DUTY * (1 / sqrt(2 * CONFIG_TRIAC_MAX_POWER))
00055 
00060 typedef uint16_t triac_duty_t;
00061 typedef uint16_t triac_power_t;
00062 /* \} */
00063 
00064 
00065 DB(extern bool phase_initialized;)
00066 
00071 typedef struct Triac
00072 {
00073     Timer  timer;      
00074     triac_duty_t duty; 
00075     bool   running;    
00076 } Triac;
00077 /* \} */
00078 
00079 void phase_setDutyUnlock(TriacDev dev, triac_duty_t duty);
00080 void phase_setDuty(TriacDev dev, triac_duty_t duty);
00081 void phase_setPower(TriacDev dev, triac_power_t power);
00082 
00083 void phase_init(void);
00084 
00085 
00086 #endif /* DRV_PHASE_H */