sds011_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 HAW-Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef SDS011_INTERNAL_H
20 #define SDS011_INTERNAL_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
29 #define SDS011_UART_BAUDRATE (9600U)
30 
35 #define SDS011_FRAME_SEND_LEN (19U)
36 #define SDS011_FRAME_RECV_LEN (10U)
37 
43 #define SDS011_CMD_DB1_SET_DR_MODE (2U)
44 #define SDS011_CMD_DB1_QUERY_DATA (4U)
45 #define SDS011_CMD_DB1_SET_DEV_ID (5U)
46 #define SDS011_CMD_DB1_SET_SLEEP_WORK (6U)
47 #define SDS011_CMD_DB1_CHECK_FIRMWARE (7U)
48 #define SDS011_CMD_DB1_SET_WORK_PERIOD (8U)
49 
55 #define SDS011_CMD_OPT_QUERY (0U)
56 #define SDS011_CMD_OPT_SET (1U)
57 #define SDS011_CMD_OPT_REPORT_ACTIVE (0U)
58 #define SDS011_CMD_OPT_REPORT_QUERY (1U)
59 #define SDS011_CMD_OPT_SLEEP (0U)
60 #define SDS011_CMD_OPT_WORK (1U)
61 
67 #define SDS011_CMDID_QUERY (0xB4)
68 #define SDS011_RCMDID_REPLY (0xC5)
69 #define SDS011_RCMDID_DATA (0xC0)
70 #define SDS011_FRAME_TAIL (0xAB)
71 #define SDS011_FRAME_HEAD (0xAA)
72 #define SDS011_FRAME_CSUM_MSK (0xFF)
73 
79 #define SDS011_FRAME_HEAD_IDX (0U)
80 #define SDS011_CMDID_IDX (1U)
81 #define SDS011_DB1_IDX (2U)
82 #define SDS011_DB2_IDX (3U)
83 #define SDS011_DB3_IDX (4U)
84 #define SDS011_DB4_IDX (5U)
85 #define SDS011_DB5_IDX (6U)
86 #define SDS011_DB6_IDX (7U)
87 #define SDS011_DEVID1_IDX (15U)
88 #define SDS011_DEVID2_IDX (16U)
89 #define SDS011_FRAME_SEND_TAIL_IDX (SDS011_FRAME_SEND_LEN - 1)
90 #define SDS011_FRAME_RECV_TAIL_IDX (SDS011_FRAME_RECV_LEN - 1)
91 #define SDS011_FRAME_SEND_CSUM_IDX (SDS011_FRAME_SEND_LEN - 2)
92 #define SDS011_FRAME_RECV_CSUM_IDX (SDS011_FRAME_RECV_LEN - 2)
93 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif /* SDS011_INTERNAL_H */
100