
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:
- 2020-07-18
- Revision:
- 1:265557f4b6b8
- Parent:
- 0:7d471396cb64
File content as of revision 1:265557f4b6b8:
#include "mbed.h" #include "Regul.h" //#include "rtos.h" void Init_Oregon(void); extern measure_t Sensor[]; DigitalOut led1(LED1); //static BufferedSerial pc(USBTX, USBRX,115200); // tx, rx int main() { measure_t Measure; //pc.baud(115200); DBG("Start"); 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]; 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); } }