From: Martin Mares Date: Tue, 16 Jul 2019 16:08:50 +0000 (+0200) Subject: Aircon: Simulating the old interface from test-opencm3 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a97888f27be3afdaa39cfbdf5916fbd66a02a683;p=home-hw.git Aircon: Simulating the old interface from test-opencm3 --- diff --git a/aircon/main.c b/aircon/main.c index 13f23a2..12d2345 100644 --- a/aircon/main.c +++ b/aircon/main.c @@ -151,15 +151,15 @@ static void pwm_init(void) timer_set_period(TIM4, T4_CYCLE - 1); // 50% PWM for the IR LED - //timer_set_oc_mode(TIM4, TIM_OC2, TIM_OCM_FORCE_HIGH); // will be TIM_OCM_PWM1 when transmitting - timer_set_oc_mode(TIM4, TIM_OC2, TIM_OCM_PWM1); // FIXME + timer_set_oc_mode(TIM4, TIM_OC2, TIM_OCM_FORCE_HIGH); // will be TIM_OCM_PWM1 when transmitting + // timer_set_oc_mode(TIM4, TIM_OC2, TIM_OCM_PWM1); // FIXME timer_set_oc_value(TIM4, TIM_OC2, T4_CYCLE / 2); timer_set_oc_polarity_high(TIM4, TIM_OC2); timer_enable_oc_output(TIM4, TIM_OC2); // PWM for controlling fan timer_set_oc_mode(TIM4, TIM_OC1, TIM_OCM_PWM1); - timer_set_oc_value(TIM4, TIM_OC1, T4_CYCLE * 20 / 256); + timer_set_oc_value(TIM4, TIM_OC1, 0); timer_set_oc_polarity_high(TIM4, TIM_OC1); timer_enable_oc_output(TIM4, TIM_OC1); @@ -179,8 +179,6 @@ int main(void) ds_init(); modbus_init(); - gpio_clear(GPIOB, GPIO0); - #if 0 for (;;) { debug_led_toggle(); @@ -201,17 +199,16 @@ int main(void) debug_led_toggle(); delay_ms(100); ds_step(); -#if 0 if (usart_get_flag(USART1, USART_SR_RXNE)) { uint ch = usart_recv(USART1); if (ch == 'B') { bypass_active = 1; gpio_set(GPIOC, GPIO15); // opto-coupler - gpio_clear(GPIOC, GPIO14); // LED + gpio_clear(GPIOB, GPIO0); // LED } else if (ch == 'b') { bypass_active = 0; gpio_clear(GPIOC, GPIO15); // opto-coupler - gpio_set(GPIOC, GPIO14); // LED + gpio_set(GPIOB, GPIO0); // LED } else if (ch >= '0' && ch <= '9') { pwm = 3*(ch - '0') + 1; /* @@ -229,10 +226,9 @@ int main(void) * * % = pwm*4.389 - 12.723 */ - timer_set_oc_value(TIM4, TIM_OC1, pwm); + timer_set_oc_value(TIM4, TIM_OC1, T4_CYCLE * pwm / 256); } } -#endif if (cycles++ >= 50) { cycles = 0; show_temperature();