MeterLogger
Functions
ac_out.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ICACHE_FLASH_ATTR void ac_out_init ()
 
ICACHE_FLASH_ATTR void ac_test ()
 
ICACHE_FLASH_ATTR void ac_motor_valve_open ()
 
ICACHE_FLASH_ATTR void ac_motor_valve_close ()
 
ICACHE_FLASH_ATTR void ac_thermo_open ()
 
ICACHE_FLASH_ATTR void ac_thermo_close ()
 
ICACHE_FLASH_ATTR void ac_thermo_pwm (unsigned int pwm)
 
ICACHE_FLASH_ATTR void ac_off ()
 

Function Documentation

◆ ac_motor_valve_close()

ICACHE_FLASH_ATTR void ac_motor_valve_close ( )

Definition at line 154 of file ac_out.c.

References ac_off(), ac_out_off_timer, ac_out_off_timer_func(), ICACHE_FLASH_ATTR, led_pattern_b(), NULL, os_printf, os_timer_arm, os_timer_disarm, os_timer_func_t, and os_timer_setfn.

154  {
155 #ifdef DEBUG
156  os_printf("\n\rac 2 on\n\r");
157 #endif
158  ac_off();
159 #ifdef LED_ON_AC
160  led_pattern_b();
161 #endif
162 
163  //Set GPI15 to HIGH
164 // gpio_output_set(BIT15, 0, BIT15, 0);
165 
166  // wait 60 seconds and turn ac output off
169  os_timer_arm(&ac_out_off_timer, 60000, 0);
170 }
ICACHE_FLASH_ATTR void led_pattern_b(void)
Definition: led.c:113
#define os_timer_disarm
Definition: osapi.h:51
static os_timer_t ac_out_off_timer
Definition: ac_out.c:8
#define NULL
Definition: def.h:47
#define os_timer_func_t
Definition: os_type.h:35
ICACHE_FLASH_ATTR void ac_off()
Definition: ac_out.c:247
#define os_printf
Definition: osapi.h:62
#define os_timer_setfn
Definition: osapi.h:52
ICACHE_FLASH_ATTR static void ac_out_off_timer_func(void *arg)
Definition: ac_out.c:53
#define os_timer_arm(a, b, c)
Definition: osapi.h:50
Here is the call graph for this function:

◆ ac_motor_valve_open()

ICACHE_FLASH_ATTR void ac_motor_valve_open ( )

Definition at line 135 of file ac_out.c.

References ac_off(), ac_out_off_timer, ac_out_off_timer_func(), BIT14, gpio_output_set(), ICACHE_FLASH_ATTR, led_pattern_a(), NULL, os_printf, os_timer_arm, os_timer_disarm, os_timer_func_t, and os_timer_setfn.

