未验证 提交 66cbb622 编写于 作者: O openharmony_ci 提交者: Gitee

!8703 【翻译完成】#I5BWI8

Merge pull request !8703 from Annie_wang/PR7213
...@@ -97,9 +97,10 @@ The sensor driver model provides driver development APIs that do not require fur ...@@ -97,9 +97,10 @@ The sensor driver model provides driver development APIs that do not require fur
The sensor driver model also provides certain driver development APIs that need to be implemented by driver developers. See the table below. The sensor driver model also provides certain driver development APIs that need to be implemented by driver developers. See the table below.
**Table 3** Driver development APIs that need to be implemented by driver developers **Table 3** APIs that need to be implemented by driver developers
| API| Description| | API| Description|
| ----- | -------- | | ----- | -------- |
...@@ -197,7 +198,7 @@ The sensor driver model also provides certain driver development APIs that need ...@@ -197,7 +198,7 @@ The sensor driver model also provides certain driver development APIs that need
} }
struct SensorCfgData *AccelCreateCfgData(const struct DeviceResourceNode *node) struct SensorCfgData *AccelCreateCfgData(const struct DeviceResourceNode *node)
{ {
...... ...
/* Continue the next detection if the sensor is not detected. */ /* Continue the next detection if the sensor is not detected. */
if (drvData->detectFlag) { if (drvData->detectFlag) {
HDF_LOGE("%s: Accel sensor have detected", __func__); HDF_LOGE("%s: Accel sensor have detected", __func__);
...@@ -225,12 +226,12 @@ The sensor driver model also provides certain driver development APIs that need ...@@ -225,12 +226,12 @@ The sensor driver model also provides certain driver development APIs that need
goto INIT_EXIT; goto INIT_EXIT;
} }
return drvData->accelCfg; return drvData->accelCfg;
...... ...
} }
/* The entry function of the acceleration sensor driver is used to initialize the sensor private data structure object, allocate space for the sensor HCS data configuration object, call the entry function for initializing the sensor HCS data configuration, detect whether the sensor device is in position, create a sensor data reporting timer, register the sensor normalization APIs, and register the sensor device. */ /* The entry function of the acceleration sensor driver is used to initialize the sensor private data structure object, allocate space for the sensor HCS data configuration object, call the entry function for initializing the sensor HCS data configuration, detect whether the sensor device is in position, create a sensor data reporting timer, register the sensor normalization APIs, and register the sensor device. */
int32_t AccelInitDriver(struct HdfDeviceObject *device) int32_t AccelInitDriver(struct HdfDeviceObject *device)
{ {
...... ...
/* Initialize work queue resources. */ /* Initialize work queue resources. */
if (InitAccelData(drvData) != HDF_SUCCESS) { if (InitAccelData(drvData) != HDF_SUCCESS) {
HDF_LOGE("%s: Init accel config failed", __func__); HDF_LOGE("%s: Init accel config failed", __func__);
...@@ -244,7 +245,7 @@ The sensor driver model also provides certain driver development APIs that need ...@@ -244,7 +245,7 @@ The sensor driver model also provides certain driver development APIs that need
} }
/* Register the register group information. */ /* Register the register group information. */
drvData->accelCfg->regCfgGroup = &g_regCfgGroup[0]; drvData->accelCfg->regCfgGroup = &g_regCfgGroup[0];
...... ...
return HDF_SUCCESS; return HDF_SUCCESS;
} }
/* Release the resources allocated during driver initialization. */ /* Release the resources allocated during driver initialization. */
...@@ -501,7 +502,7 @@ The sensor driver model also provides certain driver development APIs that need ...@@ -501,7 +502,7 @@ The sensor driver model also provides certain driver development APIs that need
event.sensorId = SENSOR_TAG_ACCELEROMETER; event.sensorId = SENSOR_TAG_ACCELEROMETER;
event.option = 0; event.option = 0;
event.mode = SENSOR_WORK_MODE_REALTIME; event.mode = SENSOR_WORK_MODE_REALTIME;
...... ...
ret = ReportSensorEvent(&event); ret = ReportSensorEvent(&event);
if (ret != HDF_SUCCESS) { if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: BMI160 report data failed", __func__); HDF_LOGE("%s: BMI160 report data failed", __func__);
...@@ -543,7 +544,7 @@ void HdfSensorTest::SetUpTestCase() ...@@ -543,7 +544,7 @@ void HdfSensorTest::SetUpTestCase()
{ {
g_sensorDev = NewSensorInterfaceInstance(); g_sensorDev = NewSensorInterfaceInstance();
if (g_sensorDev == nullptr) { if (g_sensorDev == nullptr) {
printf("test sensorHdi get Module instance failed\n\r"); printf("test sensor get module instance failed\n\r");
} }
} }
/* Release case resources. */ /* Release case resources. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册