
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.
Diff: Regul.h
- Revision:
- 0:7d471396cb64
diff -r 000000000000 -r 7d471396cb64 Regul.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Regul.h Sat Oct 12 11:55:05 2019 +0000 @@ -0,0 +1,45 @@ +#include "mbed.h" + +extern Serial pc; + +//#define __DEBUG__ +#define Level 1 +#define DBG(x, ...) if (Level>=3) pc.printf("[DBG]"x"\r\n", ##__VA_ARGS__); +#define WARN(x, ...) if (Level>=2) pc.printf("[WARN]"x"\r\n", ##__VA_ARGS__); +#define ERR(x, ...) if (Level>=1) pc.printf("[ERR]"x"\r\n", ##__VA_ARGS__); + +#define BUF_SIZE 1024 + +#define DEVICE_ID 1 +#define FA + +#define NB_CHAN 3 + +typedef struct { + char deviceID; + unsigned long timestamp; + float hum1; + float temp1; + float hum2; + float temp2; + unsigned char pwm; + int speed; +}measure_t; + +typedef struct { + int first; + int prev; + int last; + measure_t data[BUF_SIZE]; +}s_meas_t; + +typedef struct { + int v; + bool update; +}pwm_t; + +int Init_Regul(); +int Mesurement(measure_t *); +int RegulPWM(measure_t *, pwm_t *); +//int SendRcvData(NetworkStack *, s_meas_t *, pwm_t *); +//int SendLoger(NetworkStack *, const char * );