Oregegon scientific decoder V2.1 and V3
Dependents: Oregon_Decoder_V2_V3
Oregon decoding Library.
It manages protocoles V2.1 and V3.
To be used with RTOS OS2 or MBED V5
Diff: OregonBit.cpp
- Revision:
- 7:47fb36f30355
- Parent:
- 6:9861110c120c
- Child:
- 8:48315bba3adc
--- a/OregonBit.cpp Sat Feb 08 10:09:38 2020 +0000 +++ b/OregonBit.cpp Sat Apr 25 10:12:44 2020 +0000 @@ -8,7 +8,15 @@ bool pin; }pulse_t; -int onShortLo = 201; +int onShortLo = 200; +int onShortHi = 700; +int offShortLo = 200; +int offShortHi = 700; +int onLongLo = 700; +int onLongHi = 1200; +int offLongLo = 700; +int offLongHi = 1200; +/*int onShortLo = 201; int onShortHi = 615; int offShortLo = 400; int offShortHi = 850; @@ -16,12 +24,13 @@ int onLongHi = 1100; int offLongLo = 850; int offLongHi = 1400; +*/ long O_startedAt; long O_endedAt; bool O_dataBits[145]={0}; // 18 Nibbles +1 -Thread O_thread; +Thread O_thread(osPriorityBelowNormal); Timer O_xTime; InterruptIn dataPin(PB_8); @@ -65,7 +74,9 @@ while(true) { i=0; - while(!O_PulseWidth.empty() && i<100) + if(O_PulseWidth.empty()) //If no pulse received since 100 ms, we are no more in the frame + state=0; + while(!O_PulseWidth.empty() && i<200) { O_PulseWidth.pop(pulse); //pc.printf("%d,", pulse.v); @@ -292,6 +303,7 @@ } void RF_Active() { + O_DBG("RF Active"); O_xTime.reset(); O_startedAt= 0; dataPin.enable_irq(); @@ -300,6 +312,7 @@ void RF_StdBy() { + O_DBG("RF Standby"); StbyPin = 0; dataPin.disable_irq(); O_PulseWidth.reset(); //clear Circular Buffer