4 * Copyright 2005 Develer S.r.l. (http://www.develer.com/)
9 * \brief Phase control driver (interface)
12 * \author Francesco Sacchi <batt@develer.com>
17 *#* Revision 1.1 2005/11/04 18:06:44 bernie
18 *#* Import into DevLib.
20 *#* Revision 1.1 2005/05/24 09:17:58 batt
21 *#* Move drivers to top-level.
23 *#* Revision 1.9 2005/05/09 16:34:14 batt
24 *#* Change some function names to accomplish coding standard; Add debug phase_initialized; Change duty_t and power_t to uint16_t.
26 *#* Revision 1.8 2005/05/02 12:37:33 batt
27 *#* Split hw triac map in phase_map.h.
29 *#* Revision 1.7 2005/05/02 09:05:03 batt
30 *#* Rename duty_t and power_t in triac_duty_t and triac_power_t
32 *#* Revision 1.6 2005/04/28 15:10:11 batt
33 *#* Use timer API to add and set events.
35 *#* Revision 1.5 2005/04/28 12:04:46 batt
36 *#* Add some comments.
38 *#* Revision 1.4 2005/04/28 10:35:45 batt
39 *#* Complete phase_setpower.
41 *#* Revision 1.3 2005/04/27 19:23:40 batt
44 *#* Revision 1.1 2005/04/27 17:13:56 batt
45 *#* Add triac phase control driver.
53 #include <drv/timer.h>
54 #include <phase_map.h>
55 #include <cfg/debug.h>
57 #define TRIAC_MAX_DUTY 100
58 #define TRIAC_MAX_POWER 100
59 #define TRIAC_POWER_K TRIAC_MAX_DUTY * (1 / sqrt(2 * TRIAC_MAX_POWER))
62 * \name Types for duty and power.
65 typedef uint16_t triac_duty_t;
66 typedef uint16_t triac_power_t;
70 DB(extern bool phase_initialized;)
73 * \name Type for triac control.
78 Timer timer; /*!< Timer for phase control. */
79 triac_duty_t duty; /*!< Duty cycle of the channel. */
80 bool running; /*!< True when the timer is active. */
84 void phase_setDutyUnlock(TriacDev dev, triac_duty_t duty);
85 void phase_setDuty(TriacDev dev, triac_duty_t duty);
86 void phase_setPower(TriacDev dev, triac_power_t power);
88 void phase_init(void);
91 #endif /* DRV_PHASE_H */