phase.h
Go to the documentation of this file.00001
00040 #ifndef DRV_PHASE_H
00041 #define DRV_PHASE_H
00042
00043 #include "hw/phase_map.h"
00044 #include <cfg/debug.h>
00045
00046 #include <drv/timer.h>
00047
00048 #define TRIAC_MAX_DUTY 100
00049 #define TRIAC_MAX_POWER 100
00050 #define TRIAC_POWER_K TRIAC_MAX_DUTY * (1 / sqrt(2 * TRIAC_MAX_POWER))
00051
00056 typedef uint16_t triac_duty_t;
00057 typedef uint16_t triac_power_t;
00058
00059
00060
00061 DB(extern bool phase_initialized;)
00062
00067 typedef struct Triac
00068 {
00069 Timer timer;
00070 triac_duty_t duty;
00071 bool running;
00072 } Triac;
00073
00074
00075 void phase_setDutyUnlock(TriacDev dev, triac_duty_t duty);
00076 void phase_setDuty(TriacDev dev, triac_duty_t duty);
00077 void phase_setPower(TriacDev dev, triac_power_t power);
00078
00079 void phase_init(void);
00080
00081
00082 #endif