phase.h
Go to the documentation of this file.00001
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
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