Oregon Scientific Decoder V2 and V3 for Nucleo-F401RE
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.
main.cpp
- Committer:
- sev2000
- Date:
- 2019-10-12
- Revision:
- 0:7d471396cb64
- Child:
- 1:265557f4b6b8
File content as of revision 0:7d471396cb64:
#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); } }