]> mj.ucw.cz Git - home-hw.git/commitdiff
Aircon: DS magic...
authorMartin Mares <mj@ucw.cz>
Sun, 14 Jul 2019 22:16:09 +0000 (00:16 +0200)
committerMartin Mares <mj@ucw.cz>
Sun, 14 Jul 2019 22:16:09 +0000 (00:16 +0200)
aircon/config.h
aircon/main.c
lib/ds18b20.c

index a73fe503df2d67a25b01b643094898ecca84857e..2a577a342ba7f0d0468f305d7b3affbf3cdeb11b 100644 (file)
@@ -42,4 +42,4 @@
 #define DS_NUM_SENSORS 8
 
 #define DS_DEBUG
-#define DS_DEBUG2
+#undef DS_DEBUG2
index db09ae1a7108134fd397825b7c5b70a63a461d5f..6bb3528ba6a05acc52b30ac286e454d15229ef6c 100644 (file)
@@ -186,6 +186,7 @@ int main(void)
                delay_ms(50);
 
                modbus_loop();
+               ds_step();
        }
 
 #if 0
index 8f6b550e1b7f665ab4f01cd644fba21f3e91df53..30ad08e13eaec5a86d6cbac85a3d9c57e7a9ab5c 100644 (file)
@@ -73,8 +73,16 @@ static bool ds_reset(void)
        // Set timer period to the length of the whole transaction (1 ms)
        timer_set_period(DS_TIMER, 999);
 
+       // XXX: We do not know why this is needed...
+       static bool once;
+       if (!once) {
+               for (int i=0; i<10000; i++) __asm__ volatile ("nop");
+               once = 1;
+       }
+
        // Pull line down and start timer
        cm_disable_interrupts();
+       timer_generate_event(DS_TIMER, TIM_EGR_UG);
        timer_enable_counter(DS_TIMER);
        timer_set_oc_mode(DS_TIMER, TIM_OC2, TIM_OCM_INACTIVE);
        cm_enable_interrupts();