Difference between revisions of "MCU/SensorBox"
From ESS-WIKI
| Line 105: | Line 105: | ||
Content. | Content. | ||
| − | < | + | <syntaxhighlight lang="C" style="width:80%; border:1px solid lightgrey; "> |
int SBox_iInit(void); | int SBox_iInit(void); | ||
| − | </ | + | </syntaxhighlight> |
*Brief | *Brief | ||
:Initialize sensor box | :Initialize sensor box | ||
| Line 117: | Line 117: | ||
<br/> | <br/> | ||
| − | < | + | <syntaxhighlight lang="C" style="width:80%; border:1px solid lightgrey; "> |
int SBox_iUnInit(void); | int SBox_iUnInit(void); | ||
| − | </ | + | </syntaxhighlight> |
*Brief | *Brief | ||
:Uninitialize sensor box | :Uninitialize sensor box | ||
| Line 129: | Line 129: | ||
<br/> | <br/> | ||
| − | < | + | <syntaxhighlight lang="C" style="width:80%; border:1px solid lightgrey; "> |
int SBox_iGetAllData(TSBDataFmt *_ptDataSet); | int SBox_iGetAllData(TSBDataFmt *_ptDataSet); | ||
| − | </ | + | </syntaxhighlight> |
*Brief | *Brief | ||
:Update all sensors and get all data of sensors | :Update all sensors and get all data of sensors | ||
| Line 141: | Line 141: | ||
<br/> | <br/> | ||
| − | + | <syntaxhighlight lang="C" style="width:80%; border:1px solid lightgrey; "> | |
| − | <syntaxhighlight lang="C" style="border:1px solid lightgrey; "> | ||
int SBox_iGetData(int _iModelName, TSBDataFmt *_ptData); | int SBox_iGetData(int _iModelName, TSBDataFmt *_ptData); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
*Brief | *Brief | ||
:Update only one sensor and get data | :Update only one sensor and get data | ||
Revision as of 09:56, 20 August 2019
Contents
Introduction
Sensor Box has general interface to collect sensor data and it benefits the user easy to use.
Architecture
Content.
Source tree
Content.
| Directory | Description |
| sensor_api | The source code of API of Sensor Box. |
| sensor_driver | The source code of sensor driver. |
| sensor_lib_cfg.sh | The script used to configure which sensor we enable/disable. |
Sensor list
Currently, these sensors are ported into sensor box as default.
- HDC1080 - Digital Temperature/Humidity Sensor
Item Description Vendor Texas Instruments Interface I2C Pin-defined Check
- DS18B20 - 1-Wire Digital Thermometer
Item Description Vendor Maxim Interface GPIO Pin-defined Check
- VL53L0X - Time-of-Flight ranging sensor
Item Description Vendor STMicroelectronics Interface I2C Pin-defined Check
- HPMA215S0-XXX - Particle Sensor
Item Description Vendor Honeywell Interface I2C Pin-defined Check
API
Content.
int SBox_iInit(void);
- Brief
- Initialize sensor box
- Parameters
- None
- Return
- On success, eSErr_None is returned.
- On error, other is returned.
int SBox_iUnInit(void);
- Brief
- Uninitialize sensor box
- Parameters
- None
- Return
- On success, eSErr_None is returned.
- On error, other is returned.
int SBox_iGetAllData(TSBDataFmt *_ptDataSet);
- Brief
- Update all sensors and get all data of sensors
- Parameters
- _ptDataSet: the pointer to data buffer that is used to get sensor data back.
- Return
- On success, eSErr_None is returned.
- On error, other is returned.
int SBox_iGetData(int _iModelName, TSBDataFmt *_ptData);
- Brief
- Update only one sensor and get data
- Parameters
- _iModelName: the index of model name to specify which sensor will be updated.
- _ptData: the pointer to data that is used to get sensor data back.
- Return
- On success, eSErr_None is returned.
- On error, other is returned.
Get sensor box
Content.
Example
Content.
How to porting new sensor into sensor box
Content.