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.
Regul.h
- Committer:
- sev2000
- Date:
- 2019-10-12
- Revision:
- 0:7d471396cb64
File content as of revision 0:7d471396cb64:
#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 * );