未验证 提交 60b0c4c5 编写于 作者: O openharmony_ci 提交者: Gitee

!4540 【OpenHarmony开源贡献者计划2022】调整driver light文档中示例代码格式

Merge pull request !4540 from hgv5/dev
...@@ -180,9 +180,9 @@ The light driver model provides APIs to obtain information about all the lights ...@@ -180,9 +180,9 @@ The light driver model provides APIs to obtain information about all the lights
drvData->lightNum = parser->GetElemNum(light, "lightType"); drvData->lightNum = parser->GetElemNum(light, "lightType");
.... ....
for (i = 0; i < drvData->lightNum; ++i) { for (i = 0; i < drvData->lightNum; ++i) {
/* Obtains the light type information. */ /* Obtains the light type information. */
ret = parser->GetUint32ArrayElem(light, "lightType", i, &temp, 0); ret = parser->GetUint32ArrayElem(light, "lightType", i, &temp, 0);
CHECK_LIGHT_PARSER_RESULT_RETURN_VALUE(ret, "lightType"); CHECK_LIGHT_PARSER_RESULT_RETURN_VALUE(ret, "lightType");
} }
for (i = 0; i < drvData->lightNum; ++i) { for (i = 0; i < drvData->lightNum; ++i) {
...@@ -261,13 +261,13 @@ The light driver model provides APIs to obtain information about all the lights ...@@ -261,13 +261,13 @@ The light driver model provides APIs to obtain information about all the lights
/* Create a timer. */ /* Create a timer. */
if (OsalTimerCreate(&drvData->timer, drvData->info[lightType]->onTime, if (OsalTimerCreate(&drvData->timer, drvData->info[lightType]->onTime,
LightTimerEntry, (uintptr_t)lightType) != HDF_SUCCESS) { LightTimerEntry, (uintptr_t)lightType) != HDF_SUCCESS) {
HDF_LOGE("%s: create light timer fail!", __func__); HDF_LOGE("%s: create light timer fail!", __func__);
return HDF_FAILURE; return HDF_FAILURE;
} }
/* Start the periodic timer. */ /* Start the periodic timer. */
if (OsalTimerStartLoop(&drvData->timer) != HDF_SUCCESS) { if (OsalTimerStartLoop(&drvData->timer) != HDF_SUCCESS) {
HDF_LOGE("%s: start light timer fail!", __func__); HDF_LOGE("%s: start light timer fail!", __func__);
return HDF_FAILURE; return HDF_FAILURE;
} }
} }
return HDF_SUCCESS; return HDF_SUCCESS;
......
...@@ -180,9 +180,9 @@ Light驱动模型支持获取系统中所有灯的信息,动态配置闪烁模 ...@@ -180,9 +180,9 @@ Light驱动模型支持获取系统中所有灯的信息,动态配置闪烁模
drvData->lightNum = parser->GetElemNum(light, "lightType"); drvData->lightNum = parser->GetElemNum(light, "lightType");
.... ....
for (i = 0; i < drvData->lightNum; ++i) { for (i = 0; i < drvData->lightNum; ++i) {
/* 获取灯的类型 */ /* 获取灯的类型 */
ret = parser->GetUint32ArrayElem(light, "lightType", i, &temp, 0); ret = parser->GetUint32ArrayElem(light, "lightType", i, &temp, 0);
CHECK_LIGHT_PARSER_RESULT_RETURN_VALUE(ret, "lightType"); CHECK_LIGHT_PARSER_RESULT_RETURN_VALUE(ret, "lightType");
} }
for (i = 0; i < drvData->lightNum; ++i) { for (i = 0; i < drvData->lightNum; ++i) {
...@@ -261,13 +261,13 @@ Light驱动模型支持获取系统中所有灯的信息,动态配置闪烁模 ...@@ -261,13 +261,13 @@ Light驱动模型支持获取系统中所有灯的信息,动态配置闪烁模
/* 创建定时器 */ /* 创建定时器 */
if (OsalTimerCreate(&drvData->timer, drvData->info[lightType]->onTime, if (OsalTimerCreate(&drvData->timer, drvData->info[lightType]->onTime,
LightTimerEntry, (uintptr_t)lightType) != HDF_SUCCESS) { LightTimerEntry, (uintptr_t)lightType) != HDF_SUCCESS) {
HDF_LOGE("%s: create light timer fail!", __func__); HDF_LOGE("%s: create light timer fail!", __func__);
return HDF_FAILURE; return HDF_FAILURE;
} }
/* 启动周期定时器 */ /* 启动周期定时器 */
if (OsalTimerStartLoop(&drvData->timer) != HDF_SUCCESS) { if (OsalTimerStartLoop(&drvData->timer) != HDF_SUCCESS) {
HDF_LOGE("%s: start light timer fail!", __func__); HDF_LOGE("%s: start light timer fail!", __func__);
return HDF_FAILURE; return HDF_FAILURE;
} }
} }
return HDF_SUCCESS; return HDF_SUCCESS;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册