phase.h

Go to the documentation of this file.
00001 
00040 /*#*
00041  *#* $Log$
00042  *#* Revision 1.2  2006/07/19 12:56:26  bernie
00043  *#* Convert to new Doxygen style.
00044  *#*
00045  *#* Revision 1.1  2005/11/04 18:06:44  bernie
00046  *#* Import into DevLib.
00047  *#*
00048  *#* Revision 1.1  2005/05/24 09:17:58  batt
00049  *#* Move drivers to top-level.
00050  *#*
00051  *#* Revision 1.9  2005/05/09 16:34:14  batt
00052  *#* Change some function names to accomplish coding standard; Add debug phase_initialized; Change duty_t and power_t to uint16_t.
00053  *#*
00054  *#* Revision 1.8  2005/05/02 12:37:33  batt
00055  *#* Split hw triac map in phase_map.h.
00056  *#*
00057  *#* Revision 1.7  2005/05/02 09:05:03  batt
00058  *#* Rename duty_t and power_t in triac_duty_t and triac_power_t
00059  *#*
00060  *#* Revision 1.6  2005/04/28 15:10:11  batt
00061  *#* Use timer API to add and set events.
00062  *#*
00063  *#* Revision 1.5  2005/04/28 12:04:46  batt
00064  *#* Add some comments.
00065  *#*
00066  *#* Revision 1.4  2005/04/28 10:35:45  batt
00067  *#* Complete phase_setpower.
00068  *#*
00069  *#* Revision 1.3  2005/04/27 19:23:40  batt
00070  *#* Reformat.
00071  *#*
00072  *#* Revision 1.1  2005/04/27 17:13:56  batt
00073  *#* Add triac phase control driver.
00074  *#*
00075  *#*/
00076 
00077 
00078 #ifndef DRV_PHASE_H
00079 #define DRV_PHASE_H
00080 
00081 #include <drv/timer.h>
00082 #include <phase_map.h>
00083 #include <cfg/debug.h>
00084 
00085 #define TRIAC_MAX_DUTY  100
00086 #define TRIAC_MAX_POWER 100
00087 #define TRIAC_POWER_K   TRIAC_MAX_DUTY * (1 / sqrt(2 * TRIAC_MAX_POWER))
00088 
00093 typedef uint16_t triac_duty_t;
00094 typedef uint16_t triac_power_t;
00095 /* \} */
00096 
00097 
00098 DB(extern bool phase_initialized;)
00099 
00104 typedef struct Triac
00105 {
00106     Timer  timer;      
00107     triac_duty_t duty; 
00108     bool   running;    
00109 } Triac;
00110 /* \} */
00111 
00112 void phase_setDutyUnlock(TriacDev dev, triac_duty_t duty);
00113 void phase_setDuty(TriacDev dev, triac_duty_t duty);
00114 void phase_setPower(TriacDev dev, triac_power_t power);
00115 
00116 void phase_init(void);
00117 
00118 
00119 #endif /* DRV_PHASE_H */