135  {
136 #ifdef DEBUG
137  os_printf("\n\rac 1 on\n\r");
138 #endif
139  ac_off();
140 #ifdef LED_ON_AC
141  led_pattern_a();
142 #endif
143 
144  //Set GPI14 to HIGH
145  gpio_output_set(BIT14, 0, BIT14, 0);
146 
147  // wait 60 seconds and turn ac output off
150  os_timer_arm(&ac_out_off_timer, 60000, 0);
151 }
#define os_timer_disarm
Definition: osapi.h:51
static os_timer_t ac_out_off_timer
Definition: ac_out.c:8
#define NULL
Definition: def.h:47
#define os_timer_func_t
Definition: os_type.h:35
ICACHE_FLASH_ATTR void ac_off()
Definition: ac_out.c:247
#define os_printf
Definition: osapi.h:62
#define os_timer_setfn
Definition: osapi.h:52
#define BIT14
Definition: eagle_soc.h:46
ICACHE_FLASH_ATTR static void ac_out_off_timer_func(void *arg)
Definition: ac_out.c:53
#define os_timer_arm(a, b, c)
Definition: osapi.h:50
void gpio_output_set(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
ICACHE_FLASH_ATTR void led_pattern_a(void)
Definition: led.c:106
Here is the call graph for this function:

◆ ac_off()

ICACHE_FLASH_ATTR void ac_off ( )

Definition at line 247 of file ac_out.c.

References ac_out_off_timer, ac_out_off_timer_func(), ac_test_timer, NULL, os_timer_arm, os_timer_disarm, os_timer_func_t, and os_timer_setfn.

Referenced by ac_motor_valve_close(), ac_motor_valve_open(), and minute_timer_func().

247  {
248  // turn ac output off
253 }
#define os_timer_disarm
Definition: osapi.h:51
static os_timer_t ac_out_off_timer
Definition: ac_out.c:8
#define NULL
Definition: def.h:47
#define os_timer_func_t
Definition: os_type.h:35
#define os_timer_setfn
Definition: osapi.h:52
ICACHE_FLASH_ATTR static void ac_out_off_timer_func(void *arg)
Definition: ac_out.c:53
#define os_timer_arm(a, b, c)
Definition: osapi.h:50
static os_timer_t ac_test_timer
Definition: ac_out.c:7
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ac_out_init()

ICACHE_FLASH_ATTR void ac_out_init ( )

Definition at line 17 of file ac_out.c.

References FUNC_GPIO14, FUNC_GPIO15, ICACHE_FLASH_ATTR, PERIPHS_IO_MUX_MTDO_U, PERIPHS_IO_MUX_MTMS_U, and PIN_FUNC_SELECT.

17  {
18  //Set GPIO14 and GPIO15 to output mode
20 #ifdef THERMO_ON_AC_2
22 #endif
23 }
#define PIN_FUNC_SELECT(PIN_NAME, FUNC)
Definition: eagle_soc.h:270
#define FUNC_GPIO15
Definition: eagle_soc.h:226
#define FUNC_GPIO14
Definition: eagle_soc.h:224
#define PERIPHS_IO_MUX_MTDO_U
Definition: eagle_soc.h:225
#define PERIPHS_IO_MUX_MTMS_U
Definition: eagle_soc.h:223

◆ ac_test()

ICACHE_FLASH_ATTR void ac_test ( )

Definition at line 115 of file ac_out.c.

References ac_test_timer, ac_test_timer_func(), BIT14, BIT15, gpio_output_set(), ICACHE_FLASH_ATTR, led_pattern_a(), NULL, os_printf, os_timer_arm, os_timer_disarm, os_timer_func_t, and os_timer_setfn.

Referenced by minute_timer_func().

115  {
116 #ifdef DEBUG
117  os_printf("\n\rac test on\n\r");
118 #endif
119 #ifdef LED_ON_AC
120  led_pattern_a();
121 #endif
122 
123  // set GPIO14 high and GPIO15 low
124  gpio_output_set(BIT14, 0, BIT14, 0);
125 #ifdef THERMO_ON_AC_2
126  gpio_output_set(0, BIT15, BIT15, 0);
127 #endif
128 
131  os_timer_arm(&ac_test_timer, 120000, 1);
132 }
#define os_timer_disarm
Definition: osapi.h:51
#define NULL
Definition: def.h:47
#define os_timer_func_t
Definition: os_type.h:35
#define BIT15
Definition: eagle_soc.h:45
#define os_printf
Definition: osapi.h:62
#define os_timer_setfn
Definition: osapi.h:52
#define BIT14
Definition: eagle_soc.h:46
#define os_timer_arm(a, b, c)
Definition: osapi.h:50
void gpio_output_set(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
ICACHE_FLASH_ATTR void led_pattern_a(void)
Definition: led.c:106
static os_timer_t ac_test_timer
Definition: ac_out.c:7
ICACHE_FLASH_ATTR static void ac_test_timer_func(void *arg)
Definition: ac_out.c:26
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ac_thermo_close()

ICACHE_FLASH_ATTR void ac_thermo_close ( )

Definition at line 203 of file ac_out.c.

References syscfg_t::ac_thermo_state, BIT14, BIT15, cfg_save_defered(), gpio_output_set(), ICACHE_FLASH_ATTR, led_pattern_a(), os_printf, and sys_cfg.

Referenced by minute_timer_func().

203  {
204 #ifdef DEBUG
205  os_printf("\n\rac 1 close\n\r");
206 #endif
207 #ifdef LED_ON_AC
208  led_pattern_a();
209 #endif
210 
211 #ifdef THERMO_NO
212  //Set GPI14 to HIGHT
213  gpio_output_set(BIT14, 0, BIT14, 0);
214 #ifdef THERMO_ON_AC_2
215  //Set GPI15 to HIGH
216  gpio_output_set(BIT15, 0, BIT15, 0);
217 #endif
218 #else // THERMO_NC
219  //Set GPI14 to LOW
220  gpio_output_set(0, BIT14, BIT14, 0);
221 #ifdef THERMO_ON_AC_2
222  //Set GPI15 to LOW
223  gpio_output_set(0, BIT15, BIT15, 0);
224 #endif
225 #endif
226  if (sys_cfg.ac_thermo_state) { // only save if state changed
229  }
230 }
#define BIT15
Definition: eagle_soc.h:45
#define os_printf
Definition: osapi.h:62
void ICACHE_FLASH_ATTR cfg_save_defered()
Definition: config.c:144
#define BIT14
Definition: eagle_soc.h:46
void gpio_output_set(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
ICACHE_FLASH_ATTR void led_pattern_a(void)
Definition: led.c:106
uint8_t ac_thermo_state
Definition: config.h:61
syscfg_t sys_cfg
Definition: config.c:12
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ac_thermo_open()

ICACHE_FLASH_ATTR void ac_thermo_open ( )

Definition at line 173 of file ac_out.c.

References syscfg_t::ac_thermo_state, BIT14, BIT15, cfg_save_defered(), gpio_output_set(), ICACHE_FLASH_ATTR, led_pattern_b(), os_printf, and sys_cfg.

Referenced by minute_timer_func().

173  {
174 #ifdef DEBUG
175  os_printf("\n\rac 1 open\n\r");
176 #endif
177 #ifdef LED_ON_AC
178  led_pattern_b();
179 #endif
180 
181 #ifdef THERMO_NO
182  //Set GPI14 to LOW
183  gpio_output_set(0, BIT14, BIT14, 0);
184 #ifdef THERMO_ON_AC_2
185  //Set GPI15 to LOW
186  gpio_output_set(0, BIT15, BIT15, 0);
187 #endif
188 #else // THERMO_NC
189  //Set GPI14 to HIGH
190  gpio_output_set(BIT14, 0, BIT14, 0);
191 #ifdef THERMO_ON_AC_2
192  //Set GPI15 to HIGH
193  gpio_output_set(BIT15, 0, BIT15, 0);
194 #endif
195 #endif
196  if (!sys_cfg.ac_thermo_state) { // only save if state changed
199  }
200 }
ICACHE_FLASH_ATTR void led_pattern_b(void)
Definition: led.c:113
#define BIT15
Definition: eagle_soc.h:45
#define os_printf
Definition: osapi.h:62
void ICACHE_FLASH_ATTR cfg_save_defered()
Definition: config.c:144
#define BIT14
Definition: eagle_soc.h:46
void gpio_output_set(uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask)
uint8_t ac_thermo_state
Definition: config.h:61
syscfg_t sys_cfg
Definition: config.c:12
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ac_thermo_pwm()

ICACHE_FLASH_ATTR void ac_thermo_pwm ( unsigned int  pwm)

Definition at line 233 of file ac_out.c.

References ac_pwm_duty_cycle, ac_pwm_timer, ac_pwm_timer_func(), ICACHE_FLASH_ATTR, led_stop_pattern(), NULL, os_printf, os_timer_arm, os_timer_disarm, os_timer_func_t, and os_timer_setfn.

233  {
234 #ifdef DEBUG
235  os_printf("\n\rac 1 pwm\n\r");
236 #endif
237 #ifdef LED_ON_AC
239 #endif
240  ac_pwm_duty_cycle = duty_cycle;
243  os_timer_arm(&ac_pwm_timer, 0, 0); // fire now once, ac_pwm_timer start itself
244 }
#define os_timer_disarm
Definition: osapi.h:51
#define NULL
Definition: def.h:47
static os_timer_t ac_pwm_timer
Definition: ac_out.c:9
#define os_timer_func_t
Definition: os_type.h:35
#define os_printf
Definition: osapi.h:62
#define os_timer_setfn
Definition: osapi.h:52
ICACHE_FLASH_ATTR static void ac_pwm_timer_func(void *arg)
Definition: ac_out.c:72
#define os_timer_arm(a, b, c)
Definition: osapi.h:50
unsigned int ac_pwm_duty_cycle
Definition: ac_out.c:11
ICACHE_FLASH_ATTR void led_stop_pattern(void)
Definition: led.c:128
Here is the call graph for this function: