Dependencies:   Oregon_Decode

Oregon-Scientific Decoder for V2 and V3 protocol. As exemple it handles THGR122NX (V2) and THGR810 (V3) sensors.

The software use interrupts to collect frames in a buffer and decode them in a background task.

Revision:
0:7d471396cb64
Child:
1:265557f4b6b8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Oct 12 11:55:05 2019 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h" 
+#include "Regul.h"
+
+void Init_Oregon(void);
+extern measure_t Sensor[];
+
+DigitalOut led1(LED1);
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+int main()
+{
+measure_t Measure;
+
+    Init_Oregon();
+   // NVIC_SetPriority(EXTI9_5_IRQn, 0); //set interupt to highest priority 0
+   // NVIC_SetPriority(TIM3_IRQn,1); // set mbed tickers to lower priority than other things
+
+    while (1)
+        { // loop forever
+        led1 = !led1;
+        
+        for (int i=0; i<NB_CHAN; i++)
+            {
+            if (Sensor[i].timestamp !=0)
+                {
+                Measure=Sensor[i];
+                pc.printf("\r\nCh%d : %0.1f%cC  %0.0f%%\r\n", i , Measure.temp1, 0xC2B0, Measure.hum1);
+                Sensor[i].timestamp = 0;
+                }
+            }
+        ThisThread::sleep_for(2000);
+        }
+}
\ No newline at end of file