// TIM4 will run on CPU clock, it will overflow with frequency 38 kHz (IR modulation frequency)
#define T4_CYCLE ((CPU_CLOCK_MHZ * 1000000 + 37999) / 38000)
-#if 0
+// FIXME
+static byte bypass_active;
+static byte pwm;
+
static void show_temperature(void)
{
debug_putc('#');
debug_printf(" %d", pwm);
debug_puts("\r\n");
}
-#endif
static void pwm_init(void)
{
ds_init();
modbus_init();
+ gpio_clear(GPIOB, GPIO0);
+
+#if 0
for (;;) {
debug_led_toggle();
- gpio_clear(GPIOB, GPIO0);
- delay_ms(50);
- gpio_set(GPIOB, GPIO0);
- delay_ms(50);
+ //gpio_clear(GPIOB, GPIO0);
+ //delay_ms(50);
+ //gpio_set(GPIOB, GPIO0);
+ delay_ms(100);
modbus_loop();
ds_step();
}
+#endif
-#if 0
+#if 1
byte cycles = 0;
for (;;) {
- gpio_toggle(GPIOC, GPIO13);
+ 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') {
timer_set_oc_value(TIM4, TIM_OC1, pwm);
}
}
+#endif
if (cycles++ >= 50) {
cycles = 0;
show_temperature();