update the sub-title of apprach/gan.md

This commit is contained in:
Yan_yan 2020-11-06 15:32:32 +08:00
parent 0333d1f582
commit 1ef86c63c8
1 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# 感-传感器框架
# 感 - 传感器框架
多数嵌入式操作系统对传感器的抽象采用以物理传感器设备为中心的方式,在应用开发时无法绕过传感器设备的多样性,进而增加了传感器应用的开发难度和周期。这种抽象带来的缺陷在面对一些可以同时采集多种物理量的传感器(如温湿度传感器)时尤为突出,因为应用开发者不得不考虑每种传感器设备的采集数据的能力。
@ -10,7 +10,9 @@ XiUOS的传感器框架以用户为中心采用了以物理量为中心的抽
从关联关系上来看一个xs_SensorQuantity对应一个xs_SensorDevice一个xs_SensorDevice对应一个或多个xs_SensorQuantity。例如对于一个可以测量温度与湿度的传感器设备该设备唯一对应一个xs_SensorDevice结构而该设备测量温度与湿度的能力分别对应一个xs_SensorQuantity结构。两种数据结构的具体定义如下。
## struct xs_SensorQuantity结构
## 1. XiUOS传感器框架的关键数据结构定义和解析
* struct xs_SensorQuantity结构
```c
struct xs_SensorQuantity {
const char name[XS_NAME_MAX]; /* name of the sensor quantity instance */
@ -36,7 +38,7 @@ sdev成员表示该xs_SensorQuantity所属的xs_SensorDevice结构其具体
最后在系统中每种物理量的xs_SensorQuantity被分别组织成不同双链表如二氧化碳浓度xs_SensorQuantity链表、温度xs_SensorQuantity链表等使用的链表节点即为link成员。
## struct xs_SensorDevice结构
* struct xs_SensorDevice结构
```c
struct xs_SensorDevice {
const char name[XS_NAME_MAX]; /* name of the sensor device */
@ -82,7 +84,7 @@ struct xs_SensorInterface {
最后系统中所有注册过的传感器设备被组织成一个双链表即link成员。
## 传感器框架驱动开发
## 2. XiUOS传感器框架驱动开发
以二氧化碳传感器为例。传感器框架针对每个具体的物理量将xs_SensorQuantity进行扩充采用类似面向对象的手段添加其他必要成员
```c
@ -151,7 +153,7 @@ void register_co2_sensor()
}
```
## 传感器框架的使用
## 3. XiUOS传感器框架的使用实例
传感器应用开发者使用传感器框架提供的API操作传感器传感器API可以分为通用API与物理量特有API。通用API用于传感器的获取、打开与关闭物理量特有API用于传感器的数据采样。以二氧化碳传感器为例
```c