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);
ds_init();
modbus_init();
- gpio_clear(GPIOB, GPIO0);
-
#if 0
for (;;) {
debug_led_toggle();
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;
/*
*
* % = 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();