feat: add rust demo
This commit is contained in:
66
examples/tos_meets_rust/BSP/Hardware/PM2D5/pm2d5_parser.h
Normal file
66
examples/tos_meets_rust/BSP/Hardware/PM2D5/pm2d5_parser.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*----------------------------------------------------------------------------
|
||||
* Tencent is pleased to support the open source community by making TencentOS
|
||||
* available.
|
||||
*
|
||||
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
|
||||
* If you have downloaded a copy of the TencentOS binary from Tencent, please
|
||||
* note that the TencentOS binary is licensed under the BSD 3-Clause License.
|
||||
*
|
||||
* If you have downloaded a copy of the TencentOS source code from Tencent,
|
||||
* please note that TencentOS source code is licensed under the BSD 3-Clause
|
||||
* License, except for the third-party components listed below which are
|
||||
* subject to different license terms. Your integration of TencentOS into your
|
||||
* own projects may require compliance with the BSD 3-Clause License, as well
|
||||
* as the other licenses applicable to the third-party components included
|
||||
* within TencentOS.
|
||||
*---------------------------------------------------------------------------*/
|
||||
#ifndef _PM2D5_PARSER_H_
|
||||
#define _PM2D5_PARSER_H_
|
||||
|
||||
#include "tos_k.h"
|
||||
|
||||
/* pm2d5 parser config */
|
||||
#define PM2D5_PARSER_TASK_STACK_SIZE 512
|
||||
#define PM2D5_PARSER_TASK_PRIO 5
|
||||
#define PM2D5_PARSER_BUFFER_SIZE 64
|
||||
|
||||
/* PM2.5 <20><><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD> */
|
||||
typedef struct pm2d5_parser_control_st {
|
||||
k_task_t parser_task; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD>
|
||||
|
||||
k_sem_t parser_rx_sem; //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4>ڽ<EFBFBD><DABD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
k_chr_fifo_t parser_rx_fifo; //<2F><><EFBFBD>Ž<EFBFBD><C5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
} pm2d5_parser_ctrl_t;
|
||||
|
||||
/**
|
||||
* @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>PM2D5<44><35><EFBFBD><EFBFBD>ֵ
|
||||
* @note <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*/
|
||||
typedef struct pm2d5_data_st {
|
||||
uint16_t data1;
|
||||
uint16_t data2;
|
||||
uint16_t data3;
|
||||
uint16_t data4;
|
||||
uint16_t data5;
|
||||
uint16_t data6;
|
||||
uint16_t data7;
|
||||
uint16_t data8;
|
||||
uint16_t data9;
|
||||
uint16_t data10;
|
||||
uint16_t data11;
|
||||
uint16_t data12;
|
||||
uint16_t data13;
|
||||
}pm2d5_data_t;
|
||||
|
||||
typedef union pm2d5_data_un {
|
||||
uint16_t data[13];
|
||||
pm2d5_data_t pm2d5_data;
|
||||
} pm2d5_data_u;
|
||||
|
||||
void pm2d5_parser_input_byte(uint8_t byte);
|
||||
|
||||
int pm2d5_send_read_cmd(void);
|
||||
|
||||
int pm2d5_parser_init(void);
|
||||
|
||||
#endif /* _PM2D5_PARSER_H_ */
|
Reference in New Issue
Block a user