-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathairmon_pms.h
37 lines (30 loc) · 1.19 KB
/
airmon_pms.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include <furi_hal.h>
#define RX_BUF_SIZE 64
typedef struct {
uint16_t pm1_0cf; // PM1.0 ug/m3 (ultrafine particles)
uint16_t pm2_5cf; // PM2.5 ug/m3 (combustion particles, organic compounds, metals)
uint16_t pm10cf; // PM10 ug/m3 (dust, pollen, mould spores)
uint16_t pm1_0at; // PM1.0 ug/m3 (atmos env)
uint16_t pm2_5at; // PM2.5 ug/m3 (atmos env)
uint16_t pm10at; // PM10 ug/m3 (atmos env)
uint16_t ct0_3; // count of >0.3um in 0.1L air
uint16_t ct0_5; // count of >0.5um in 0.1L air
uint16_t ct1_0; // count of >1.0um in 0.1L air
uint16_t ct2_5; // count of >2.5um in 0.1L air
uint16_t ct5_0; // count of >5.0um in 0.1L air
uint16_t ct10; // count of >10um in 0.1L air
} AirmonPmsData;
typedef struct {
FuriMutex* mutex;
FuriThread* thread;
FuriStreamBuffer* rx_stream;
FuriHalSerialHandle* serial;
uint8_t rx_buf[RX_BUF_SIZE];
uint32_t pms_data_timestamp;
AirmonPmsData pms_data;
} AirmonPmsContext;
AirmonPmsContext* airmon_pms_context_alloc();
void airmon_pms_context_free(AirmonPmsContext* pms_context);
void airmon_pms_init(AirmonPmsContext* pms_context);
void airmon_pms_deinit(AirmonPmsContext* pms_context);